102 lines
3 KiB
PHP
102 lines
3 KiB
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
|
||
|
class Initial extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
|
Schema::create('authors', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->string('name');
|
||
|
$table->string('url');
|
||
|
$table->boolean('is_company');
|
||
|
$table->boolean('is_person');
|
||
|
$table->text('description');
|
||
|
});
|
||
|
Schema::create('platforms', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->string('title')->unique();
|
||
|
});
|
||
|
Schema::create('languages', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->string('code')->unique();
|
||
|
$table->string('title_en')->unique();
|
||
|
$table->string('title_ru')->unique();
|
||
|
});
|
||
|
Schema::create('tags', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->string('title');
|
||
|
$table->unsignedInteger('language_id')->nullable();
|
||
|
});
|
||
|
Schema::create('games', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->string('url');
|
||
|
$table->string('url_play_online')->nullable();
|
||
|
$table->string('url_download')->nullable();
|
||
|
$table->string('url_discussion')->nullable();
|
||
|
$table->string('url_download_description')->nullable();
|
||
|
$table->string('url_online_description')->nullable();
|
||
|
$table->string('title')->nullable();
|
||
|
$table->text('description')->nullable();
|
||
|
$table->text('short_description')->nullable();
|
||
|
$table->text('version')->nullable();
|
||
|
$table->date('release_date')->nullable();
|
||
|
$table->string('image_url')->nullable();
|
||
|
$table->unsignedInteger('platform_id')->nullable();
|
||
|
|
||
|
$table->foreign('platform_id')->references('id')->on('platforms');
|
||
|
$table->nullableTimestamps();
|
||
|
$table->softDeletes();
|
||
|
});
|
||
|
Schema::create('authors_games', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->unsignedInteger('author_id');
|
||
|
$table->unsignedInteger('game_id');
|
||
|
|
||
|
$table->foreign('author_id')->references('id')->on('authors');
|
||
|
$table->foreign('game_id')->references('id')->on('games');
|
||
|
});
|
||
|
Schema::create('tags_games', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->unsignedInteger('tag_id');
|
||
|
$table->unsignedInteger('game_id');
|
||
|
|
||
|
$table->foreign('tag_id')->references('id')->on('tags');
|
||
|
$table->foreign('game_id')->references('id')->on('games');
|
||
|
});
|
||
|
Schema::create('languages_games', function (Blueprint $table) {
|
||
|
$table->increments('id');
|
||
|
$table->unsignedInteger('language_id');
|
||
|
$table->unsignedInteger('game_id');
|
||
|
|
||
|
$table->foreign('language_id')->references('id')->on('languages');
|
||
|
$table->foreign('game_id')->references('id')->on('games');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
|
Schema::drop('authors_games');
|
||
|
Schema::drop('tags_games');
|
||
|
Schema::drop('languages_games');
|
||
|
Schema::drop('tags');
|
||
|
Schema::drop('games');
|
||
|
Schema::drop('platforms');
|
||
|
Schema::drop('authors');
|
||
|
Schema::drop('languages');
|
||
|
}
|
||
|
}
|