浏览代码

Add db migration

Daniel Supernault 6 年之前
父节点
当前提交
8934678123
共有 1 个文件被更改,包括 34 次插入0 次删除
  1. 34 0
      database/migrations/2019_02_01_023357_add_remote_to_avatars_table.php

+ 34 - 0
database/migrations/2019_02_01_023357_add_remote_to_avatars_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddRemoteToAvatarsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('avatars', function (Blueprint $table) {
+            $table->string('remote_url')->nullable()->index()->after('thumb_path');
+            $table->timestamp('last_fetched_at')->nullable()->after('change_count');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('avatars', function (Blueprint $table) {
+            $table->dropColumn('remote_url');
+            $table->dropColumn('last_fetched_at');
+        });
+    }
+}