diff --git a/database/migrations/2016_06_26_225535_create_albums_table.php b/database/migrations/2016_06_26_225535_create_albums_table.php index ab591780..1a62ad78 100644 --- a/database/migrations/2016_06_26_225535_create_albums_table.php +++ b/database/migrations/2016_06_26_225535_create_albums_table.php @@ -20,7 +20,7 @@ class CreateAlbumsTable extends Migration { $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('track_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); diff --git a/database/migrations/2016_06_26_225535_create_oauth2_tokens_table.php b/database/migrations/2016_06_26_225535_create_oauth2_tokens_table.php index 917880ea..1e4dc91c 100644 --- a/database/migrations/2016_06_26_225535_create_oauth2_tokens_table.php +++ b/database/migrations/2016_06_26_225535_create_oauth2_tokens_table.php @@ -15,8 +15,8 @@ class CreateOauth2TokensTable extends Migration { Schema::create('oauth2_tokens', function(Blueprint $table) { $table->increments('id'); - $table->integer('user_id'); - $table->integer('external_user_id'); + $table->integer('user_id')->unsigned(); + $table->integer('external_user_id')->unsigned(); $table->text('access_token', 65535); $table->dateTime('expires')->default('now()'); $table->text('refresh_token', 65535); diff --git a/database/migrations/2016_06_26_225535_create_resource_log_items_table.php b/database/migrations/2016_06_26_225535_create_resource_log_items_table.php index b0ab9674..5b905d61 100644 --- a/database/migrations/2016_06_26_225535_create_resource_log_items_table.php +++ b/database/migrations/2016_06_26_225535_create_resource_log_items_table.php @@ -16,9 +16,9 @@ class CreateResourceLogItemsTable extends Migration { { $table->increments('id'); $table->integer('user_id')->unsigned()->nullable()->index(); - $table->integer('log_type')->unsigned(); + $table->tinyInteger('log_type')->unsigned(); $table->string('ip_address', 46)->index(); - $table->integer('track_format_id')->unsigned()->nullable(); + $table->tinyInteger('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(); diff --git a/database/migrations/2016_06_26_225535_create_resource_users_table.php b/database/migrations/2016_06_26_225535_create_resource_users_table.php index e767836e..45328280 100644 --- a/database/migrations/2016_06_26_225535_create_resource_users_table.php +++ b/database/migrations/2016_06_26_225535_create_resource_users_table.php @@ -23,9 +23,9 @@ class CreateResourceUsersTable extends Migration { $table->boolean('is_followed')->default(false); $table->boolean('is_favourited')->default(false); $table->boolean('is_pinned')->default(false); - $table->integer('view_count')->default(0); - $table->integer('play_count')->default(0); - $table->integer('download_count')->default(0); + $table->unsignedInteger('view_count')->default(0); + $table->unsignedInteger('play_count')->default(0); + $table->unsignedInteger('download_count')->default(0); $table->unique(['user_id','track_id','album_id','playlist_id','artist_id'], 'resource_unique'); }); } diff --git a/database/migrations/2016_06_26_225535_create_revisions_table.php b/database/migrations/2016_06_26_225535_create_revisions_table.php index 03ed2746..cf27cfb9 100644 --- a/database/migrations/2016_06_26_225535_create_revisions_table.php +++ b/database/migrations/2016_06_26_225535_create_revisions_table.php @@ -17,7 +17,7 @@ class CreateRevisionsTable extends Migration { $table->increments('id'); $table->string('revisionable_type'); $table->integer('revisionable_id'); - $table->integer('user_id')->nullable(); + $table->unsignedInteger('user_id')->nullable(); $table->string('key'); $table->text('old_value', 65535)->nullable(); $table->text('new_value', 65535)->nullable(); diff --git a/database/migrations/2016_06_26_225535_create_track_files_table.php b/database/migrations/2016_06_26_225535_create_track_files_table.php index fd83477b..7a01b86d 100644 --- a/database/migrations/2016_06_26_225535_create_track_files_table.php +++ b/database/migrations/2016_06_26_225535_create_track_files_table.php @@ -20,7 +20,7 @@ class CreateTrackFilesTable extends Migration { $table->string('format')->index(); $table->timestamps(); $table->boolean('is_cacheable')->default(false)->index(); - $table->boolean('status')->default(false); + $table->unsignedTinyInteger('status')->default(false); $table->dateTime('expires_at')->nullable()->index(); $table->integer('filesize')->unsigned()->nullable(); }); diff --git a/database/migrations/2016_06_26_225535_create_tracks_table.php b/database/migrations/2016_06_26_225535_create_tracks_table.php index 8a208d3e..84691752 100644 --- a/database/migrations/2016_06_26_225535_create_tracks_table.php +++ b/database/migrations/2016_06_26_225535_create_tracks_table.php @@ -23,10 +23,10 @@ class CreateTracksTable extends Migration { $table->string('slug', 200)->index(); $table->text('description', 65535)->nullable(); $table->text('lyrics', 65535)->nullable(); - $table->unsignedTinyInteger('is_vocal')->default(0); - $table->unsignedTinyInteger('is_explicit')->default(0); + $table->boolean('is_vocal')->default(0); + $table->boolean('is_explicit')->default(0); $table->integer('cover_id')->unsigned()->nullable()->index('tracks_cover_id_foreign'); - $table->unsignedTinyInteger('is_downloadable')->default(0); + $table->boolean('is_downloadable')->default(0); $table->float('duration')->unsigned(); $table->integer('play_count')->unsigned()->default(0); $table->integer('view_count')->unsigned()->default(0); @@ -39,12 +39,12 @@ class CreateTracksTable extends Migration { $table->dateTime('released_at')->nullable(); $table->integer('album_id')->unsigned()->nullable()->index('tracks_album_id_foreign'); $table->integer('track_number')->unsigned()->nullable(); - $table->unsignedTinyInteger('is_latest')->default(0); + $table->boolean('is_latest')->default(0); $table->string('hash', 32)->nullable(); - $table->unsignedTinyInteger('is_listed')->default(1); + $table->boolean('is_listed')->default(1); $table->string('source', 40)->default('direct_upload'); - $table->text('metadata')->nullable(); - $table->text('original_tags')->nullable(); + $table->jsonb('metadata')->nullable(); + $table->jsonb('original_tags')->nullable(); }); }