Completed
Push — master ( 999cf5...86490b )
by Victor Hugo
12s queued 10s
created

CreateCurrenciesTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

2 Methods

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