CreateCurrencyHistoryTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 13
c 1
b 0
f 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 13 1
A down() 0 3 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
/**
8
 * Class CreateCurrenciesTable
9
 *
10
 * @author Victor Avelar <[email protected]>
11
 */
12
class CreateCurrencyHistoryTable extends Migration
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function up()
18
    {
19
        Schema::create('currency_history', function (Blueprint $table) {
20
            $table->increments('id');
21
            $table->string('code', 3)
22
                ->comment('Currency code in ISO 4217 format');
23
            $table->float('rate', 10, 5)
24
                ->comment('the exchange rate');
25
            $table->timestamp('imported_at')
26
                ->useCurrent()
27
                ->comment('Timestamp returned by the API');
28
            $table->timestamps();
29
            $table->softDeletes();
30
        });
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function down()
37
    {
38
        Schema::dropIfExists('currency_history');
39
    }
40
}
41