Completed
Push — master ( cb5fa1...8201f5 )
by Vojta
06:45
created

CreateReservationsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 47
ccs 24
cts 24
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 35 1
A down() 0 8 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 14
    public function up()
10
    {
11
        Schema::create('vojtasvoboda_reservations_reservations', function(Blueprint $table)
12
        {
13 14
            $table->engine = 'InnoDB';
14 14
            $table->increments('id');
15
16 14
            $table->integer('status_id')->unsigned()->nullable();
17 14
            $table->foreign('status_id')->references('id')->on('vojtasvoboda_reservations_statuses');
18
19 14
            $table->datetime('date')->nullable();
20
21 14
            $table->char('number', 6);
22 14
            $table->char('hash', 32);
23 14
            $table->string('locale', 20)->nullable();
24
25 14
            $table->string('email', 300)->nullable();
26 14
            $table->string('name', 300)->nullable();
27 14
            $table->string('lastname', 300)->nullable();
28
29 14
            $table->string('street', 300)->nullable();
30 14
            $table->string('town', 300)->nullable();
31 14
            $table->string('zip', 300)->nullable();
32 14
            $table->string('phone', 300)->nullable();
33
34 14
            $table->text('message')->nullable();
35
36 14
            $table->string('ip', 300)->nullable();
37 14
            $table->string('ip_forwarded', 300)->nullable();
38 14
            $table->string('user_agent', 300)->nullable();
39
40 14
            $table->timestamps();
41 14
            $table->softDeletes();
42 14
        });
43 14
    }
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