| @@ 6-23 (lines=18) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreateTagsTable extends Migration { |
|
| 7 | ||
| 8 | public function up() |
|
| 9 | { |
|
| 10 | Schema::create('tagging_tags', function(Blueprint $table) { |
|
| 11 | $table->increments('id'); |
|
| 12 | $table->string('slug', 255)->index(); |
|
| 13 | $table->string('name', 255); |
|
| 14 | $table->boolean('suggest')->default(false); |
|
| 15 | $table->integer('count')->unsigned()->default(0); // count of how many times this tag was used |
|
| 16 | }); |
|
| 17 | } |
|
| 18 | ||
| 19 | public function down() |
|
| 20 | { |
|
| 21 | Schema::drop('tagging_tags'); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | ||
| @@ 6-34 (lines=29) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreateFileAssetsTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function up() |
|
| 14 | { |
|
| 15 | Schema::create('file_assets', function (Blueprint $table) { |
|
| 16 | $table->increments('id'); |
|
| 17 | $table->string('name')->index(); |
|
| 18 | $table->string('type', 20)->index(); |
|
| 19 | $table->string('category', 20)->index(); |
|
| 20 | $table->string('url', 512); |
|
| 21 | $table->timestamps(); |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Reverse the migrations. |
|
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | public function down() |
|
| 31 | { |
|
| 32 | Schema::drop('file_assets'); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 6-23 (lines=18) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class UpdateTagsTable extends Migration |
|
| 7 | { |
|
| 8 | public function up() |
|
| 9 | { |
|
| 10 | Schema::table('tagging_tags', function (Blueprint $table) { |
|
| 11 | $table->integer('tag_group_id')->unsigned()->nullable()->after('id'); |
|
| 12 | $table->foreign('tag_group_id', 'tag_group_id_foreign')->references('id')->on('tagging_tag_groups'); |
|
| 13 | }); |
|
| 14 | } |
|
| 15 | ||
| 16 | public function down() |
|
| 17 | { |
|
| 18 | Schema::table('tagging_tags', function ($table) { |
|
| 19 | $table->dropForeign('tag_group_id_foreign'); |
|
| 20 | $table->dropColumn('tag_group_id'); |
|
| 21 | }); |
|
| 22 | } |
|
| 23 | } |
|
| 24 | ||