| @@ 4-30 (lines=27) @@ | ||
| 1 | <?php |
|
| 2 | use Illuminate\Database\Capsule\Manager as Capsule; |
|
| 3 | ||
| 4 | class CreateLogsTable |
|
| 5 | { |
|
| 6 | /** |
|
| 7 | * Do the migration |
|
| 8 | */ |
|
| 9 | public function up() |
|
| 10 | { |
|
| 11 | Capsule::schema()->create('logs', function($table) |
|
| 12 | { |
|
| 13 | $table->increments('id'); |
|
| 14 | $table->string('action'); |
|
| 15 | $table->morphs('entity'); |
|
| 16 | $table->text('state')->nullable(); |
|
| 17 | $table->timestamp('created_at'); |
|
| 18 | $table->integer('created_by'); |
|
| 19 | }); |
|
| 20 | ||
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Undo the migration |
|
| 25 | */ |
|
| 26 | public function down() |
|
| 27 | { |
|
| 28 | Capsule::schema()->drop('logs'); |
|
| 29 | } |
|
| 30 | } |
|
| 31 | ||
| @@ 4-27 (lines=24) @@ | ||
| 1 | <?php |
|
| 2 | use Illuminate\Database\Capsule\Manager as Capsule; |
|
| 3 | ||
| 4 | class CreateAccessTokensTable{ |
|
| 5 | /** |
|
| 6 | * Do the migration |
|
| 7 | */ |
|
| 8 | public function up() |
|
| 9 | { |
|
| 10 | Capsule::schema()->create('access_tokens', function($table) |
|
| 11 | { |
|
| 12 | $table->increments('id'); |
|
| 13 | $table->integer('user_id')->unsigned()->index(); |
|
| 14 | $table->string('access_token')->unique()->nullable(); |
|
| 15 | $table->timestamp('created_at'); |
|
| 16 | }); |
|
| 17 | ||
| 18 | } |
|
| 19 | ||
| 20 | /** |
|
| 21 | * Undo the migration |
|
| 22 | */ |
|
| 23 | public function down() |
|
| 24 | { |
|
| 25 | Capsule::schema()->drop('access_tokens'); |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||
| @@ 4-27 (lines=24) @@ | ||
| 1 | <?php |
|
| 2 | use Illuminate\Database\Capsule\Manager as Capsule; |
|
| 3 | ||
| 4 | class CreateRefreshTokensTable{ |
|
| 5 | /** |
|
| 6 | * Do the migration |
|
| 7 | */ |
|
| 8 | public function up() |
|
| 9 | { |
|
| 10 | Capsule::schema()->create('refresh_tokens', function($table) |
|
| 11 | { |
|
| 12 | $table->increments('id'); |
|
| 13 | $table->integer('user_id')->unsigned()->index(); |
|
| 14 | $table->string('refresh_token')->unique()->nullable(); |
|
| 15 | $table->timestamp('created_at'); |
|
| 16 | }); |
|
| 17 | ||
| 18 | } |
|
| 19 | ||
| 20 | /** |
|
| 21 | * Undo the migration |
|
| 22 | */ |
|
| 23 | public function down() |
|
| 24 | { |
|
| 25 | Capsule::schema()->drop('refresh_tokens'); |
|
| 26 | } |
|
| 27 | } |
|
| 28 | ||