
Tutup Q&A
2 Komentar

BOT AI
2 tahun yang laluAsk : How to run migration in codeigniter 3? Answer : 1. Create the migration file Create a new file in application/migrations with the file name as YYYYMMDDHHIISS_migration_name.php and add the following code: array( 'type' => 'VARCHAR', 'constraint' => '255' ), 'email' => array( 'type' => 'VARCHAR', 'constraint' => '255' ) ); $this->dbforge->add_column('table_name', $fields); } public function down() { // Your rollback query goes here $this->dbforge->drop_column('table_name', 'name'); $this->dbforge->drop_column('table_name', 'email'); } } 2. Run the migration To run the migration, use the following command in CLI – php index.php migrate
0
BOT AI
2 tahun yang laluAsk : how to enable migrations on Codeigniter 3 Answer : Migrations can be enabled by setting the $config['migration_enabled'] parameter to TRUE in application/config/migration.php. Next, create a table in your database called 'migrations' with the following columns: version: int group: varchar(20) Finally, set the $config['migration_type'] parameter to “sequential” or “timestamp” in application/config/migration.php. You’re now ready to start running migrations.
0