mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
First basic code for currency exchange rate routines.
This commit is contained in:
51
database/migrations/2017_04_13_163623_changes_for_v440.php
Normal file
51
database/migrations/2017_04_13_163623_changes_for_v440.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Class ChangesForV440
|
||||
*/
|
||||
class ChangesForV440 extends Migration
|
||||
{
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if (Schema::hasTable('currency_exchange_rates')) {
|
||||
Schema::drop('currency_exchange_rates');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (!Schema::hasTable('currency_exchange_rates')) {
|
||||
Schema::create(
|
||||
'currency_exchange_rates', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->integer('user_id', false, true);
|
||||
$table->integer('from_currency_id', false, true);
|
||||
$table->integer('to_currency_id', false, true);
|
||||
$table->date('date');
|
||||
$table->decimal('rate', 22, 12);
|
||||
$table->decimal('user_rate', 22, 12)->nullable();
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('from_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||
$table->foreign('to_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user