This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/migrations/2015_05_08_174736_notifications_table.php

39 lines
1.4 KiB
PHP
Raw Normal View History

2016-02-19 21:49:00 +00:00
<?php
use Sakura\Migration\IMigration;
use Sakura\DB;
class NotificationsTable implements IMigration
{
public function up()
{
// Add notifications table
DB::prepare("CREATE TABLE `{prefix}notifications` (
`id` bigint(255) unsigned NOT NULL AUTO_INCREMENT,
`uid` bigint(255) unsigned NOT NULL DEFAULT '0',
`timestamp` int(11) unsigned NOT NULL DEFAULT '0',
`notif_read` tinyint(1) unsigned NOT NULL DEFAULT '0',
`notif_title` varchar(255) COLLATE utf8_bin NOT NULL,
`notif_text` varchar(255) COLLATE utf8_bin NOT NULL,
`notif_link` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`notif_img` varchar(255) COLLATE utf8_bin NOT NULL,
`notif_timeout` int(16) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin")
->execute();
// Change mod to iid in warnings table
DB::prepare('ALTER TABLE `{prefix}warnings` CHANGE `mod` `iid` bigint(128)')
->execute();
}
public function down()
{
// Drop the notifications table
DB::prepare("DROP TABLE `{prefix}notifications`")->execute();
// Change iid to mod in warnings table
DB::prepare('ALTER TABLE `{prefix}warnings` CHANGE `iid` `mod` bigint(128)')
->execute();
}
}