Skip to content

Commit

Permalink
Add migrations that were missed for some reason
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Apr 28, 2024
1 parent e0f5174 commit ffadd3e
Show file tree
Hide file tree
Showing 18 changed files with 623 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateForumTableCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('forum_categories')) {
Schema::create('forum_categories', function (Blueprint $table) {
$table->increments('id');
$table->integer('parent_category')->unsigned();
$table->string('title');
$table->string('subtitle');
$table->integer('weight');
});
}
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('forum_categories');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateForumTableThreads extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('forum_threads')) {
Schema::create('forum_threads', function (Blueprint $table) {
$table->increments('id');
$table->integer('parent_category')->unsigned();
$table->foreignIdFor(config('forum.integration.user_model'), 'author_id');
$table->string('title');
$table->boolean('pinned');
$table->boolean('locked');

$table->timestamps();
$table->softDeletes();
});
}
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('forum_threads');
}
}
37 changes: 37 additions & 0 deletions database/migrations/2014_05_19_152611_create_forum_table_posts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateForumTablePosts extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('forum_posts')) {
Schema::create('forum_posts', function (Blueprint $table) {
$table->increments('id');
$table->integer('parent_thread')->unsigned();
$table->foreignIdFor(config('forum.integration.user_model'), 'author_id');
$table->text('content');

$table->timestamps();
$table->softDeletes();
});
}
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('forum_posts');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateForumTableThreadsRead extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('forum_threads_read')) {
Schema::create('forum_threads_read', function (Blueprint $table) {
$table->integer('thread_id')->unsigned();
$table->foreignIdFor(config('forum.integration.user_model'), 'user_id');
$table->timestamps();
});
}
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('forum_threads_read');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class UpdateForumTableCategories extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forum_categories', function (Blueprint $table) {
if (!Schema::hasColumn('forum_categories', 'category_id')) {
$table->renameColumn('parent_category', 'category_id');
}
if (!Schema::hasColumn('forum_categories', 'description')) {
$table->renameColumn('subtitle', 'description');
}
});

Schema::table('forum_categories', function (Blueprint $table) {
$table->integer('category_id')->default(0)->change();
$table->string('description')->nullable()->change();
$table->integer('weight')->default(0)->change();

$table->boolean('enable_threads')->default(0);
$table->boolean('private')->default(0);

$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forum_categories', function (Blueprint $table) {
$table->renameColumn('category_id', 'parent_category');
$table->dropColumn(['created_at', 'updated_at', 'enable_threads', 'private']);
$table->renameColumn('description', 'subtitle');
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class UpdateForumTableThreads extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forum_threads', function (Blueprint $table) {
$table->renameColumn('parent_category', 'category_id');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forum_threads', function (Blueprint $table) {
$table->renameColumn('category_id', 'parent_category');
});
}
}
32 changes: 32 additions & 0 deletions database/migrations/2015_07_22_181417_update_forum_table_posts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class UpdateForumTablePosts extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forum_posts', function (Blueprint $table) {
$table->renameColumn('parent_thread', 'thread_id');
$table->integer('post_id')->after('content')->unsigned()->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forum_posts', function (Blueprint $table) {
$table->renameColumn('thread_id', 'parent_thread');
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class AddDefaultsToForumTableThreadsColumns extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forum_threads', function (Blueprint $table) {
$table->boolean('pinned')->nullable()->default(0)->change();
$table->boolean('locked')->nullable()->default(0)->change();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forum_threads', function (Blueprint $table) {
$table->boolean('pinned')->nullable(false)->default(null)->change();
$table->boolean('locked')->nullable(false)->default(null)->change();
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class AddCountsToCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forum_categories', function (Blueprint $table) {
// Add increments to the thread and post counts on the categories table
$table->integer('post_count')->after('enable_threads')->default(0);
$table->integer('thread_count')->after('enable_threads')->default(0);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forum_categories', function (Blueprint $table) {
$table->dropColumn(['thread_count', 'post_count']);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class AddCountsToThreadsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forum_threads', function (Blueprint $table) {
$table->integer('reply_count')->after('locked')->default(0);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forum_threads', function (Blueprint $table) {
$table->dropColumn('reply_count');
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class AddSequenceToPostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forum_posts', function (Blueprint $table) {
$table->integer('sequence')->after('post_id')->unsigned()->default(0);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forum_posts', function (Blueprint $table) {
$table->dropColumn('sequence');
});
}
}
Loading

0 comments on commit ffadd3e

Please sign in to comment.