-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect table migrations on migration generation
à la php artisan (Similar to laravel's artisan)
- Loading branch information
Showing
3 changed files
with
36 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
<?php | ||
|
||
<% if (typeof tableName === 'undefined' || ! tableName) { %> | ||
use Illuminate\Database\Schema\Builder; | ||
|
||
// HINT: you might want to use a `Flarum\Database\Migration` helper method for simplicity! | ||
// See https://docs.flarum.org/extend/data.html#migrations to learn more about migrations. | ||
|
||
return [ | ||
'up' => function (Builder $schema) { | ||
// up migration | ||
}, | ||
'down' => function (Builder $schema) { | ||
// down migration | ||
} | ||
]; | ||
];<% } %><% if (typeof tableName !== 'undefined' && tableName) { %> | ||
use Flarum\Database\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
|
||
return Migration::createTable( | ||
'<%= tableName %>', | ||
function (Blueprint $table) { | ||
$table->increments('id'); | ||
|
||
// created_at & updated_at | ||
$table->timestamps(); | ||
} | ||
); | ||
<% } %> |
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