14 use Illuminate\Database\Migrations\Migration;
15 use Illuminate\Database\Schema\Builder;
16 use Illuminate\Database\Schema\Blueprint;
17 use Illuminate\Database\Capsule\Manager as Capsule;
24 public function up() {
26 Capsule::schema()->create(
'announcement_types',
function (Blueprint $table) {
27 $table->bigInteger(
'type_id')->autoIncrement();
28 $table->smallInteger(
'assoc_type');
29 $table->bigInteger(
'assoc_id');
30 $table->index([
'assoc_type',
'assoc_id'],
'announcement_types_assoc');
34 Capsule::schema()->create(
'announcement_type_settings',
function (Blueprint $table) {
35 $table->bigInteger(
'type_id');
36 $table->string(
'locale', 14)->
default(
'');
37 $table->string(
'setting_name', 255);
38 $table->text(
'setting_value')->nullable();
39 $table->string(
'setting_type', 6);
40 $table->index([
'type_id'],
'announcement_type_settings_type_id');
41 $table->unique([
'type_id',
'locale',
'setting_name'],
'announcement_type_settings_pkey');
45 Capsule::schema()->create(
'announcements',
function (Blueprint $table) {
46 $table->bigInteger(
'announcement_id')->autoIncrement();
48 $table->smallInteger(
'assoc_type')->nullable();
49 $table->bigInteger(
'assoc_id');
50 $table->bigInteger(
'type_id')->nullable();
51 $table->date(
'date_expire')->nullable();
52 $table->datetime(
'date_posted');
53 $table->index([
'assoc_type',
'assoc_id'],
'announcements_assoc');
57 Capsule::schema()->create(
'announcement_settings',
function (Blueprint $table) {
58 $table->bigInteger(
'announcement_id');
59 $table->string(
'locale', 14)->
default(
'');
60 $table->string(
'setting_name', 255);
61 $table->text(
'setting_value')->nullable();
62 $table->string(
'setting_type', 6)->nullable();
63 $table->index([
'announcement_id'],
'announcement_settings_announcement_id');
64 $table->unique([
'announcement_id',
'locale',
'setting_name'],
'announcement_settings_pkey');
73 Capsule::schema()->drop(
'announcement_types');
74 Capsule::schema()->drop(
'announcement_type_settings');
75 Capsule::schema()->drop(
'announcements');
76 Capsule::schema()->drop(
'announcement_settings');