test: fix

This commit is contained in:
Sami Mazouz 2024-10-19 18:05:33 +01:00
parent e3f969588c
commit 17ec1567a4
No known key found for this signature in database
3 changed files with 13 additions and 6 deletions

View File

@ -25,6 +25,9 @@
"flarum-extension": {
"title": "Messages",
"category": "feature",
"optional-dependencies": [
"flarum/tags"
],
"icon": {
"name": "fas fa-envelope-open",
"color": "#ffffff",

View File

@ -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();
if ($schema->hasTable('tags')) {
$table->foreign('mentions_tag_id')->references('id')->on('tags')->cascadeOnDelete();
}
}
);

View File

@ -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);
});
}
},