4

I am in the process of migrating a cakephp 3.0 database from mysql to postgress. I used this tool for the database migration and it worked beautifully. After that I changed the config file as shown below.

  'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Postgres',
            'persistent' => false,
            'host' => 'localhost',
            'port' => '5432',
            'username' => 'postgres',
            'password' => 'mypass',
            'database' => 'cake_bookmarks',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'log' => false,
            'quoteIdentifiers' => false,

            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
        ],

The root folder in localhost also shows "successfully connected to database". However when i run my application, it shows an error:

Cannot describe mytable. It has 0 columns. Cake\Database\Exception

I can't make sure if this is because of not connecting to the database (which i think is unlikely as the root page shows as connected) or cakephp being unable to use my database. If so, how can I fix the issue. I am quite new to cakephp too, just confguring and doing basic stuff.

3
  • Could you add which CakePHP version you're using? Commented Nov 26, 2015 at 11:58
  • 3,0 ,I'll update the question Commented Nov 26, 2015 at 12:00
  • Seems like you do not have the table in your database. I would suggest checking that the table is there, the database user has permissions for reading it and that you configured the right schema in the array. Commented Feb 18, 2016 at 18:52

1 Answer 1

2

Try the following (test after each step):

  • Check if the table is present in the database
  • Check if the expected columns are defined into the table
  • Clear the Cake cache (if is FileCache is enough to delete files under tmp/cache/persistent tmp/cache/models and tmp/cache/views
  • Check the permissions of the specific user on the database cake_bookmarks (maybe via phppgadmin)

Hope to help!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.