diff options
Diffstat (limited to 'src/migrations')
9 files changed, 291 insertions, 0 deletions
diff --git a/src/migrations/.gitkeep b/src/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/migrations/.gitkeep diff --git a/src/migrations/2015_02_23_184402_botleaguesapi-create_users.php b/src/migrations/2015_02_23_184402_botleaguesapi-create_users.php new file mode 100644 index 0000000..b054a43 --- /dev/null +++ b/src/migrations/2015_02_23_184402_botleaguesapi-create_users.php @@ -0,0 +1,36 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesapiCreateUsers extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('users', function(Blueprint $table) + { + $table->increments('id')->unsigned(); + $table->string('email', 127)->unique(); + $table->string('password', 60); + $table->rememberToken(); + $table->boolean('isAdministrator')->default(false); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('users'); + } + +} diff --git a/src/migrations/2015_02_23_184407_botleaguesapi-create_games.php b/src/migrations/2015_02_23_184407_botleaguesapi-create_games.php new file mode 100644 index 0000000..3ecc1e2 --- /dev/null +++ b/src/migrations/2015_02_23_184407_botleaguesapi-create_games.php @@ -0,0 +1,33 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesapiCreateGames extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('games', function(Blueprint $table) + { + $table->increments('id')->unsigned(); + $table->string('title')->unique(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('games'); + } + +} diff --git a/src/migrations/2015_02_23_184413_botleaguesapi-create_bots.php b/src/migrations/2015_02_23_184413_botleaguesapi-create_bots.php new file mode 100644 index 0000000..11ab786 --- /dev/null +++ b/src/migrations/2015_02_23_184413_botleaguesapi-create_bots.php @@ -0,0 +1,39 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesapiCreateBots extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('bots', function(Blueprint $table) + { + $table->increments('id')->unsigned(); + $table->integer('userId')->unsigned(); + $table->foreign('userId')->references('id')->on('users'); + $table->integer('gameId')->unsigned(); + $table->foreign('gameId')->references('id')->on('games'); + $table->string('title', 45); + $table->string('version', 12); + $table->unique(array('gameId', 'title', 'version')); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('bots'); + } + +} diff --git a/src/migrations/2015_04_26_192015_botleaguesapi-create_competition_types.php b/src/migrations/2015_04_26_192015_botleaguesapi-create_competition_types.php new file mode 100644 index 0000000..280bb6d --- /dev/null +++ b/src/migrations/2015_04_26_192015_botleaguesapi-create_competition_types.php @@ -0,0 +1,34 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesapiCreateCompetitionTypes extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('competition_types', function(Blueprint $table) + { + $table->increments('type'); + $table->string('description'); + $table->mediumText('explanation'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('competition_types'); + } + +} diff --git a/src/migrations/2015_04_26_192025_botleaguesapi-create_competitions.php b/src/migrations/2015_04_26_192025_botleaguesapi-create_competitions.php new file mode 100644 index 0000000..8652086 --- /dev/null +++ b/src/migrations/2015_04_26_192025_botleaguesapi-create_competitions.php @@ -0,0 +1,41 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesapiCreateCompetitions extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('competitions', function(Blueprint $table) + { + $table->increments('id')->unsigned(); + $table->integer('gameId')->unsigned(); + $table->foreign('gameId')->references('id')->on('games'); + $table->string('title', 127)->unique(); + $table->mediumText('description')->nullable(); + $table->integer('competition_type')->unsigned(); + $table->foreign('competition_type')->references('type')->on('competition_types'); + $table->dateTime('start'); + $table->dateTime('end'); + $table->mediumInteger('max_players')->unsigned(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('competitions'); + } + +} diff --git a/src/migrations/2015_04_26_192035_botleaguesapi-create_participants.php b/src/migrations/2015_04_26_192035_botleaguesapi-create_participants.php new file mode 100644 index 0000000..9b76316 --- /dev/null +++ b/src/migrations/2015_04_26_192035_botleaguesapi-create_participants.php @@ -0,0 +1,36 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesapiCreateParticipants extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('participants', function(Blueprint $table) + { + $table->increments('id'); + $table->integer('botId')->unsigned(); + $table->foreign('botId')->references('id')->on('bots'); + $table->integer('competitionId')->unsigned(); + $table->foreign('competitionId')->references('id')->on('competitions'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('participants'); + } + +} diff --git a/src/migrations/2015_05_10_134654_botleaguesapi-create_user_tokens.php b/src/migrations/2015_05_10_134654_botleaguesapi-create_user_tokens.php new file mode 100644 index 0000000..3d8c82e --- /dev/null +++ b/src/migrations/2015_05_10_134654_botleaguesapi-create_user_tokens.php @@ -0,0 +1,36 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesapiCreateUserTokens extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('user_tokens', function(Blueprint $table) + { + $table->increments('id'); + $table->integer('userId')->unsigned(); + $table->foreign('userId')->references('id')->on('users'); + $table->string('token'); + $table->timestamp('valid_till'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('user_tokens'); + } + +} diff --git a/src/migrations/2015_05_13_105945_botleaguesapi-create_password_reminders.php b/src/migrations/2015_05_13_105945_botleaguesapi-create_password_reminders.php new file mode 100644 index 0000000..a2473fb --- /dev/null +++ b/src/migrations/2015_05_13_105945_botleaguesapi-create_password_reminders.php @@ -0,0 +1,36 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class BotleaguesApiCreatePasswordReminders extends Migration { + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('password_reminders', function(Blueprint $table) + { + $table->integer('userId')->unsigned(); + $table->foreign('userId')->references('id')->on('users'); + $table->string('token')->index(); + $table->timestamp('created_at'); + $table->timestamp('valid_till'); + $table->timestamp('used_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('password_reminders'); + } + +} |