diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-03-09 11:08:36 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-03-09 11:08:36 +0100 |
commit | 93ca71552d9a3e28eeaa00dd10755d20b2cbf32e (patch) | |
tree | 660233f2ec631e5730731491d2fd244fe15f7df8 /application/migrations/001_Create_accounts.php | |
parent | a9924b8352aa18869677bea0182c45e2a7e2ce37 (diff) | |
parent | 2f8b27efeb0a39c24eddf89cf31ea0fd113a6b71 (diff) |
Merged recent Core changes and fixed conflict.
Diffstat (limited to 'application/migrations/001_Create_accounts.php')
-rw-r--r-- | application/migrations/001_Create_accounts.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/application/migrations/001_Create_accounts.php b/application/migrations/001_Create_accounts.php new file mode 100644 index 000000000..4b2fc936f --- /dev/null +++ b/application/migrations/001_Create_accounts.php @@ -0,0 +1,32 @@ +<?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');
+ }
+}
|