Convert Horde_Core_Auth_Signup to migrations.
authorJan Schneider <jan@horde.org>
Fri, 28 Jan 2011 17:24:11 +0000 (18:24 +0100)
committerJan Schneider <jan@horde.org>
Fri, 28 Jan 2011 18:07:06 +0000 (19:07 +0100)
framework/Core/migration/Horde/Core/1_horde_core_base_tables.php [new file with mode: 0644]
horde/scripts/sql/horde_signups.mysql.sql [deleted file]
horde/scripts/sql/horde_signups.sql [deleted file]
horde/scripts/upgrades/2009-09-10_horde_signup_drop_email.sql [deleted file]

diff --git a/framework/Core/migration/Horde/Core/1_horde_core_base_tables.php b/framework/Core/migration/Horde/Core/1_horde_core_base_tables.php
new file mode 100644 (file)
index 0000000..8c10c62
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+class HordeCoreBaseTables extends Horde_Db_Migration_Base
+{
+    public function up()
+    {
+        if (!in_array('horde_signups', $this->tables())) {
+            $t = $this->createTable('horde_signups', array('primaryKey' => array('user_name')));
+            $t->column('user_name', 'string', array('limit' => 255, 'null' => false));
+            $t->column('signup_date', 'integer', array('null' => false));
+            $t->column('signup_host', 'string', array('limit' => 255, 'null' => false));
+            $t->column('signup_data', 'text', array('null' => false));
+            $t->end();
+        }
+    }
+
+    public function down()
+    {
+        $this->dropTable('horde_signups');
+    }
+}
diff --git a/horde/scripts/sql/horde_signups.mysql.sql b/horde/scripts/sql/horde_signups.mysql.sql
deleted file mode 100644 (file)
index 3723367..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE horde_signups (
-    user_name VARCHAR(255) NOT NULL,
-    signup_date VARCHAR(255) NOT NULL,
-    signup_host VARCHAR(255) NOT NULL,
-    signup_data TEXT NOT NULL,
-    PRIMARY KEY user_name (user_name)
-);
diff --git a/horde/scripts/sql/horde_signups.sql b/horde/scripts/sql/horde_signups.sql
deleted file mode 100644 (file)
index 1fbb429..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE horde_signups (
-    user_name VARCHAR(255) NOT NULL,
-    signup_date INTEGER NOT NULL,
-    signup_host VARCHAR(255) NOT NULL,
-    signup_data TEXT NOT NULL,
-    PRIMARY KEY (user_name)
-);
diff --git a/horde/scripts/upgrades/2009-09-10_horde_signup_drop_email.sql b/horde/scripts/upgrades/2009-09-10_horde_signup_drop_email.sql
deleted file mode 100644 (file)
index decd11c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE horde_signups DROP COLUMN signup_email;