Convert Horde_Auth to migrations.
authorJan Schneider <jan@horde.org>
Fri, 28 Jan 2011 17:41:17 +0000 (18:41 +0100)
committerJan Schneider <jan@horde.org>
Fri, 28 Jan 2011 18:07:06 +0000 (19:07 +0100)
framework/Auth/migration/Horde/Auth/1_horde_auth_base_tables.php [new file with mode: 0644]
horde/scripts/sql/horde_users.sql [deleted file]

diff --git a/framework/Auth/migration/Horde/Auth/1_horde_auth_base_tables.php b/framework/Auth/migration/Horde/Auth/1_horde_auth_base_tables.php
new file mode 100644 (file)
index 0000000..ab2a562
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+class HordeAuthBaseTables extends Horde_Db_Migration_Base
+{
+    public function up()
+    {
+        if (!in_array('horde_users', $this->tables())) {
+            $t = $this->createTable('horde_users', array('primaryKey' => array('user_uid')));
+            $t->column('user_uid', 'string', array('limit' => 255, 'null' => false));
+            $t->column('user_pass', 'string', array('limit' => 255, 'null' => false));
+            $t->column('user_soft_expiration_date', 'integer');
+            $t->column('user_hard_expiration_date', 'integer');
+            $t->end();
+        }
+    }
+
+    public function down()
+    {
+        $this->dropTable('horde_users');
+    }
+}
diff --git a/horde/scripts/sql/horde_users.sql b/horde/scripts/sql/horde_users.sql
deleted file mode 100644 (file)
index 4ebe875..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE horde_users (
-    user_uid                    VARCHAR(255) NOT NULL,
-    user_pass                   VARCHAR(255) NOT NULL,
-    user_soft_expiration_date   INTEGER,
-    user_hard_expiration_date   INTEGER,
---
-    PRIMARY KEY (user_uid)
-);