mirror of
https://github.com/flarum/framework.git
synced 2024-11-22 07:45:34 +08:00
test: fix
This commit is contained in:
parent
e3f969588c
commit
17ec1567a4
|
@ -25,6 +25,9 @@
|
|||
"flarum-extension": {
|
||||
"title": "Messages",
|
||||
"category": "feature",
|
||||
"optional-dependencies": [
|
||||
"flarum/tags"
|
||||
],
|
||||
"icon": {
|
||||
"name": "fas fa-envelope-open",
|
||||
"color": "#ffffff",
|
||||
|
|
|
@ -9,16 +9,20 @@
|
|||
|
||||
use Flarum\Database\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return Migration::createTable(
|
||||
'dialog_message_mentions_tag',
|
||||
function (Blueprint $table) {
|
||||
function (Blueprint $table, Builder $schema) {
|
||||
$table->unsignedInteger('dialog_message_id');
|
||||
$table->unsignedInteger('mentions_tag_id');
|
||||
$table->dateTime('created_at')->nullable()->useCurrent();
|
||||
|
||||
$table->primary(['dialog_message_id', 'mentions_tag_id']);
|
||||
$table->foreign('dialog_message_id')->references('id')->on('dialog_messages')->cascadeOnDelete();
|
||||
$table->foreign('mentions_tag_id')->references('id')->on('tags')->cascadeOnDelete();
|
||||
|
||||
if ($schema->hasTable('tags')) {
|
||||
$table->foreign('mentions_tag_id')->references('id')->on('tags')->cascadeOnDelete();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -25,8 +25,8 @@ abstract class Migration
|
|||
{
|
||||
return [
|
||||
'up' => function (Builder $schema) use ($name, $definition) {
|
||||
$schema->create($name, function (Blueprint $table) use ($definition) {
|
||||
$definition($table);
|
||||
$schema->create($name, function (Blueprint $table) use ($definition, $schema) {
|
||||
$definition($table, $schema);
|
||||
});
|
||||
},
|
||||
'down' => function (Builder $schema) use ($name) {
|
||||
|
@ -40,8 +40,8 @@ abstract class Migration
|
|||
return [
|
||||
'up' => function (Builder $schema) use ($name, $definition) {
|
||||
if (! $schema->hasTable($name)) {
|
||||
$schema->create($name, function (Blueprint $table) use ($definition) {
|
||||
$definition($table);
|
||||
$schema->create($name, function (Blueprint $table) use ($definition, $schema) {
|
||||
$definition($table, $schema);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user