<?php

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

class SeedValueStoresTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        \App\ValueStore::create([
            'name' => 'order_last_created_sync_at',
            'value' => null,
        ]);
        \App\ValueStore::create([
            'name' => 'order_last_updated_sync_at',
            'value' => null,
        ]);

        \App\ValueStore::create([
            'name' => 'commodity_last_created_sync_at',
            'value' => null,
        ]);
        \App\ValueStore::create([
            'name' => 'commodity_last_updated_sync_at',
            'value' => null,
        ]);

        \App\ValueStore::create([
            'name' => 'asn_last_created_sync_at',
            'value' => null,
        ]);
        \App\ValueStore::create([
            'name' => 'asn_last_updated_sync_at',
            'value' => null,
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        ValueStore::query()->whereIn(
            'name', ['order_last_created_sync_at',
            'order_last_updated_sync_at',
            'commodity_last_created_sync_at',
            'commodity_last_updated_sync_at',
            'asn_last_created_sync_at',
            'asn_last_updated_sync_at',
        ])->delete();
    }
}
