osb/database/migrations/2018_05_14_122513_currency_add_rounding.php

36 lines
723 B
PHP
Raw Normal View History

2017-11-03 05:26:07 +00:00
<?php
use Illuminate\Support\Facades\Schema;
2017-11-03 05:26:07 +00:00
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
2018-05-20 12:53:14 +00:00
use App\Models\Currency;
class CurrencyAddRounding extends Migration
2017-11-03 05:26:07 +00:00
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
2018-05-20 12:53:14 +00:00
Schema::table('ab_currency', function (Blueprint $table) {
$table->smallInteger('rounding');
2017-11-03 05:26:07 +00:00
});
2018-05-20 12:53:14 +00:00
Currency::query()->update(['rounding'=>2]);
2017-11-03 05:26:07 +00:00
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
2018-05-20 12:53:14 +00:00
Schema::table('ab_currency', function (Blueprint $table) {
$table->dropColumn('rounding');
});
2017-11-03 05:26:07 +00:00
}
2018-05-20 12:53:14 +00:00
}