Total Complexity | 3 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class CreateQuickBooksTokensTable extends Migration |
||
9 | { |
||
10 | /** |
||
11 | * Run the migrations. |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | public function up() |
||
16 | { |
||
17 | Schema::create('quickbooks_tokens', function (Blueprint $table) { |
||
18 | $user_id_type = DB::getSchemaBuilder() |
||
19 | ->getColumnType('users', 'id') === 'bigint' ? 'unsignedBigInteger' : 'unsignedInteger'; |
||
20 | |||
21 | $table->bigIncrements('id'); |
||
22 | $table->{$user_id_type}('user_id'); |
||
23 | $table->unsignedBigInteger('realm_id'); |
||
24 | $table->longtext('access_token'); |
||
25 | $table->datetime('access_token_expires_at'); |
||
26 | $table->string('refresh_token'); |
||
27 | $table->datetime('refresh_token_expires_at'); |
||
28 | |||
29 | $table->timestamps(); |
||
30 | |||
31 | $table->foreign('user_id') |
||
32 | ->references('id') |
||
33 | ->on('users') |
||
34 | ->onDelete('cascade'); |
||
35 | }); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Reverse the migrations. |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | public function down() |
||
46 | } |
||
47 | } |
||
48 |