|
|
@@ -0,0 +1,38 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+use Illuminate\Database\Migrations\Migration;
|
|
|
+use Illuminate\Database\Schema\Blueprint;
|
|
|
+use Illuminate\Support\Facades\Schema;
|
|
|
+
|
|
|
+class CreateTagsTable extends Migration
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Run the migrations.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function up()
|
|
|
+ {
|
|
|
+ DB::statement('CREATE EXTENSION IF NOT EXISTS "uuid-ossp";');
|
|
|
+ Schema::create('tags', function (Blueprint $table) {
|
|
|
+ $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
|
|
|
+ $table->string('name',32)->index();
|
|
|
+ $table->string('description',256)->nullable();
|
|
|
+ $table->integer('color')->default(0xa1a1a1);
|
|
|
+ $table->uuid('owner_id')->index();
|
|
|
+ $table->timestamp('created_at')->useCurrent()->index();
|
|
|
+ $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Reverse the migrations.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function down()
|
|
|
+ {
|
|
|
+ Schema::dropIfExists('tags');
|
|
|
+ DB::statement('DROP EXTENSION IF EXISTS "uuid-ossp";');
|
|
|
+ }
|
|
|
+}
|