Migration add column for rating

mail@pastecode.io avatar
unknown
php
2 years ago
834 B
2
Indexable
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddOriginColumnToRatingTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('CAT_RATING', function (Blueprint $table) {
          $table->string('origin', 10)->after('rating_periode')->default('browser');
          $table->index('origin', 'CAT_RATING_period');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('CAT_RATING', function (Blueprint $table) {
          $table->dropIndex('CAT_RATING_period');
          $table->dropColumn('origin');
        });
    }
}