summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/config/mimes.php2
-rw-r--r--application/controllers/migrate.php40
-rw-r--r--application/migrations/001_Create_accounts.php32
3 files changed, 73 insertions, 1 deletions
diff --git a/application/config/mimes.php b/application/config/mimes.php
index de923c45a..58eea5f83 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -56,7 +56,7 @@ $mimes = array( 'hqx' => 'application/mac-binhex40',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
- 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3'),
+ 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'aifc' => 'audio/x-aiff',
diff --git a/application/controllers/migrate.php b/application/controllers/migrate.php
new file mode 100644
index 000000000..e5442e79c
--- /dev/null
+++ b/application/controllers/migrate.php
@@ -0,0 +1,40 @@
+<?php
+class Migrate extends CI_Controller
+{
+ function __construct()
+ {
+ parent::__construct();
+
+ $this->load->library('migration');
+
+ /** VERY IMPORTANT - only turn this on when you need it. */
+// show_error('Access to this controller is blocked, turn me on when you need me.');
+ }
+
+ // Install up to the most up-to-date version.
+ function install()
+ {
+ if ( ! $this->migration->current())
+ {
+ show_error($this->migration->error);
+ exit;
+ }
+
+ echo "<br />Migration Successful<br />";
+ }
+
+ // This will migrate up to the configed migration version
+ function version($id = NULL)
+ {
+ // No $id supplied? Use the config version
+ $id OR $id = $this->config->item('migration_version');
+
+ if ( ! $this->migration->version($id))
+ {
+ show_error($this->migration->error);
+ exit;
+ }
+
+ echo "<br />Migration Successful<br />";
+ }
+}
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');
+ }
+}