CodeIgniter Forums
CodeIgniter4 migration postgres - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: CodeIgniter4 migration postgres (/showthread.php?tid=88834)



CodeIgniter4 migration postgres - mozzar - 11-17-2023

Hello,
I'm using ci4 with postgres database.
I have 2 questions:
- Is it possible to set the database schema in the .env file so that the migration creates my tables in the correct schema?
- Is it possible to add a comment to the table at the migration stage
Thanks for your help


RE: CodeIgniter4 migration postgres - mozzar - 11-24-2023

can someone help me ?


RE: CodeIgniter4 migration postgres - kenjis - 11-24-2023

(11-17-2023, 08:46 AM)mozzar Wrote: - Is it possible to set the database schema in the .env file so that the migration creates my tables in the correct schema?

No. You can write only Config values in .env.
You can know Config items when you see files in app/Config/.

(11-17-2023, 08:46 AM)mozzar Wrote: - Is it possible to add a comment to the table at the migration stage

Yes, but there is no methods for PostgreSQL's comments.
So you need to run SQL queries with query() method.
See https://codeigniter4.github.io/CodeIgniter4/database/queries.html#regular-queries

In migration files, you can get the db connection object as $this->db.
https://codeigniter4.github.io/CodeIgniter4/dbmgmt/migration.html#foreign-keys