diff options
Diffstat (limited to 'application/migrations/007_repurpose_invitations.php')
-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`; + "); + } +} |