/
2018_10_30_000000_create_tables.php
80 lines (71 loc) · 2.38 KB
/
2018_10_30_000000_create_tables.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wink_tags', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('slug')->unique();
$table->string('name');
$table->timestamps();
$table->index('created_at');
});
Schema::create('wink_posts_tags', function (Blueprint $table) {
$table->uuid('post_id');
$table->uuid('tag_id');
$table->unique(['post_id', 'tag_id']);
});
Schema::create('wink_posts', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('slug')->unique();
$table->string('title');
$table->text('excerpt');
$table->text('body');
$table->boolean('published')->default(false);
$table->dateTime('publish_date')->default('2018-10-10 00:00:00');
$table->string('featured_image')->nullable();
$table->string('featured_image_caption');
$table->uuid('author_id')->index();
$table->timestamps();
});
Schema::create('wink_authors', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('slug')->unique();
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->text('bio');
$table->string('avatar')->nullable();
$table->rememberToken();
$table->timestamps();
});
Schema::create('wink_pages', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('slug')->unique();
$table->string('title');
$table->text('body');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wink_tags');
Schema::dropIfExists('wink_posts_tags');
Schema::dropIfExists('wink_authors');
Schema::dropIfExists('wink_posts');
Schema::dropIfExists('wink_pages');
}
}