#86: Generated migrations from MySQL DB

This commit is contained in:
Josef Citrine 2016-06-27 00:11:45 +01:00
parent dd404d2a22
commit 37059992eb
101 changed files with 2370 additions and 187 deletions

View file

@ -26,7 +26,9 @@
"mockery/mockery": "0.9.*", "mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.1", "phpunit/phpunit": "~4.1",
"phpspec/phpspec": "~2.1", "phpspec/phpspec": "~2.1",
"filp/whoops": "^2.1" "filp/whoops": "^2.1",
"xethron/migrations-generator": "dev-l5",
"way/generators": "dev-feature/laravel-five-stable"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [
@ -64,5 +66,11 @@
}, },
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist"
},
"repositories": {
"repo-name": {
"type": "git",
"url": "git@github.com:jamisonvalenta/Laravel-4-Generators.git"
}
} }
} }

665
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -151,6 +151,8 @@ return [
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class, Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
Cviebrock\LaravelElasticsearch\ServiceProvider::class, Cviebrock\LaravelElasticsearch\ServiceProvider::class,
GrahamCampbell\Exceptions\ExceptionsServiceProvider::class, GrahamCampbell\Exceptions\ExceptionsServiceProvider::class,
Way\Generators\GeneratorsServiceProvider::class,
Xethron\MigrationsGenerator\MigrationsGeneratorServiceProvider::class,
], ],

View file

