Skip to content

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Litalino committed Dec 12, 2023
1 parent 586c595 commit a1cba43
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
27 changes: 24 additions & 3 deletions migrations/2021_06_29_000000_tags_is_article_series_column.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
<?php

return Flarum\Database\Migration::addColumns('tags', [
'is_article_series' => ['boolean', 'default' => false],
]);

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
use Illuminate\Support\Facades\Schema;

return [
'up' => function (Builder $schema) {
if ($schema->hasTable('tags')) {
if (Schema::hasColumn('tags', 'is_article_series')) {
return;
}
return Flarum\Database\Migration::addColumns('tags', [
'is_article_series' => ['boolean', 'default' => false],
]);
}
},
'down' => function (Builder $schema) {

},
];

//return Flarum\Database\Migration::addColumns('tags', [
// 'is_article_series' => ['boolean', 'default' => false],
//]);
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
use Illuminate\Support\Facades\Schema;


return [
'up' => function (Builder $schema) {
if ($schema->hasTable('discussions')) {
if (Schema::hasColumn('discussions', 'article_series_id')) {
return;
}

if (Schema::hasColumn('discussions', 'article_series_order')) {
return;
}
}
$schema->table('discussions', function (Blueprint $table) {
$table->integer('article_series_id')->nullable()->unsigned();
$table->integer('article_series_order')->nullable();
$table->integer('article_series_id')->nullable()->unsigned();
$table->integer('article_series_order')->nullable();

$table->foreign('article_series_id')->references('id')->on('tags')->onDelete('set null');
});
$table->foreign('article_series_id')->references('id')->on('tags')->onDelete('set null');
});
},
'down' => function (Builder $schema) {
$schema->table('discussions', function (Blueprint $table) {
Expand Down

0 comments on commit a1cba43

Please sign in to comment.