-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add migration test * rename * fix tests * update test * update test * update test
- Loading branch information
Showing
16 changed files
with
438 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package database | ||
|
||
import ( | ||
"github.com/goravel/framework/contracts/database/schema" | ||
"github.com/goravel/framework/contracts/database/seeder" | ||
|
||
"goravel/database/migrations" | ||
"goravel/database/seeders" | ||
) | ||
|
||
type Kernel struct { | ||
} | ||
|
||
func (kernel Kernel) Migrations() []schema.Migration { | ||
return []schema.Migration{ | ||
&migrations.M20241207095921CreateUsersTable{}, | ||
} | ||
} | ||
|
||
func (kernel Kernel) Seeders() []seeder.Seeder { | ||
return []seeder.Seeder{ | ||
&seeders.DatabaseSeeder{}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package migrations | ||
|
||
import ( | ||
"github.com/goravel/framework/contracts/database/schema" | ||
"github.com/goravel/framework/facades" | ||
) | ||
|
||
type M20241207095921CreateUsersTable struct { | ||
} | ||
|
||
// Signature The unique signature for the migration. | ||
func (r *M20241207095921CreateUsersTable) Signature() string { | ||
return "20241207095921_create_users_table" | ||
} | ||
|
||
// Up Run the migrations. | ||
func (r *M20241207095921CreateUsersTable) Up() error { | ||
if !facades.Schema().HasTable("users") { | ||
return facades.Schema().Create("users", func(table schema.Blueprint) { | ||
table.BigIncrements("id") | ||
table.String("name").Default("") | ||
table.String("avatar").Default("") | ||
table.Timestamps() | ||
table.SoftDeletes() | ||
}) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// Down Reverse the migrations. | ||
func (r *M20241207095921CreateUsersTable) Down() error { | ||
return facades.Schema().DropIfExists("users") | ||
} |
Oops, something went wrong.