Skip to content

Commit d292fc0

Browse files
Merge pull request #1 from IFRCGo/feature/WN-170
Update tables and change seeders to fit the new structure off Key Messages and Supporting Messages
2 parents d988589 + 54ddf83 commit d292fc0

File tree

4 files changed

+1655
-14094
lines changed

4 files changed

+1655
-14094
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
use Illuminate\Database\Migrations\Migration;
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Support\Facades\Schema;
5+
6+
class ModifyWhatnowEntityStagesTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::table('whatnow_entity_stages', function (Blueprint $table) {
16+
$table->dropColumn('content');
17+
});
18+
}
19+
20+
/**
21+
* Reverse the migrations.
22+
*
23+
* @return void
24+
*/
25+
public function down()
26+
{
27+
Schema::table('whatnow_entity_stages', function (Blueprint $table) {
28+
$table->text('content')->nullable();
29+
});
30+
}
31+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
use Illuminate\Database\Migrations\Migration;
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Support\Facades\Schema;
5+
6+
class CreateKeyMessagesTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::dropIfExists('key_messages'); // Drop the table if it already exists
16+
17+
Schema::create('key_messages', function (Blueprint $table) {
18+
$table->increments('id');
19+
$table->unsignedInteger('entities_stage_id');
20+
$table->string('title', 255);
21+
$table->foreign('entities_stage_id')->references('id')->on('whatnow_entity_stages')->onDelete('cascade');
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::dropIfExists('key_messages');
33+
}
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
use Illuminate\Database\Migrations\Migration;
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Support\Facades\Schema;
5+
6+
class CreateSupportingMessagesTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::dropIfExists('supporting_messages'); // Drop the table if it already exists
16+
17+
Schema::create('supporting_messages', function (Blueprint $table) {
18+
$table->increments('id');
19+
$table->unsignedInteger('key_message_id');
20+
$table->text('content');
21+
$table->foreign('key_message_id')->references('id')->on('key_messages')->onDelete('cascade');
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::dropIfExists('supporting_messages');
33+
}
34+
}

0 commit comments

Comments
 (0)