diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-01-24 19:28:17 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-01-24 19:29:48 +0100 |
commit | 7c7eaa5feb44ff93d30a97e8a323680419df3672 (patch) | |
tree | 060dc43f6edc15a252cbfd265f44281059cf4072 /application/migrations | |
parent | 54eec0dfee36ba686cdcc4515bccea79b07c2393 (diff) |
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 <bluewind@xinu.at>
Diffstat (limited to 'application/migrations')
-rw-r--r-- | application/migrations/007_repurpose_invitations.php | 37 |
1 files changed, 37 insertions, 0 deletions
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 @@ +<?php +defined('BASEPATH') OR exit('No direct script access allowed'); + +class Migration_Repurpose_invitations extends CI_Migration { + + public function up() + { + $this->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`; + "); + } +} |