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

Commit 5ddecdd

Browse files
committed
feat: update default migrations
1 parent e6b10ce commit 5ddecdd

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

app/database/migrations/2019_11_18_133625_create_users.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22

3+
use Leaf\Schema;
34
use Leaf\Database;
45
use Illuminate\Database\Schema\Blueprint;
5-
use Leaf\Schema;
66

77
class CreateUsers extends Database
88
{
99
/**
1010
* Run the migrations.
11-
*
1211
* @return void
1312
*/
1413
public function up()
@@ -26,13 +25,20 @@ public function up()
2625
// });
2726
// endif;
2827

28+
/**
29+
* Leaf Schema allows you to build migrations
30+
* from a JSON representation of your database
31+
*
32+
* Check app/database/schema/users.json for an example
33+
*
34+
* Docs @ https://leafphp.dev/docs/mvc/schema.html
35+
*/
2936
// you can now build your migrations with schemas
3037
Schema::build('users');
3138
}
3239

3340
/**
3441
* Reverse the migrations.
35-
*
3642
* @return void
3743
*/
3844
public function down()
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22

33
use Leaf\Database;
4+
use Illuminate\Database\Schema\Blueprint;
45

56
class CreatePasswordResets extends Database
67
{
78
/**
89
* Run the migrations.
9-
*
1010
* @return void
1111
*/
1212
public function up()
1313
{
14-
if (!static::$capsule::schema()->hasTable("password_resets")):
15-
static::$capsule::schema()->create("password_resets", function ($table) {
14+
if (!static::$capsule::schema()->hasTable('password_resets')) :
15+
static::$capsule::schema()->create('password_resets', function (Blueprint $table) {
1616
$table->string('email')->index();
1717
$table->string('token');
1818
$table->timestamp('created_at')->nullable();
@@ -22,11 +22,10 @@ public function up()
2222

2323
/**
2424
* Reverse the migrations.
25-
*
2625
* @return void
2726
*/
2827
public function down()
2928
{
30-
static::$capsule::schema()->dropIfExists("password_resets");
29+
static::$capsule::schema()->dropIfExists('password_resets');
3130
}
3231
}

0 commit comments

Comments
 (0)