Can I create an initial CodeIgniter db migration from .sql? Can I create an initial CodeIgniter db migration from .sql? mysql mysql

Can I create an initial CodeIgniter db migration from .sql?


Bit late reply, but I hacked a quick library that should generate the base migration file for you from your current DB. Its still beta, but works on my systems 40 tables+

https://github.com/liaan/codeigniter_migration_base_generation

L:


I was messing around with SQL files manually and then I discovered Jamie Rumbelow's schema library. It makes schema operation a little bit easier to manage then DBForge but still requires manual entry.

https://github.com/jamierumbelow/codeigniter-schema

Someone came up with a mashup of his base model and schema library and it makes prototyping much faster

https://github.com/williamknauss/schema_base_model_magic

this allows you to automate the CRUD model operations & schema


Visit https://github.com/fastworkx/ci_migrations_generator

You'll get something like this applications/migration/001_create_base.php.

public function up() {    ## Create Table sis_customer    $this->dbforge->add_field(array(        'id' => array(            'type' => 'VARCHAR',            'constraint' => 40,            'null' => FALSE,        ),        'ip_address' => array(            'type' => 'VARCHAR',            'constraint' => 45,            'null' => FALSE,        ),        'timestamp' => array(            'type' => 'INT',            'unsigned' => TRUE,            'null' => FALSE,            'default' => '0',        ),        'data' => array(            'type' => 'BLOB',            'null' => FALSE,        ),        '`datetime_reg` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ',    ));    $this->dbforge->create_table("sessions", TRUE);    $this->db->query('ALTER TABLE  `sessions` ENGINE = InnoDB');    ));public function down()  {    ### Drop table sessions ##    $this->dbforge->drop_table("sessions", TRUE);}