1: | <?php |
2: | |
3: | use Illuminate\Database\Migrations\Migration; |
4: | use Illuminate\Database\Schema\Blueprint; |
5: | use Illuminate\Database\Capsule\Manager as Capsule; |
6: | |
7: | class CreateGroupContactTable extends Migration |
8: | { |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | public function up() |
15: | { |
16: | Capsule::schema()->create('contacts_group_contact', function (Blueprint $table) { |
17: | $table->increments('Id'); |
18: | $table->string('UUID')->default(''); |
19: | $table->integer('GroupId')->unsigned()->index(); |
20: | $table->foreign('GroupId')->references('Id')->on('contacts_groups')->onDelete('cascade'); |
21: | $table->integer('ContactId')->unsigned()->index(); |
22: | $table->foreign('ContactId')->references('Id')->on('contacts')->onDelete('cascade'); |
23: | $table->timestamp(\Aurora\System\Classes\Model::CREATED_AT)->nullable(); |
24: | $table->timestamp(\Aurora\System\Classes\Model::UPDATED_AT)->nullable(); |
25: | }); |
26: | } |
27: | |
28: | |
29: | |
30: | |
31: | |
32: | |
33: | public function down() |
34: | { |
35: | Capsule::schema()->dropIfExists('contacts_group_contact'); |
36: | } |
37: | } |
38: | |