From 0d025a4ad19d1e4b6993140b95fa4b6fff85a0bb Mon Sep 17 00:00:00 2001 From: Gabriel Dunne Date: Wed, 21 Dec 2011 14:02:23 -0800 Subject: [PATCH] database migration --- _migrate.php | 31 +++++++++++++++++++++++++++++++ get.php | 1 - 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 _migrate.php 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:

-