Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Commit 390239a

Browse files
committed
👽 updated migrations structure
1 parent 8c9bee1 commit 390239a

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

App/Database/Migrations/2019_11_18_133625_create_users.php

100644100755
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Leaf\Database;
66
use Illuminate\Database\Schema\Blueprint;
7+
use Leaf\Schema;
78

89
class CreateUsers extends Database {
910
/**
@@ -12,26 +13,29 @@ class CreateUsers extends Database {
1213
* @return void
1314
*/
1415
public function up() {
15-
if(!$this->capsule::schema()->hasTable("users")):
16-
$this->capsule::schema()->create("users", function (Blueprint $table) {
17-
$table->increments('id');
18-
$table->string('username');
19-
$table->string('name')->nullable();
20-
$table->string('email')->unique();
21-
$table->timestamp('email_verified_at')->nullable();
22-
$table->string('password');
23-
$table->rememberToken();
24-
$table->timestamps();
25-
});
26-
endif;
16+
// if (!static::$capsule::schema()->hasTable("users")):
17+
// static::$capsule::schema()->create("users", function (Blueprint $table) {
18+
// $table->increments('id');
19+
// $table->string('username');
20+
// $table->string('name');
21+
// $table->string('email')->unique();
22+
// $table->timestamp('email_verified_at')->nullable();
23+
// $table->string('password');
24+
// $table->rememberToken();
25+
// $table->timestamps();
26+
// });
27+
// endif;
28+
29+
// you can now build your migrations with schemas
30+
Schema::build(static::$capsule, dirname(__DIR__) . "/Schema/users.json");
2731
}
28-
32+
2933
/**
3034
* Reverse the migrations.
3135
*
3236
* @return void
3337
*/
3438
public function down() {
35-
$this->capsule::schema()->dropIfExists("users");
39+
static::$capsule::schema()->dropIfExists("users");
3640
}
3741
}

App/Database/Migrations/2019_11_18_155705_create_password_resets.php

100644100755
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ class CreatePasswordResets extends Database {
1111
* @return void
1212
*/
1313
public function up() {
14-
if(!$this->capsule::schema()->hasTable("password_resets")):
15-
$this->capsule::schema()->create("password_resets", function ($table) {
14+
if(!static::$capsule::schema()->hasTable("password_resets")):
15+
static::$capsule::schema()->create("password_resets", function ($table) {
1616
$table->string('email')->index();
1717
$table->string('token');
1818
$table->timestamp('created_at')->nullable();
1919
});
2020
endif;
2121
}
22-
22+
2323
/**
2424
* Reverse the migrations.
2525
*
2626
* @return void
2727
*/
2828
public function down() {
29-
$this->capsule::schema()->dropIfExists("password_resets");
29+
static::$capsule::schema()->dropIfExists("password_resets");
3030
}
3131
}

0 commit comments

Comments
 (0)