visuddhinanda 1 tahun lalu
induk
melakukan
fc0b026012

+ 34 - 0
database/migrations/2024_07_23_032240_add_type2_in_channels.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddType2InChannels extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->string('type2')->default('translation');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->dropColumn('type2');
+        });
+    }
+}

+ 37 - 0
database/migrations/2024_07_23_033220_migrate_type_in_channels.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class MigrateTypeInChannels extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+        });
+
+        DB::transaction(function () {
+            $sql = 'UPDATE channels SET type2 = type;';
+            DB::select($sql);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 36 - 0
database/migrations/2024_07_23_033823_change_type2_to_type_in_channels.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeType2ToTypeInChannels extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->renameColumn('type', 'type_old');
+            $table->renameColumn('type2', 'type');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('channels', function (Blueprint $table) {
+            //
+            $table->renameColumn('type', 'type2');
+            $table->renameColumn('type_old','type');
+        });
+    }
+}