Turning on migration, adding a migration to add lotw credentials to the database, and removing a sample migration.
这个提交包含在:
父节点
94603ca9b4
当前提交
266cd3f021
共有 3 个文件被更改,包括 23 次插入 和 34 次删除
|
|
@ -8,7 +8,7 @@
|
||||||
| whenever you intend to do a schema migration.
|
| whenever you intend to do a schema migration.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_enabled'] = FALSE;
|
$config['migration_enabled'] = TRUE;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = FALSE;
|
||||||
| be upgraded / downgraded to.
|
| be upgraded / downgraded to.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
$config['migration_version'] = 0;
|
$config['migration_version'] = 1;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
|
||||||
|
|
||||||
class Migration_Create_accounts extends CI_Migration {
|
|
||||||
|
|
||||||
function up()
|
|
||||||
{
|
|
||||||
if ( ! $this->db->table_exists('accounts'))
|
|
||||||
{
|
|
||||||
// Setup Keys
|
|
||||||
$this->dbforge->add_key('id', TRUE);
|
|
||||||
|
|
||||||
$this->dbforge->add_field(array(
|
|
||||||
'id' => array('type' => 'INT', 'constraint' => 5, 'unsigned' => TRUE, 'auto_increment' => TRUE),
|
|
||||||
'company_name' => array('type' => 'VARCHAR', 'constraint' => '200', 'null' => FALSE),
|
|
||||||
'first_name' => array('type' => 'VARCHAR', 'constraint' => '200', 'null' => FALSE),
|
|
||||||
'last_name' => array('type' => 'VARCHAR', 'constraint' => '200', 'null' => FALSE),
|
|
||||||
'phone' => array('type' => 'TEXT', 'null' => FALSE),
|
|
||||||
'email' => array('type' => 'TEXT', 'null' => FALSE),
|
|
||||||
'address' => array('type' => 'TEXT', 'null' => FALSE),
|
|
||||||
'Last_Update' => array('type' => 'DATETIME', 'null' => FALSE)
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->dbforge->add_field("Created_At TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP");
|
|
||||||
$this->dbforge->create_table('accounts', TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function down()
|
|
||||||
{
|
|
||||||
$this->dbforge->drop_table('accounts');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Migration_add_lotw_credentials extends CI_Migration {
|
||||||
|
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$fields = array(
|
||||||
|
'user_lotw_name VARCHAR(32) DEFAULT NULL',
|
||||||
|
'user_lotw_password VARCHAR(64) DEFAULT NULL'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->dbforge->add_column('users', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->dbforge->drop_column('users', 'user_lotw_name');
|
||||||
|
$this->dbforge->drop_column('users', 'user_lotw_password');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
正在加载…
在新工单中引用