I was wondering if someone can help out.
Im just getting into using migrations with CodeIgniter, but im having trouble trying to figure out how to convert SQL to the migrations.
Is there anyone out there that could convert this SQL to migrations for me so i can see how its done.
The SQL i have is as follows:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`session_id` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '0',
`ip_address` varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '0',
`user_agent` varchar(150) COLLATE utf8_bin NOT NULL,
`last_activity` int(10) unsigned NOT NULL DEFAULT '0',
`user_data` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Please read the documentation here:
CodeIgniter Migrations
In essence, you will want to use the CodeIgniter
dbforgeclass to create the table. Using your code above:Documentation on
dbforgeclass can be found here:ellislab.com/codeigniter/user-guide/database/forge.html
Note: I don’t recommend messing with the CI Sessions table, though.