@ -26,6 +26,7 @@ return [
| |
*/ */
//'mysql' => env('DB_CONNECTION', 'mysql'),
'default' => env('DB_CONNECTION', 'pgsql'), 'default' => env('DB_CONNECTION', 'pgsql'),
/* /*

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateActivitiesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('activities', function(Blueprint $table)
{
$table->bigInteger('id', true)->unsigned();
$table->dateTime('created_at')->index();
$table->integer('user_id')->unsigned();
$table->boolean('activity_type');
$table->boolean('resource_type');
$table->integer('resource_id')->unsigned();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('activities');
}
}

View file

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlbumsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('albums', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index('albums_user_id_foreign');
$table->string('title')->index();
$table->string('slug')->index();
$table->text('description', 65535);
$table->integer('cover_id')->unsigned()->nullable()->index('albums_cover_id_foreign');
$table->integer('track_count')->unsigned();
$table->integer('view_count')->unsigned()->default(0);
$table->integer('download_count')->unsigned()->default(0);
$table->integer('favourite_count')->unsigned()->default(0);
$table->integer('comment_count')->unsigned()->default(0);
$table->timestamps();
$table->softDeletes()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('albums');
}
}

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCacheTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cache', function(Blueprint $table)
{
$table->string('key')->index();
$table->text('value', 65535);
$table->integer('expiration')->unsigned()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('cache');
}
}

View file

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCommentsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comments', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index('comments_user_id_foreign');
$table->string('ip_address', 46);
$table->text('content', 65535);
$table->timestamps();
$table->softDeletes()->index();
$table->integer('profile_id')->unsigned()->nullable()->index();
$table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('comments');
}
}

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFailedJobsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function(Blueprint $table)
{
$table->increments('id');
$table->text('connection', 65535);
$table->text('queue', 65535);
$table->text('payload');
$table->dateTime('failed_at')->default('now()');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('failed_jobs');
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFavouritesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('favourites', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index();
$table->dateTime('created_at')->default('now()');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('favourites');
}
}

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFollowersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('followers', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('artist_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index();
$table->dateTime('created_at')->default('now()');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('followers');
}
}

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateGenresTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('genres', function(Blueprint $table)
{
$table->increments('id');
$table->string('name')->unique();
$table->string('slug', 200)->index();
$table->softDeletes()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('genres');
}
}

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateImagesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('images', function(Blueprint $table)
{
$table->increments('id');
$table->string('filename', 256);
$table->string('mime', 100);
$table->string('extension', 32);
$table->integer('size');
$table->string('hash', 32)->index();
$table->integer('uploaded_by')->unsigned()->index('images_uploaded_by_foreign');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('images');
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLicensesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('licenses', function(Blueprint $table)
{
$table->increments('id');
$table->string('title', 100);
$table->text('description', 65535);
$table->boolean('affiliate_distribution');
$table->boolean('open_distribution');
$table->boolean('remix');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('licenses');
}
}

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMlpmaTracksTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('mlpma_tracks', function(Blueprint $table)
{
$table->increments('id');
$table->integer('track_id')->unsigned()->index();
$table->string('path')->index();
$table->string('filename')->index();
$table->string('extension')->index();
$table->dateTime('imported_at');
$table->text('parsed_tags');
$table->text('raw_tags');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('mlpma_tracks');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNewsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('news', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->string('post_hash', 32)->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('news');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNotificationsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function(Blueprint $table)
{
$table->bigInteger('id', true)->unsigned();
$table->bigInteger('activity_id')->unsigned()->index();
$table->integer('user_id')->unsigned()->index();
$table->boolean('is_read')->default(0)->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notifications');
}
}

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateOauth2TokensTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth2_tokens', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id');
$table->integer('external_user_id');
$table->text('access_token', 65535);
$table->dateTime('expires')->default('now()');
$table->text('refresh_token', 65535);
$table->string('type');
$table->string('service');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('oauth2_tokens');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePinnedPlaylistsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pinned_playlists', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('playlist_id')->unsigned()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('pinned_playlists');
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePlaylistTrackTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('playlist_track', function(Blueprint $table)
{
$table->increments('id');
$table->timestamps();
$table->integer('playlist_id')->unsigned()->index();
$table->integer('track_id')->unsigned()->index();
$table->integer('position')->unsigned();
$table->unique(['playlist_id','track_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('playlist_track');
}
}

View file

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePlaylistsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('playlists', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->string('title')->index();
$table->string('slug');
$table->text('description', 65535);
$table->boolean('is_public')->index();
$table->integer('track_count')->unsigned()->index();
$table->integer('view_count')->unsigned();
$table->integer('download_count')->unsigned();
$table->integer('favourite_count')->unsigned();
$table->integer('follow_count')->unsigned();
$table->integer('comment_count')->unsigned();
$table->timestamps();
$table->date('deleted_at')->nullable()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('playlists');
}
}

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateResourceLogItemsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('resource_log_items', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->nullable()->index();
$table->integer('log_type')->unsigned();
$table->string('ip_address', 46)->index();
$table->integer('track_format_id')->unsigned()->nullable();
$table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index();
$table->dateTime('created_at')->default('now()');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('resource_log_items');
}
}

View file

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateResourceUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('resource_users', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index();
$table->integer('artist_id')->unsigned()->nullable()->index();
$table->boolean('is_followed');
$table->boolean('is_favourited');
$table->boolean('is_pinned');
$table->integer('view_count');
$table->integer('play_count');
$table->integer('download_count');
$table->unique(['user_id','track_id','album_id','playlist_id','artist_id'], 'resource_unique');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('resource_users');
}
}

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRevisionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('revisions', function(Blueprint $table)
{
$table->increments('id');
$table->string('revisionable_type');
$table->integer('revisionable_id');
$table->integer('user_id')->nullable();
$table->string('key');
$table->text('old_value', 65535)->nullable();
$table->text('new_value', 65535)->nullable();
$table->timestamps();
$table->index(['revisionable_id','revisionable_type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('revisions');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRoleUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('role_user', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('role_id')->unsigned()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('role_user');
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRolesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('roles', function(Blueprint $table)
{
$table->increments('id');
$table->string('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('roles');
}
}

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSessionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function(Blueprint $table)
{
$table->string('id')->unique();
$table->text('payload', 65535);
$table->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sessions');
}
}

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateShowSongTrackTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('show_song_track', function(Blueprint $table)
{
$table->increments('id');
$table->integer('track_id')->unsigned()->index('show_song_track_track_id_foreign');
$table->integer('show_song_id')->unsigned()->index('show_song_track_show_song_id_foreign');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('show_song_track');
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateShowSongsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('show_songs', function(Blueprint $table)
{
$table->increments('id');
$table->string('title', 100)->index('show_songs_title_fulltext');
$table->text('lyrics', 65535);
$table->string('slug', 200);
$table->timestamps();
$table->timestamp('deleted_at')->default(DB::raw('CURRENT_TIMESTAMP'));
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('show_songs');
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSubscriptionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscriptions', function(Blueprint $table)
{
$table->bigInteger('id', true)->unsigned();
$table->integer('user_id')->unsigned()->index();
$table->string('endpoint');
$table->string('p256dh');
$table->string('auth');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('subscriptions');
}
}

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTrackFilesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('track_files', function(Blueprint $table)
{
$table->increments('id');
$table->integer('track_id')->unsigned()->index('track_files_track_id_foreign');
$table->boolean('is_master')->default(0)->index();
$table->string('format')->index();
$table->timestamps();
$table->boolean('is_cacheable')->default(0)->index();
$table->boolean('status')->default(0);
$table->dateTime('expires_at')->nullable()->index();
$table->integer('filesize')->unsigned()->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('track_files');
}
}

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTrackTypesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('track_types', function(Blueprint $table)
{
$table->increments('id');
$table->string('title');
$table->string('editor_title');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('track_types');
}
}

View file

@ -0,0 +1,62 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTracksTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tracks', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id')->unsigned()->index('tracks_user_id_foreign');
$table->integer('license_id')->unsigned()->nullable()->index('tracks_license_id_foreign');
$table->integer('genre_id')->unsigned()->nullable()->index();
$table->integer('track_type_id')->unsigned()->nullable()->index('tracks_track_type_id_foreign');
$table->string('title', 100)->index();
$table->string('slug', 200)->index();
$table->text('description', 65535)->nullable();
$table->text('lyrics', 65535)->nullable();
$table->boolean('is_vocal')->default(0);
$table->boolean('is_explicit')->default(0);
$table->integer('cover_id')->unsigned()->nullable()->index('tracks_cover_id_foreign');
$table->boolean('is_downloadable')->default(0);
$table->float('duration')->unsigned();
$table->integer('play_count')->unsigned()->default(0);
$table->integer('view_count')->unsigned()->default(0);
$table->integer('download_count')->unsigned()->default(0);
$table->integer('favourite_count')->unsigned()->default(0);
$table->integer('comment_count')->unsigned()->default(0);
$table->timestamps();
$table->softDeletes()->index();
$table->dateTime('published_at')->nullable()->index();
$table->dateTime('released_at')->nullable();
$table->integer('album_id')->unsigned()->nullable()->index('tracks_album_id_foreign');
$table->integer('track_number')->unsigned()->nullable();
$table->boolean('is_latest')->default(0);
$table->string('hash', 32)->nullable();
$table->boolean('is_listed')->default(1);
$table->string('source', 40)->default('direct_upload');
$table->text('metadata')->nullable();
$table->text('original_tags')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('tracks');
}
}

View file

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->string('display_name')->index();
$table->string('username')->nullable();
$table->boolean('sync_names')->default(1);
$table->string('email', 150)->nullable();
$table->string('gravatar')->nullable();
$table->string('slug')->unique();
$table->boolean('uses_gravatar')->default(1);
$table->boolean('can_see_explicit_content')->default(0);
$table->text('bio', 65535);
$table->integer('track_count')->unsigned()->default(0)->index();
$table->integer('comment_count')->unsigned()->default(0);
$table->timestamps();
$table->integer('avatar_id')->unsigned()->nullable()->index('users_avatar_id_foreign');
$table->string('remember_token', 100)->nullable();
$table->boolean('is_archived')->default(0)->index();
$table->dateTime('disabled_at')->nullable()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToAlbumsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('albums', function(Blueprint $table)
{
$table->foreign('cover_id')->references('id')->on('images')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('albums', function(Blueprint $table)
{
$table->dropForeign('albums_cover_id_foreign');
$table->dropForeign('albums_user_id_foreign');
});
}
}

View file

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToCommentsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('comments', function(Blueprint $table)
{
$table->foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('profile_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('comments', function(Blueprint $table)
{
$table->dropForeign('comments_album_id_foreign');
$table->dropForeign('comments_playlist_id_foreign');
$table->dropForeign('comments_profile_id_foreign');
$table->dropForeign('comments_track_id_foreign');
$table->dropForeign('comments_user_id_foreign');
});
}
}

View file

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToFavouritesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('favourites', function(Blueprint $table)
{
$table->foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('favourites', function(Blueprint $table)
{
$table->dropForeign('favourites_album_id_foreign');
$table->dropForeign('favourites_playlist_id_foreign');
$table->dropForeign('favourites_track_id_foreign');
$table->dropForeign('favourites_user_id_foreign');
});
}
}

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToFollowersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('followers', function(Blueprint $table)
{
$table->foreign('artist_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('followers', function(Blueprint $table)
{
$table->dropForeign('followers_artist_id_foreign');
$table->dropForeign('followers_playlist_id_foreign');
$table->dropForeign('followers_user_id_foreign');
});
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToImagesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('images', function(Blueprint $table)
{
$table->foreign('uploaded_by')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('images', function(Blueprint $table)
{
$table->dropForeign('images_uploaded_by_foreign');
});
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToMlpmaTracksTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('mlpma_tracks', function(Blueprint $table)
{
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('mlpma_tracks', function(Blueprint $table)
{
$table->dropForeign('mlpma_tracks_track_id_foreign');
});
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToNewsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('news', function(Blueprint $table)
{
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('news', function(Blueprint $table)
{
$table->dropForeign('news_user_id_foreign');
});
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToNotificationsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('notifications', function(Blueprint $table)
{
$table->foreign('activity_id')->references('id')->on('activities')->onUpdate('RESTRICT')->onDelete('CASCADE');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('notifications', function(Blueprint $table)
{
$table->dropForeign('notifications_activity_id_foreign');
$table->dropForeign('notifications_user_id_foreign');
});
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToPinnedPlaylistsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('pinned_playlists', function(Blueprint $table)
{
$table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('pinned_playlists', function(Blueprint $table)
{
$table->dropForeign('pinned_playlists_playlist_id_foreign');
$table->dropForeign('pinned_playlists_user_id_foreign');
});
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToPlaylistTrackTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('playlist_track', function(Blueprint $table)
{
$table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('playlist_track', function(Blueprint $table)
{
$table->dropForeign('playlist_track_playlist_id_foreign');
$table->dropForeign('playlist_track_track_id_foreign');
});
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToPlaylistsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('playlists', function(Blueprint $table)
{
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('playlists', function(Blueprint $table)
{
$table->dropForeign('playlists_user_id_foreign');
});
}
}

View file

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToResourceLogItemsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('resource_log_items', function(Blueprint $table)
{
$table->foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('resource_log_items', function(Blueprint $table)
{
$table->dropForeign('resource_log_items_album_id_foreign');
$table->dropForeign('resource_log_items_playlist_id_foreign');
$table->dropForeign('resource_log_items_track_id_foreign');
$table->dropForeign('resource_log_items_user_id_foreign');
});
}
}

View file

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToResourceUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('resource_users', function(Blueprint $table)
{
$table->foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('artist_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('resource_users', function(Blueprint $table)
{
$table->dropForeign('resource_users_album_id_foreign');
$table->dropForeign('resource_users_artist_id_foreign');
$table->dropForeign('resource_users_playlist_id_foreign');
$table->dropForeign('resource_users_track_id_foreign');
$table->dropForeign('resource_users_user_id_foreign');
});
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToRoleUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('role_user', function(Blueprint $table)
{
$table->foreign('role_id')->references('id')->on('roles')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('role_user', function(Blueprint $table)
{
$table->dropForeign('role_user_role_id_foreign');
$table->dropForeign('role_user_user_id_foreign');
});
}
}

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToShowSongTrackTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('show_song_track', function(Blueprint $table)
{
$table->foreign('show_song_id')->references('id')->on('show_songs')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('show_song_track', function(Blueprint $table)
{
$table->dropForeign('show_song_track_show_song_id_foreign');
$table->dropForeign('show_song_track_track_id_foreign');
});
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToSubscriptionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('subscriptions', function(Blueprint $table)
{
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('subscriptions', function(Blueprint $table)
{
$table->dropForeign('subscriptions_user_id_foreign');
});
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToTrackFilesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('track_files', function(Blueprint $table)
{
$table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('track_files', function(Blueprint $table)
{
$table->dropForeign('track_files_track_id_foreign');
});
}
}

View file

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class AddForeignKeysToTracksTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tracks', function(Blueprint $table)
{
$table->foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('cover_id')->references('id')->on('images')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('genre_id')->references('id')->on('genres')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('license_id')->references('id')->on('licenses')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('track_type_id')->references('id')->on('track_types')->onUpdate('RESTRICT')->onDelete('RESTRICT');
$table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tracks', function(Blueprint $table)
{
$table->dropForeign('tracks_album_id_foreign');
$table->dropForeign('tracks_cover_id_foreign');
$table->dropForeign('tracks_genre_id_foreign');
$table->dropForeign('tracks_license_id_foreign');
$table->dropForeign('tracks_track_type_id_foreign');
$table->dropForeign('tracks_user_id_foreign');
});
}
}

Some files were not shown because too many files have changed in this diff Show more