Completed
Pull Request — master (#1)
by leo
03:28
created

CreateTicketsTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateTicketsTable extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create('cas_tickets', function (Blueprint $table) {
16
            $table->increments('id');
17
            $table->string('ticket', 32)->unique();
18
            $table->string('service_url', 1024);
19
            $table->integer('service_id')->unsigned();
20
            $table->integer('user_id')->unsigned();
21
            $table->timestamp('created_at')->nullable();
22
            $table->timestamp('expire_at')->nullable();
23
            $table->foreign('service_id')->references('id')->on('cas_services');
24
            $table->foreign('user_id')->references(config('cas.user_table.id'))->on(config('cas.user_table.name'));
25
        });
26
    }
27
28
    /**
29
     * Reverse the migrations.
30
     *
31
     * @return void
32
     */
33
    public function down()
34
    {
35
        Schema::drop('cas_tickets');
36
    }
37
}
38