CreateReservationsTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 35
ccs 24
cts 24
cp 1
rs 9.36
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php namespace VojtaSvoboda\Reservations\Updates;
2
3
use Schema;
4
use October\Rain\Database\Schema\Blueprint;
5
use October\Rain\Database\Updates\Migration;
6
7
class CreateReservationsTable extends Migration
8
{
9 27
    public function up()
10
    {
11
        Schema::create('vojtasvoboda_reservations_reservations', function(Blueprint $table)
12
        {
13 27
            $table->engine = 'InnoDB';
14 27
            $table->increments('id');
15
16 27
            $table->integer('status_id')->unsigned()->nullable();
17 27
            $table->foreign('status_id')->references('id')->on('vojtasvoboda_reservations_statuses');
18
19 27
            $table->datetime('date')->nullable();
20
21 27
            $table->char('number', 6);
22 27
            $table->char('hash', 32);
23 27
            $table->string('locale', 20)->nullable();
24
25 27
            $table->string('email', 300)->nullable();
26 27
            $table->string('name', 300)->nullable();
27 27
            $table->string('lastname', 300)->nullable();
28
29 27
            $table->string('street', 300)->nullable();
30 27
            $table->string('town', 300)->nullable();
31 27
            $table->string('zip', 300)->nullable();
32 27
            $table->string('phone', 300)->nullable();
33
34 27
            $table->text('message')->nullable();
35
36 27
            $table->string('ip', 300)->nullable();
37 27
            $table->string('ip_forwarded', 300)->nullable();
38 27
            $table->string('user_agent', 300)->nullable();
39
40 27
            $table->timestamps();
41 27
            $table->softDeletes();
42 27
        });
43 27
    }
44
45
    public function down()
46
    {
47
        Schema::table('vojtasvoboda_reservations_reservations', function($table)
48
        {
49
            $table->dropForeign('vojtasvoboda_reservations_reservations_status_id_foreign');
50
        });
51
        Schema::dropIfExists('vojtasvoboda_reservations_reservations');
52
    }
53
}
54