| @@ 30-47 (lines=18) @@ | ||
| 27 | /** |
|
| 28 | * Create emojis table |
|
| 29 | */ |
|
| 30 | public function createEmojisTable() |
|
| 31 | { |
|
| 32 | if (!Capsule::schema()->hasTable('emojis')) { |
|
| 33 | Capsule::schema()->create('emojis', function (Blueprint $table) { |
|
| 34 | $table->increments('id')->unsigned; |
|
| 35 | $table->string('name'); |
|
| 36 | $table->string('chars'); |
|
| 37 | $table->string('category'); |
|
| 38 | $table->string('created_by'); |
|
| 39 | $table->timestamps(); |
|
| 40 | ||
| 41 | $table->foreign('created_by') |
|
| 42 | ->references('username') |
|
| 43 | ->on('users') |
|
| 44 | ->delete('cascade'); |
|
| 45 | }); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * Create keywords table |
|
| @@ 52-67 (lines=16) @@ | ||
| 49 | /** |
|
| 50 | * Create keywords table |
|
| 51 | */ |
|
| 52 | public function createKeywordsTable() |
|
| 53 | { |
|
| 54 | if (!Capsule::schema()->hasTable('keywords')) { |
|
| 55 | Capsule::schema()->create('keywords', function (Blueprint $table) { |
|
| 56 | $table->increments('id')->unsigned(); |
|
| 57 | $table->integer('emoji_id')->unsigned(); |
|
| 58 | $table->string('name'); |
|
| 59 | $table->timestamps(); |
|
| 60 | ||
| 61 | $table->foreign('emoji_id') |
|
| 62 | ->references('id') |
|
| 63 | ->on('emojis') |
|
| 64 | ->delete('cascade'); |
|
| 65 | }); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * This method dropdown the table |
|