简体   繁体   中英

Migrating existing cakephp 3.0 database to postgres from mysql

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.

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM