Created
December 29, 2014 18:57
-
-
Save 0xMatt/268e87b8860d356f3b2f to your computer and use it in GitHub Desktop.
Project Module's migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class InstallProjectsModule extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('projects', function (Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->integer('parent_id'); | |
$table->string('name', 120); | |
$table->string('slug')->nullable(); | |
$table->text('description'); | |
$table->text('stats'); | |
$table->text('permissions'); | |
$table->integer('lastpost_id'); | |
$table->string('lastpost_title', 120); | |
$table->integer('lastpost_user'); | |
$table->timestamp('lastpost_time'); | |
$table->timestamps(); | |
}); | |
Schema::create('project_milestones', function (Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->integer('project_id'); | |
$table->string('version', 40); | |
$table->string('slug', 50); | |
$table->text('description'); | |
$table->timestamp('due_at'); | |
$table->timestamps(); | |
}); | |
Schema::create('project_issues', function (Blueprint $table) | |
{ | |
// Wow, too many id's | |
$table->increments('id'); | |
$table->integer('project_id'); | |
$table->integer('type_id'); | |
$table->integer('user_id'); | |
$table->integer('status_id'); | |
$table->integer('priority_id'); | |
$table->integer('assigned_to'); | |
$table->integer('found_in'); | |
$table->integer('fixed_in'); | |
$table->string('title', 120); | |
$table->string('slug')->nullable(); | |
$table->text('content'); | |
$table->integer('post_count'); | |
$table->integer('view_count'); | |
$table->integer('lastpost_user'); | |
$table->timestamp('lastpost_time'); | |
$table->tinyInteger('is_locked'); | |
$table->tinyInteger('is_approved'); | |
$table->timestamps(); | |
}); | |
Schema::create('project_posts', function (Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->integer('issue_id'); | |
$table->integer('user_id'); | |
$table->text('content'); | |
$table->tinyInteger('is_approved'); | |
$table->timestamps(); | |
}); | |
Schema::create('project_changes', function (Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->integer('issue_id'); | |
$table->integer('user_id'); | |
$table->text('type'); | |
$table->string('title'); | |
$table->tinyInteger('old'); | |
$table->tinyInteger('new'); | |
$table->timestamps(); | |
}); | |
Schema::create('project_priorities', function (Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->string('name', 120); | |
$table->string('color'); | |
}); | |
Schema::create('project_statuses', function (Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->integer('type_id'); | |
$table->string('name', 120); | |
$table->string('color', 30); | |
$table->integer('order'); | |
$table->boolean('default')->default(0); | |
}); | |
Schema::create('project_types', function (Blueprint $table) | |
{ | |
$table->increments('id'); | |
$table->string('name', 120); | |
$table->string('description'); | |
$table->string('icon'); | |
$table->integer('order'); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::drop('projects'); | |
Schema::drop('project_issues'); | |
Schema::drop('project_posts'); | |
Schema::drop('project_changes'); | |
Schema::drop('project_priorities'); | |
Schema::drop('project_statuses'); | |
Schema::drop('project_types'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment