From: Gabriel Dunne
Date: Wed, 21 Dec 2011 22:02:23 +0000 (-0800)
Subject: database migration
X-Git-Tag: v0.1^0
X-Git-Url: https://git.quilime.com/?a=commitdiff_plain;h=0d025a4ad19d1e4b6993140b95fa4b6fff85a0bb;p=clmpr.git
database migration
---
diff --git a/_migrate.php b/_migrate.php
new file mode 100644
index 0000000..f542239
--- /dev/null
+++ b/_migrate.php
@@ -0,0 +1,31 @@
+beginTransaction();
+
+$q = $dbh->prepare("SELECT *, clumps.id as clump_id
+ FROM clumps
+ JOIN users
+ ON users.id = clumps.user_id
+ ORDER BY date DESC");
+$q->execute();
+
+$clumps = array();
+for($i = 0; $row = $q->fetch(); $i++ ):
+ $clumps[] = $row;
+endfor;
+
+foreach($clumps as $clump) :
+ #update tags
+ $tags = str_replace(" ", ',', $clump['tags']);
+ # update clump
+ $update = $dbh->prepare("UPDATE `clumps` SET `tags` = '".$tags."' WHERE `id` = '".$clump['clump_id']."'");
+ $update->execute();
+endforeach;
+
+exit;
+
+$dbh = null;
+$q = null;
diff --git a/get.php b/get.php
index 3fdfe1c..0362670 100644
--- a/get.php
+++ b/get.php
@@ -98,7 +98,6 @@ bookmarklet:
-