]> git.quilime.com - clmpr.git/commitdiff
database migration v0.1
authorGabriel Dunne <gdunne@quilime.com>
Wed, 21 Dec 2011 22:02:23 +0000 (14:02 -0800)
committerGabriel Dunne <gdunne@quilime.com>
Wed, 21 Dec 2011 22:02:23 +0000 (14:02 -0800)
_migrate.php [new file with mode: 0644]
get.php

diff --git a/_migrate.php b/_migrate.php
new file mode 100644 (file)
index 0000000..f542239
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+include 'init.php';
+
+$dbh = get_db_connection();
+$dbh->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 3fdfe1cbd2a3f00b0835629e1e4855b1bdf22b83..0362670ea1638f289cf34f96b0147e5e4a5e3fba 100644 (file)
--- a/get.php
+++ b/get.php
@@ -98,7 +98,6 @@ bookmarklet:
 </p>
 <?php endif; ?>
 
-
 <hr />
 
 <script>