فهرست منبع

:card_file_box: create tag map table

visuddhinanda@gmail.com 3 سال پیش
والد
کامیت
f5ae77b0fe
1فایلهای تغییر یافته به همراه38 افزوده شده و 0 حذف شده
  1. 38 0
      database/migrations/2022_05_22_143716_create_tag_maps_table.php

+ 38 - 0
database/migrations/2022_05_22_143716_create_tag_maps_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateTagMapsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('tag_maps', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('table_name','128');
+            $table->uuid('anchor_id')->index();
+            $table->uuid('tag_id')->index();
+            $table->timestamp('created_at')->useCurrent()->index();
+			$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate()->index();
+
+            $table->unique(['table_name','table_id','tag_id']);
+
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('tag_maps');
+    }
+}