68 lines
2.2 KiB
PHP
68 lines
2.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CleanupSite extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::table('sites', function (Blueprint $table) {
|
|
$table->dropColumn(['date_orig']);
|
|
});
|
|
|
|
DB::statement('ALTER TABLE ab_country RENAME TO countries');
|
|
DB::statement('ALTER TABLE countries MODIFY id int(11) NOT NULL;');
|
|
DB::statement('ALTER TABLE countries MODIFY name varchar(128) NOT NULL;');
|
|
DB::statement('ALTER TABLE countries MODIFY notes text DEFAULT NULL;');
|
|
|
|
DB::statement('ALTER TABLE ab_currency RENAME TO currencies');
|
|
DB::statement('ALTER TABLE currencies MODIFY id int(11) NOT NULL;');
|
|
DB::statement('ALTER TABLE currencies MODIFY name varchar(128) NOT NULL;');
|
|
DB::statement('ALTER TABLE currencies MODIFY notes text DEFAULT NULL;');
|
|
DB::statement('ALTER TABLE currencies RENAME COLUMN convert_array TO rates;');
|
|
|
|
DB::statement('ALTER TABLE ab_language RENAME TO languages');
|
|
|
|
Schema::table('countries', function (Blueprint $table) {
|
|
$table->dropColumn(['description']);
|
|
|
|
$table->foreign(['currency_id'])->references(['id'])->on('currencies');
|
|
});
|
|
|
|
Schema::table('currencies', function (Blueprint $table) {
|
|
$table->dropForeign('fk_cur_cty');
|
|
$table->dropIndex('fk_cur_cty_idx');
|
|
$table->dropColumn(['country_id']);
|
|
});
|
|
|
|
DB::statement('ALTER TABLE ab_tax RENAME TO taxes');
|
|
DB::statement('ALTER TABLE taxes MODIFY description text DEFAULT NULL;');
|
|
DB::statement('ALTER TABLE taxes MODIFY id int(11) NOT NULL;');
|
|
DB::statement('ALTER TABLE taxes MODIFY country_id int(11) NOT NULL;');
|
|
Schema::table('taxes', function (Blueprint $table) {
|
|
$table->dropColumn(['date_orig','date_last','tax_id_collect','tax_id_name','tax_id_req','tax_id_exempt','tax_id_regex']);
|
|
$table->dropIndex('fk_tax_cty_idx');
|
|
$table->dropForeign('fk_tax_cty');
|
|
|
|
$table->foreign(['country_id'])->references(['id'])->on('countries');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
abort(500,'Cant go back');
|
|
}
|
|
}
|