Convert horde_cache to migrations.
authorJan Schneider <jan@horde.org>
Wed, 26 Jan 2011 20:39:03 +0000 (21:39 +0100)
committerJan Schneider <jan@horde.org>
Wed, 26 Jan 2011 20:39:03 +0000 (21:39 +0100)
framework/Cache/migration/Horde_Cache/1_horde_cache_base_tables.php [new file with mode: 0644]
framework/Cache/package.xml
horde/scripts/sql/horde_cache.pgsql.sql [deleted file]
horde/scripts/sql/horde_cache.sql [deleted file]

diff --git a/framework/Cache/migration/Horde_Cache/1_horde_cache_base_tables.php b/framework/Cache/migration/Horde_Cache/1_horde_cache_base_tables.php
new file mode 100644 (file)
index 0000000..be41cd6
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+class HordeCacheBaseTables extends Horde_Db_Migration_Base
+{
+    public function up()
+    {
+        if (!in_array('horde_cache', $this->tables())) {
+            $t = $this->createTable('horde_cache', array('primaryKey' => array('cache_id')));
+            $t->column('cache_id', 'string', array('limit' => 32, 'null' => false));
+            $t->column('cache_timestamp', 'bigint', array('null' => false));
+            $t->column('cache_expiration', 'bigint', array('null' => false));
+            $t->column('cache_data', 'binary');
+            $t->end();
+        }
+    }
+
+    public function down()
+    {
+        $this->dropTable('horde_cache');
+    }
+}
index 29036fe..6840edb 100644 (file)
@@ -19,8 +19,8 @@ Performance Suite&apos;s content cache), memcached, or an SQL table.</descriptio
   <email>slusarz@horde.org</email>
   <active>yes</active>
  </lead>
- <date>2010-11-16</date>
- <time>15:41:39</time>
+ <date>2011-01-26</date>
+ <time>21:38:11</time>
  <version>
   <release>0.2.0</release>
   <api>0.2.0</api>
@@ -65,6 +65,11 @@ Performance Suite&apos;s content cache), memcached, or an SQL table.</descriptio
      <file name="Cache.php" role="php" />
     </dir> <!-- /lib/Horde -->
    </dir> <!-- /lib -->
+   <dir name="migration">
+    <dir name="Horde_Cache">
+     <file name="1_horde_cache_base_tables.php" role="data" />
+    </dir> <!-- /migration/Horde_Cache -->
+   </dir> <!-- /migration -->
   </dir> <!-- / -->
  </contents>
  <dependencies>
@@ -126,6 +131,7 @@ Performance Suite&apos;s content cache), memcached, or an SQL table.</descriptio
    <install as="Horde/Cache/Storage/Sql.php" name="lib/Horde/Cache/Storage/Sql.php" />
    <install as="Horde/Cache/Storage/Stack.php" name="lib/Horde/Cache/Storage/Stack.php" />
    <install as="Horde/Cache/Storage/Xcache.php" name="lib/Horde/Cache/Storage/Xcache.php" />
+   <install as="migration/1_horde_cache_base_tables.php" name="migration/Horde_Cache/1_horde_cache_base_tables.php" />
   </filelist>
  </phprelease>
  <changelog>
@@ -170,7 +176,7 @@ Initial packaging.
     <release>beta</release>
     <api>beta</api>
    </stability>
-   <date>2010-11-16</date>
+   <date>2011-01-26</date>
    <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
    <notes>
 * Abstracted storage-specific code into &apos;Storage&apos; drivers.
diff --git a/horde/scripts/sql/horde_cache.pgsql.sql b/horde/scripts/sql/horde_cache.pgsql.sql
deleted file mode 100644 (file)
index c461d9d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE horde_cache (
-    cache_id          VARCHAR(32) NOT NULL,
-    cache_timestamp   BIGINT NOT NULL,
-    cache_expiration  BIGINT NOT NULL,
-    cache_data        TEXT,
-
-    PRIMARY KEY  (cache_id)
-);
diff --git a/horde/scripts/sql/horde_cache.sql b/horde/scripts/sql/horde_cache.sql
deleted file mode 100644 (file)
index 3c1c53a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-CREATE TABLE horde_cache (
-    cache_id          VARCHAR(32) NOT NULL,
-    cache_timestamp   BIGINT NOT NULL,
-    cache_expiration  BIGINT NOT NULL,
-    cache_data        LONGBLOB,
--- Or on PostgreSQL:
---  cache_data        TEXT,
--- Or on some other DBMS systems:
---  cache_data        IMAGE,
-
-    PRIMARY KEY  (cache_id)
-);