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