<?php

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

class DropLakeUriFromAllTables extends Migration
{

    private $tables = [
        'artwork_date_qualifiers',
        'artwork_dates',
    ];

    public function up()
    {
        foreach ($this->tables as $tableName) {
            Schema::table($tableName, function (Blueprint $table) use ($tableName) {
                if (Schema::hasColumn($tableName, 'lake_uri')) {
                    $table->dropColumn('lake_uri');
                }
            });
        }
    }


    public function down()
    {
        $this->up();

        foreach ($this->tables as $tableName) {
            Schema::table($tableName, function (Blueprint $table) use ($tableName) {
                // This should be a text...
                $table->string('lake_uri')->unique()->nullable()->after('title');
            });
        }
    }
}

Drop `lake_uri` from all tables
Drop `lake_uri` from all tables

We shouldn't be storing this in the database, since it can be generated
using `lake_guid`. In either case, these two resources are no longer
being retrieved from the LAKE API, but rather, from CITI's API, so
these fields will become stale very soon.
