From 7c7eaa5feb44ff93d30a97e8a323680419df3672 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 24 Jan 2013 19:28:17 +0100 Subject: Repurpose invitations table to actions This can be used to track data for all kinds of one-time actions like invitations and password resets. Signed-off-by: Florian Pritz --- .../migrations/007_repurpose_invitations.php | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 application/migrations/007_repurpose_invitations.php (limited to 'application/migrations/007_repurpose_invitations.php') diff --git a/application/migrations/007_repurpose_invitations.php b/application/migrations/007_repurpose_invitations.php new file mode 100644 index 000000000..36d3007e8 --- /dev/null +++ b/application/migrations/007_repurpose_invitations.php @@ -0,0 +1,37 @@ +db->query(" + ALTER TABLE `invitations` + ADD `action` VARCHAR(255) NOT NULL, + ADD `data` TEXT NULL, + ADD INDEX `action` (`action`); + "); + + $this->db->query(" + UPDATE `invitations` SET `action` = 'invitation' WHERE `action` = ''; + "); + + $this->db->query(" + RENAME TABLE `invitations` TO `actions` ; + "); + + } + + public function down() + { + $this->db->query(" + RENAME TABLE `actions` TO `invitations` ; + "); + + $this->db->query(" + ALTER TABLE `invitations` + DROP `action`, + DROP `data`; + "); + } +} -- cgit v1.2.3-24-g4f1b