CodeIgniter Forums
Prepare ci_sessions for future Migration - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Prepare ci_sessions for future Migration (/showthread.php?tid=79011)



Prepare ci_sessions for future Migration - nurmyrat - 04-08-2021

Hello CodeIgnitians.

Recently I started to work on some project and decided to do it with CodeIgniter ( Laravel was the first choice ) and had an idea to prepare 
common needed libraries and controllers at hand ( like in Laravel ) and later just have a new copy of a prepared ( by a composer ) project and
start a new one with everything at hand.

I copied the two migrations from Laravel and make a migration for CI 4
1) 2014_10_12_000000_create_users_table
2) 2014_10_12_100000_create_password_resets_table  (has this line $table->string('email')->index())

and also prepared ci_session database from https://www.codeigniter.com/user_guide/libraries/sessions.html#databasehandler-driver documentation

However there was a problem with KEY/INDEX ( yes I know they are the same for MySQL)

CREATE TABLE IF NOT EXISTS `ci_sessions` (
        `id` varchar(128) NOT NULL,
        `ip_address` varchar(45) NOT NULL,
        `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
        `data` blob NOT NULL,
        KEY `ci_sessions_timestamp` (`timestamp`)
);


the following code 

$this->forge->addKey('timestamp')

has not the same effect with the SQL statement written above which in MySQL it is done with CREATE INDEX statement.

Is there any solution or way to replicate the CREATE INDEX statment with $this->forge->!!!   ?