Update namespace to App

This commit is contained in:
Kelvin Zhang 2015-08-31 13:35:47 +01:00
parent 14125fb5c6
commit 39290f8204
37 changed files with 921 additions and 821 deletions

View file

@ -1,5 +1,8 @@
<?php <?php
namespace App;
use Exception;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@ -36,32 +39,32 @@ class Album extends Model
public function user() public function user()
{ {
return $this->belongsTo('User'); return $this->belongsTo('App\User');
} }
public function users() public function users()
{ {
return $this->hasMany('ResourceUser'); return $this->hasMany('App\ResourceUser');
} }
public function favourites() public function favourites()
{ {
return $this->hasMany('Favourite'); return $this->hasMany('App\Favourite');
} }
public function cover() public function cover()
{ {
return $this->belongsTo('Image'); return $this->belongsTo('App\Image');
} }
public function tracks() public function tracks()
{ {
return $this->hasMany('Track')->orderBy('track_number', 'asc'); return $this->hasMany('App\Track')->orderBy('track_number', 'asc');
} }
public function comments() public function comments()
{ {
return $this->hasMany('Comment')->orderBy('created_at', 'desc'); return $this->hasMany('App\Comment')->orderBy('created_at', 'desc');
} }
public static function mapPublicAlbumShow($album) public static function mapPublicAlbumShow($album)

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@ -14,27 +16,27 @@ class Comment extends Model
public function user() public function user()
{ {
return $this->belongsTo('User'); return $this->belongsTo('App\User');
} }
public function track() public function track()
{ {
return $this->belongsTo('Track'); return $this->belongsTo('App\Track');
} }
public function album() public function album()
{ {
return $this->belongsTo('Album'); return $this->belongsTo('App\Album');
} }
public function playlist() public function playlist()
{ {
return $this->belongsTo('Playlist'); return $this->belongsTo('App\Playlist');
} }
public function profile() public function profile()
{ {
return $this->belongsTo('User', 'profile_id'); return $this->belongsTo('App\User', 'profile_id');
} }
public static function mapPublic($comment) public static function mapPublic($comment)

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Favourite extends Model class Favourite extends Model
@ -15,22 +17,22 @@ class Favourite extends Model
public function user() public function user()
{ {
return $this->belongsTo('User'); return $this->belongsTo('App\User');
} }
public function track() public function track()
{ {
return $this->belongsTo('Track'); return $this->belongsTo('App\Track');
} }
public function album() public function album()
{ {
return $this->belongsTo('Album'); return $this->belongsTo('App\Album');
} }
public function playlist() public function playlist()
{ {
return $this->belongsTo('Playlist'); return $this->belongsTo('App\Playlist');
} }
/** /**

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Follower extends Model class Follower extends Model

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Traits\SlugTrait; use Traits\SlugTrait;

View file

@ -1,5 +1,8 @@
<?php <?php
namespace App;
use External;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL; use Illuminate\Support\Facades\URL;

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class License extends Model class License extends Model

View file

@ -1,7 +1,10 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use SimplePie;
class News extends Model class News extends Model
{ {

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class PinnedPlaylist extends Model class PinnedPlaylist extends Model
@ -8,11 +10,11 @@ class PinnedPlaylist extends Model
public function user() public function user()
{ {
return $this->belongsTo('User'); return $this->belongsTo('App\User');
} }
public function playlist() public function playlist()
{ {
return $this->belongsTo('Playlist'); return $this->belongsTo('App\Playlist');
} }
} }

View file

@ -1,5 +1,8 @@
<?php <?php
namespace App;
use Helpers;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@ -124,7 +127,7 @@ class Playlist extends Model
public function tracks() public function tracks()
{ {
return $this return $this
->belongsToMany('Track') ->belongsToMany('App\Track')
->withPivot('position') ->withPivot('position')
->withTimestamps() ->withTimestamps()
->orderBy('position', 'asc'); ->orderBy('position', 'asc');
@ -132,22 +135,22 @@ class Playlist extends Model
public function users() public function users()
{ {
return $this->hasMany('ResourceUser'); return $this->hasMany('App\ResourceUser');
} }
public function comments() public function comments()
{ {
return $this->hasMany('Comment')->orderBy('created_at', 'desc'); return $this->hasMany('App\Comment')->orderBy('created_at', 'desc');
} }
public function pins() public function pins()
{ {
return $this->hasMany('PinnedPlaylist'); return $this->hasMany('App\PinnedPlaylist');
} }
public function user() public function user()
{ {
return $this->belongsTo('User'); return $this->belongsTo('App\User');
} }
public function hasPinFor($userId) public function hasPinFor($userId)

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class ProfileRequest class ProfileRequest

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class ResourceUser extends Model class ResourceUser extends Model

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class ShowSong extends Model class ShowSong extends Model

View file

@ -1,5 +1,11 @@
<?php <?php
namespace App;
use Exception;
use External;
use getid3_writetags;
use Helpers;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@ -321,52 +327,52 @@ class Track extends Model
public function genre() public function genre()
{ {
return $this->belongsTo('Genre'); return $this->belongsTo('App\Genre');
} }
public function trackType() public function trackType()
{ {
return $this->belongsTo('TrackType', 'track_type_id'); return $this->belongsTo('App\TrackType', 'track_type_id');
} }
public function comments() public function comments()
{ {
return $this->hasMany('Comment')->orderBy('created_at', 'desc'); return $this->hasMany('App\Comment')->orderBy('created_at', 'desc');
} }
public function favourites() public function favourites()
{ {
return $this->hasMany('Favourite'); return $this->hasMany('App\Favourite');
} }
public function cover() public function cover()
{ {
return $this->belongsTo('Image'); return $this->belongsTo('App\Image');
} }
public function showSongs() public function showSongs()
{ {
return $this->belongsToMany('ShowSong'); return $this->belongsToMany('App\ShowSong');
} }
public function users() public function users()
{ {
return $this->hasMany('ResourceUser'); return $this->hasMany('App\ResourceUser');
} }
public function user() public function user()
{ {
return $this->belongsTo('User'); return $this->belongsTo('App\User');
} }
public function album() public function album()
{ {
return $this->belongsTo('Album'); return $this->belongsTo('App\Album');
} }
public function trackFiles() public function trackFiles()
{ {
return $this->hasMany('TrackFile'); return $this->hasMany('App\TrackFile');
} }
public function getYear() public function getYear()

View file

@ -1,5 +1,8 @@
<?php <?php
namespace App;
use Helpers;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
@ -9,7 +12,7 @@ class TrackFile extends Model
{ {
public function track() public function track()
{ {
return $this->belongsTo('Track'); return $this->belongsTo('App\Track');
} }
/** /**

View file

@ -1,5 +1,7 @@
<?php <?php
namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class TrackType extends Model class TrackType extends Model

View file

@ -1,5 +1,9 @@
<?php <?php
namespace App;
use Exception;
use Gravatar;
use Illuminate\Auth\Authenticatable; use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
@ -31,17 +35,17 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
public function avatar() public function avatar()
{ {
return $this->belongsTo('Image'); return $this->belongsTo('App\Image');
} }
public function users() public function users()
{ {
return $this->hasMany('ResourceUser', 'artist_id'); return $this->hasMany('App\ResourceUser', 'artist_id');
} }
public function comments() public function comments()
{ {
return $this->hasMany('Comment', 'profile_id')->orderBy('created_at', 'desc'); return $this->hasMany('App\Comment', 'profile_id')->orderBy('created_at', 'desc');
} }
public function getIsArchivedAttribute() public function getIsArchivedAttribute()

View file

@ -1,57 +1,60 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration { class CreateUsersTable extends Migration
public function up() { {
Schema::create('users', function(Blueprint $table) { public function up()
$table->increments('id'); {
$table->string('display_name', 255); Schema::create('users', function (Blueprint $table) {
$table->string('mlpforums_name')->nullable(); $table->increments('id');
$table->boolean('sync_names')->default(true); $table->string('display_name', 255);
$table->string('email', 150)->indexed(); $table->string('mlpforums_name')->nullable();
$table->string('gravatar')->nullable(); $table->boolean('sync_names')->default(true);
$table->string('slug'); $table->string('email', 150)->indexed();
$table->boolean('uses_gravatar')->default(true); $table->string('gravatar')->nullable();
$table->boolean('can_see_explicit_content'); $table->string('slug');
$table->text('bio'); $table->boolean('uses_gravatar')->default(true);
$table->integer('track_count')->unsigned(); $table->boolean('can_see_explicit_content');
$table->integer('comment_count')->unsigned(); $table->text('bio');
$table->timestamps(); $table->integer('track_count')->unsigned();
}); $table->integer('comment_count')->unsigned();
$table->timestamps();
});
Schema::create('roles', function($table){ Schema::create('roles', function ($table) {
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
}); });
Schema::create('role_user', function($table){ Schema::create('role_user', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->index(); $table->integer('user_id')->unsigned()->index();
$table->integer('role_id')->unsigned()->index(); $table->integer('role_id')->unsigned()->index();
$table->timestamps(); $table->timestamps();
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
$table->foreign('role_id')->references('id')->on('roles'); $table->foreign('role_id')->references('id')->on('roles');
}); });
Schema::create('cache', function($table){ Schema::create('cache', function ($table) {
$table->string('key')->index(); $table->string('key')->index();
$table->text('value'); $table->text('value');
$table->integer('expiration')->unsigned()->index(); $table->integer('expiration')->unsigned()->index();
}); });
DB::table('roles')->insert(['name' => 'super_admin']); DB::table('roles')->insert(['name' => 'super_admin']);
DB::table('roles')->insert(['name' => 'admin']); DB::table('roles')->insert(['name' => 'admin']);
DB::table('roles')->insert(['name' => 'moderator']); DB::table('roles')->insert(['name' => 'moderator']);
DB::table('roles')->insert(['name' => 'user']); DB::table('roles')->insert(['name' => 'user']);
} }
public function down() { public function down()
Schema::drop('cache'); {
Schema::drop('role_user'); Schema::drop('cache');
Schema::drop('roles'); Schema::drop('role_user');
Schema::drop('users'); Schema::drop('roles');
} Schema::drop('users');
}
} }

View file

@ -2,127 +2,130 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateTracksTable extends Migration { class CreateTracksTable extends Migration
public function up() { {
Schema::create('licenses', function($table){ public function up()
$table->increments('id'); {
$table->string('title', 100); Schema::create('licenses', function ($table) {
$table->text('description'); $table->increments('id');
$table->boolean('affiliate_distribution'); $table->string('title', 100);
$table->boolean('open_distribution'); $table->text('description');
$table->boolean('remix'); $table->boolean('affiliate_distribution');
}); $table->boolean('open_distribution');
$table->boolean('remix');
});
Schema::create('genres', function($table){ Schema::create('genres', function ($table) {
$table->increments('id'); $table->increments('id');
$table->string('name')->unique(); $table->string('name')->unique();
$table->string('slug', 200)->index(); $table->string('slug', 200)->index();
}); });
Schema::create('track_types', function($table){ Schema::create('track_types', function ($table) {
$table->increments('id'); $table->increments('id');
$table->string('title'); $table->string('title');
$table->string('editor_title'); $table->string('editor_title');
}); });
Schema::create('tracks', function($table){ Schema::create('tracks', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned(); $table->integer('user_id')->unsigned();
$table->integer('license_id')->unsigned()->nullable()->default(NULL); $table->integer('license_id')->unsigned()->nullable()->default(null);
$table->integer('genre_id')->unsigned()->nullable()->index()->default(NULL); $table->integer('genre_id')->unsigned()->nullable()->index()->default(null);
$table->integer('track_type_id')->unsigned()->nullable()->default(NULL); $table->integer('track_type_id')->unsigned()->nullable()->default(null);
$table->string('title', 100)->index(); $table->string('title', 100)->index();
$table->string('slug', 200)->index(); $table->string('slug', 200)->index();
$table->text('description')->nullable(); $table->text('description')->nullable();
$table->text('lyrics')->nullable(); $table->text('lyrics')->nullable();
$table->boolean('is_vocal'); $table->boolean('is_vocal');
$table->boolean('is_explicit'); $table->boolean('is_explicit');
$table->integer('cover_id')->unsigned()->nullable(); $table->integer('cover_id')->unsigned()->nullable();
$table->boolean('is_downloadable'); $table->boolean('is_downloadable');
$table->float('duration')->unsigned(); $table->float('duration')->unsigned();
$table->integer('play_count')->unsigned(); $table->integer('play_count')->unsigned();
$table->integer('view_count')->unsigned(); $table->integer('view_count')->unsigned();
$table->integer('download_count')->unsigned(); $table->integer('download_count')->unsigned();
$table->integer('favourite_count')->unsigned(); $table->integer('favourite_count')->unsigned();
$table->integer('comment_count')->unsigned(); $table->integer('comment_count')->unsigned();
$table->timestamps(); $table->timestamps();
$table->timestamp('deleted_at')->nullable()->index(); $table->timestamp('deleted_at')->nullable()->index();
$table->timestamp('published_at')->nullable()->index(); $table->timestamp('published_at')->nullable()->index();
$table->timestamp('released_at')->nullable(); $table->timestamp('released_at')->nullable();
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
$table->foreign('license_id')->references('id')->on('licenses'); $table->foreign('license_id')->references('id')->on('licenses');
$table->foreign('genre_id')->references('id')->on('genres')->on_update('cascade'); $table->foreign('genre_id')->references('id')->on('genres')->on_update('cascade');
$table->foreign('track_type_id')->references('id')->on('track_types')->on_update('cascade'); $table->foreign('track_type_id')->references('id')->on('track_types')->on_update('cascade');
}); });
DB::table('licenses')->insert([ DB::table('licenses')->insert([
'title' => 'Personal', 'title' => 'Personal',
'description' => 'Only you and Pony.fm are allowed to distribute and broadcast the track.', 'description' => 'Only you and Pony.fm are allowed to distribute and broadcast the track.',
'affiliate_distribution' => 0, 'affiliate_distribution' => 0,
'open_distribution' => 0, 'open_distribution' => 0,
'remix' => 0 'remix' => 0
]); ]);
DB::table('licenses')->insert([ DB::table('licenses')->insert([
'title' => 'Broadcast', 'title' => 'Broadcast',
'description' => 'You, Pony.fm, and its affiliates may distribute and broadcast the track.', 'description' => 'You, Pony.fm, and its affiliates may distribute and broadcast the track.',
'affiliate_distribution' => 1, 'affiliate_distribution' => 1,
'open_distribution' => 0, 'open_distribution' => 0,
'remix' => 0 'remix' => 0
]); ]);
DB::table('licenses')->insert([ DB::table('licenses')->insert([
'title' => 'Open', 'title' => 'Open',
'description' => 'Anyone is permitted to broadcast and distribute the song in its original form, with attribution to you.', 'description' => 'Anyone is permitted to broadcast and distribute the song in its original form, with attribution to you.',
'affiliate_distribution' => 1, 'affiliate_distribution' => 1,
'open_distribution' => 1, 'open_distribution' => 1,
'remix' => 0 'remix' => 0
]); ]);
DB::table('licenses')->insert([ DB::table('licenses')->insert([
'title' => 'Remix', 'title' => 'Remix',
'description' => 'Anyone is permitted to broadcast and distribute the song in any form, or create derivative works based on it for any purpose, with attribution to you.', 'description' => 'Anyone is permitted to broadcast and distribute the song in any form, or create derivative works based on it for any purpose, with attribution to you.',
'affiliate_distribution' => 1, 'affiliate_distribution' => 1,
'open_distribution' => 1, 'open_distribution' => 1,
'remix' => 1 'remix' => 1
]); ]);
DB::table('track_types')->insert([ DB::table('track_types')->insert([
'title' => 'Original Song', 'title' => 'Original Song',
'editor_title' => 'an original song' 'editor_title' => 'an original song'
]); ]);
DB::table('track_types')->insert([ DB::table('track_types')->insert([
'title' => 'Official Song Remix', 'title' => 'Official Song Remix',
'editor_title' => 'a remix of an official song' 'editor_title' => 'a remix of an official song'
]); ]);
DB::table('track_types')->insert([ DB::table('track_types')->insert([
'title' => 'Fan Song Remix', 'title' => 'Fan Song Remix',
'editor_title' => 'a remix of a fan song' 'editor_title' => 'a remix of a fan song'
]); ]);
DB::table('track_types')->insert([ DB::table('track_types')->insert([
'title' => 'Ponified Song', 'title' => 'Ponified Song',
'editor_title' => 'a non-pony song, turned pony' 'editor_title' => 'a non-pony song, turned pony'
]); ]);
DB::table('track_types')->insert([ DB::table('track_types')->insert([
'title' => 'Official Show Audio Remix', 'title' => 'Official Show Audio Remix',
'editor_title' => 'a remix of official show audio' 'editor_title' => 'a remix of official show audio'
]); ]);
} }
public function down() { public function down()
Schema::drop('tracks'); {
Schema::drop('licenses'); Schema::drop('tracks');
Schema::drop('track_types'); Schema::drop('licenses');
Schema::drop('genres'); Schema::drop('track_types');
} Schema::drop('genres');
}
} }

View file

@ -2,43 +2,46 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateImagesTable extends Migration { class CreateImagesTable extends Migration
public function up() { {
Schema::create('images', function($table) { public function up()
$table->increments('id'); {
$table->string('filename', 256); Schema::create('images', function ($table) {
$table->string('mime', 100); $table->increments('id');
$table->string('extension', 32); $table->string('filename', 256);
$table->integer('size'); $table->string('mime', 100);
$table->string('hash', 32); $table->string('extension', 32);
$table->integer('uploaded_by')->unsigned(); $table->integer('size');
$table->timestamps(); $table->string('hash', 32);
$table->integer('uploaded_by')->unsigned();
$table->timestamps();
$table->foreign('uploaded_by')->references('id')->on('users'); $table->foreign('uploaded_by')->references('id')->on('users');
}); });
Schema::table('users', function($table) { Schema::table('users', function ($table) {
$table->integer('avatar_id')->unsigned()->nullable(); $table->integer('avatar_id')->unsigned()->nullable();
$table->foreign('avatar_id')->references('id')->on('images'); $table->foreign('avatar_id')->references('id')->on('images');
}); });
DB::table('tracks')->update(['cover_id' => null]); DB::table('tracks')->update(['cover_id' => null]);
Schema::table('tracks', function($table) { Schema::table('tracks', function ($table) {
$table->foreign('cover_id')->references('id')->on('images'); $table->foreign('cover_id')->references('id')->on('images');
}); });
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
$table->dropForeign('tracks_cover_id_foreign'); Schema::table('tracks', function ($table) {
}); $table->dropForeign('tracks_cover_id_foreign');
});
Schema::table('users', function($table) { Schema::table('users', function ($table) {
$table->dropForeign('users_avatar_id_foreign'); $table->dropForeign('users_avatar_id_foreign');
$table->dropColumn('avatar_id'); $table->dropColumn('avatar_id');
}); });
Schema::drop('images'); Schema::drop('images');
} }
} }

View file

@ -2,28 +2,30 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateSongsTable extends Migration { class CreateSongsTable extends Migration
public function up() { {
Schema::create('show_songs', function($table) { public function up()
$table->increments('id'); {
$table->string('title', 100); Schema::create('show_songs', function ($table) {
$table->text('lyrics'); $table->increments('id');
$table->string('slug', 200)->indexed(); $table->string('title', 100);
}); $table->text('lyrics');
$table->string('slug', 200)->indexed();
});
Schema::create('show_song_track', function($table) { Schema::create('show_song_track', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('track_id')->unsigned(); $table->integer('track_id')->unsigned();
$table->integer('show_song_id')->unsigned(); $table->integer('show_song_id')->unsigned();
$table->foreign('track_id')->references('id')->on('tracks')->on_update('cascade'); $table->foreign('track_id')->references('id')->on('tracks')->on_update('cascade');
$table->foreign('show_song_id')->references('id')->on('show_songs')->on_update('cascade'); $table->foreign('show_song_id')->references('id')->on('show_songs')->on_update('cascade');
}); });
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 1, 'id' => 1,
'title' => "Equestria Girls", 'title' => "Equestria Girls",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
Ooh! This is my jam! Ooh! This is my jam!
There is a place There is a place
@ -97,12 +99,12 @@ Aoaoah oh, aoaoaoh!
Break it down, DJ Pon-3 Break it down, DJ Pon-3
These are the ponies I love the most These are the ponies I love the most
I wish you could all be Equestria girls", I wish you could all be Equestria girls",
'slug' => "equestria-girls", 'slug' => "equestria-girls",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 2, 'id' => 2,
'title' => "My Little Pony Theme Song", 'title' => "My Little Pony Theme Song",
'lyrics' => "[Backup singer] 'lyrics' => "[Backup singer]
My Little Pony, My Little Pony My Little Pony, My Little Pony
Ahh, ahh, ahh, ahhh….. Ahh, ahh, ahh, ahhh…..
@ -132,12 +134,12 @@ It's an easy feat
And magic makes it all complete And magic makes it all complete
You have my little ponies You have my little ponies
Do you know you're all my very best friends?", Do you know you're all my very best friends?",
'slug' => "my-little-pony-theme-song", 'slug' => "my-little-pony-theme-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 3, 'id' => 3,
'title' => "Laughter Song", 'title' => "Laughter Song",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
When I was a little filly and the sun was going down... When I was a little filly and the sun was going down...
Twilight Sparkle: Tell me she's not... Twilight Sparkle: Tell me she's not...
@ -176,12 +178,12 @@ Snortle at the spooky
And tell that big dumb scary face to take a hike and leave you alone and if he thinks he can scare you then he's got another thing coming and the very idea of such a thing just makes you wanna... hahahaha... heh... And tell that big dumb scary face to take a hike and leave you alone and if he thinks he can scare you then he's got another thing coming and the very idea of such a thing just makes you wanna... hahahaha... heh...
Laaaaaaauuugh!", Laaaaaaauuugh!",
'slug' => "laughter-song", 'slug' => "laughter-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 4, 'id' => 4,
'title' => "Pinkie's Gala Fantasy Song", 'title' => "Pinkie's Gala Fantasy Song",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
Oh the Grand Galloping Gala is the best place for me Oh the Grand Galloping Gala is the best place for me
Oh the Grand Galloping Gala is the best place for me Oh the Grand Galloping Gala is the best place for me
Hip hip Hip hip
@ -197,12 +199,12 @@ Oh the Grand Galloping Gala is the best place for me
'Cause it's the most galarrific superly-terrific gala ever 'Cause it's the most galarrific superly-terrific gala ever
In the whole galaxy In the whole galaxy
Wheee!", Wheee!",
'slug' => "pinkies-gala-fantasy-song", 'slug' => "pinkies-gala-fantasy-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 5, 'id' => 5,
'title' => "The Ticket Song", 'title' => "The Ticket Song",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
Twilight is my bestest friend Twilight is my bestest friend
Whoopie, whoopie! Whoopie, whoopie!
@ -222,22 +224,22 @@ Twilight Sparkle: Pinkie!
She'll give her extra ticket to the gala to me! She'll give her extra ticket to the gala to me!
Twilight Sparkle: PIIINKIIIE!!", Twilight Sparkle: PIIINKIIIE!!",
'slug' => "the-ticket-song", 'slug' => "the-ticket-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 6, 'id' => 6,
'title' => "Junior Speedsters Chant", 'title' => "Junior Speedsters Chant",
'lyrics' => "[Rainbow Dash/Gilda] 'lyrics' => "[Rainbow Dash/Gilda]
Junior Speedsters are our lives, Junior Speedsters are our lives,
Sky-bound soars and daring dives Sky-bound soars and daring dives
Junior Speedsters, it's our quest, Junior Speedsters, it's our quest,
To some day be the very best!", To some day be the very best!",
'slug' => "junior-speedsters-chant", 'slug' => "junior-speedsters-chant",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 7, 'id' => 7,
'title' => "Hop Skip and Jump song", 'title' => "Hop Skip and Jump song",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
It's not very far It's not very far
Just move your little rump Just move your little rump
You can make it if you try with a hop, skip and jump You can make it if you try with a hop, skip and jump
@ -252,12 +254,12 @@ A hop, skip and jump,
A hop, skip and jump, A hop, skip and jump,
A hop skip and jump, A hop skip and jump,
A hop skip and jump!", A hop skip and jump!",
'slug' => "hop-skip-and-jump-song", 'slug' => "hop-skip-and-jump-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 8, 'id' => 8,
'title' => "Evil Enchantress song", 'title' => "Evil Enchantress song",
'lyrics' => "[Pinkie Pie/Flutterguy] 'lyrics' => "[Pinkie Pie/Flutterguy]
She's an evil enchantress She's an evil enchantress
She does evil dances She does evil dances
And if you look deep in her eyes And if you look deep in her eyes
@ -267,12 +269,12 @@ She'll mix up an evil brew
Then she'll gobble you up Then she'll gobble you up
In a big tasty stew In a big tasty stew
Soooo.... Watch out!", Soooo.... Watch out!",
'slug' => "evil-enchantress-song", 'slug' => "evil-enchantress-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 9, 'id' => 9,
'title' => "Winter Wrap Up", 'title' => "Winter Wrap Up",
'lyrics' => "[Rainbow Dash] 'lyrics' => "[Rainbow Dash]
Three months of winter coolness Three months of winter coolness
And awesome holidays And awesome holidays
@ -407,12 +409,12 @@ Winter Wrap Up! Winter Wrap Up!
'Cause tomorrow spring is here 'Cause tomorrow spring is here
'Cause tomorrow spring is here 'Cause tomorrow spring is here
'Cause tomorrow spring is here!", 'Cause tomorrow spring is here!",
'slug' => "winter-wrap-up", 'slug' => "winter-wrap-up",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 10, 'id' => 10,
'title' => "Cupcake Song", 'title' => "Cupcake Song",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
All you have to do is take a cup of flour! All you have to do is take a cup of flour!
Add it to the mix! Add it to the mix!
Now just take a little something sweet, not sour! Now just take a little something sweet, not sour!
@ -426,12 +428,12 @@ And you never get your fill of...
Cupcakes! So sweet and tasty! Cupcakes! So sweet and tasty!
Cupcakes! Don't be too hasty! Cupcakes! Don't be too hasty!
Cupcakes! Cupcakes, cupcakes, CUPCAKES!", Cupcakes! Cupcakes, cupcakes, CUPCAKES!",
'slug' => "cupcake-song", 'slug' => "cupcake-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 11, 'id' => 11,
'title' => "Art of the Dress", 'title' => "Art of the Dress",
'lyrics' => "[Rarity] 'lyrics' => "[Rarity]
Thread by thread, stitching it together Thread by thread, stitching it together
Twilight's dress, cutting out the pattern snip by snip Twilight's dress, cutting out the pattern snip by snip
Making sure the fabric folds nicely Making sure the fabric folds nicely
@ -467,12 +469,12 @@ Croup, dock, haunch, shoulders, hip
Thread by thread, primmed and pressed Thread by thread, primmed and pressed
Yard by yard, never stressed Yard by yard, never stressed
And that's the art of the dress!", And that's the art of the dress!",
'slug' => "art-of-the-dress", 'slug' => "art-of-the-dress",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 12, 'id' => 12,
'title' => "Hush Now Lullaby", 'title' => "Hush Now Lullaby",
'lyrics' => "[Fluttershy] 'lyrics' => "[Fluttershy]
Hush now, quiet now Hush now, quiet now
It's time to lay your sleepy head It's time to lay your sleepy head
Hush now, quiet now Hush now, quiet now
@ -502,12 +504,12 @@ Said hush now! Quiet now!
It's time to go to BED! It's time to go to BED!
OW!", OW!",
'slug' => "hush-now-lullaby", 'slug' => "hush-now-lullaby",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 13, 'id' => 13,
'title' => "Cutie Mark Crusaders Song", 'title' => "Cutie Mark Crusaders Song",
'lyrics' => "[Scootaloo] 'lyrics' => "[Scootaloo]
Look, here, are three little ponies Look, here, are three little ponies
Ready to sing for this crowd Ready to sing for this crowd
Listen up, 'cause here's our story Listen up, 'cause here's our story
@ -556,12 +558,12 @@ We are the Cutie Mark Crusaders
On a quest to find out who we are On a quest to find out who we are
And we will never stop the journey And we will never stop the journey
Not until we have our cutie marks!", Not until we have our cutie marks!",
'slug' => "cutie-mark-crusaders-song", 'slug' => "cutie-mark-crusaders-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 14, 'id' => 14,
'title' => "You Got to Share, You Got to Care", 'title' => "You Got to Share, You Got to Care",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
We may be divided We may be divided
But of you all, I beg But of you all, I beg
To remember we're all hoofed To remember we're all hoofed
@ -594,12 +596,12 @@ You gotta care
It's the right thing to do It's the right thing to do
And there'll always be a way And there'll always be a way
Thro-o-o-o-ugh!", Thro-o-o-o-ugh!",
'slug' => "you-got-to-share-you-got-to-care", 'slug' => "you-got-to-share-you-got-to-care",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 15, 'id' => 15,
'title' => "So Many Wonders", 'title' => "So Many Wonders",
'lyrics' => "[Fluttershy] 'lyrics' => "[Fluttershy]
What is this place What is this place
filled with so many wonders? filled with so many wonders?
Casting its spell Casting its spell
@ -618,12 +620,12 @@ If I knew the ground had so much up its sleeve
I'd have come here sooner, and never leave I'd have come here sooner, and never leave
Yes, I love everythiiiiiiiiiiiing!", Yes, I love everythiiiiiiiiiiiing!",
'slug' => "so-many-wonders", 'slug' => "so-many-wonders",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 16, 'id' => 16,
'title' => "Pinkie Pie's Singing Telegram", 'title' => "Pinkie Pie's Singing Telegram",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
This is your singing telegram This is your singing telegram
I hope it finds you well I hope it finds you well
You're invited to a party You're invited to a party
@ -648,12 +650,12 @@ It won't be the same without you
So we hope that you say yes So we hope that you say yes
So, please, oh please R.S.V.P So, please, oh please R.S.V.P
And come, and be our guest!", And come, and be our guest!",
'slug' => "pinkie-pies-singing-telegram", 'slug' => "pinkie-pies-singing-telegram",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 17, 'id' => 17,
'title' => "At the Gala", 'title' => "At the Gala",
'lyrics' => "Twilight Sparkle: I can't believe we're finally here. With all that we've imagined, the reality of this night is sure to make this... The Best Night Ever! 'lyrics' => "Twilight Sparkle: I can't believe we're finally here. With all that we've imagined, the reality of this night is sure to make this... The Best Night Ever!
At the Gala At the Gala
@ -763,12 +765,12 @@ Twilight Sparkle: To talk!
Into the Gala, into the Gala! Into the Gala, into the Gala!
And we'll have the best night ever! And we'll have the best night ever!
At the Gala!", At the Gala!",
'slug' => "at-the-gala", 'slug' => "at-the-gala",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 18, 'id' => 18,
'title' => "I'm at the Grand Galloping Gala", 'title' => "I'm at the Grand Galloping Gala",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
I'm at the Grand Galloping Gala, I'm at the Grand Galloping Gala,
I'm at the Grand Galloping Gala, I'm at the Grand Galloping Gala,
I'm at the Grand Galloping Gala, I'm at the Grand Galloping Gala,
@ -780,12 +782,12 @@ I'm at the Grand Galloping GalaaaaaaaaaaAAAAAAAAAAAA!
[pause] [pause]
It's all I ever... dreamed?", It's all I ever... dreamed?",
'slug' => "im-at-the-grand-galloping-gala", 'slug' => "im-at-the-grand-galloping-gala",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 19, 'id' => 19,
'title' => "Pony Pokey", 'title' => "Pony Pokey",
'lyrics' => "[Pinkie] 'lyrics' => "[Pinkie]
You reach your right hoof in You reach your right hoof in
You reach your right hoof out You reach your right hoof out
You reach your right hoof in You reach your right hoof in
@ -830,12 +832,12 @@ You do the Pony Pokey
And that's what it's all about And that's what it's all about
Yeah!", Yeah!",
'slug' => "pony-pokey", 'slug' => "pony-pokey",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 20, 'id' => 20,
'title' => "Find A Pet Song", 'title' => "Find A Pet Song",
'lyrics' => "[Fluttershy] 'lyrics' => "[Fluttershy]
Now, Rainbow, my dear, I cannot express my delight Now, Rainbow, my dear, I cannot express my delight
It's abundantly clear It's abundantly clear
That somewhere out here That somewhere out here
@ -969,12 +971,12 @@ May the games
Begin Begin
Rainbow Dash: And may the best pet win!", Rainbow Dash: And may the best pet win!",
'slug' => "find-a-pet-song", 'slug' => "find-a-pet-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 21, 'id' => 21,
'title' => "Becoming Popular (The Pony Everypony Should Know)", 'title' => "Becoming Popular (The Pony Everypony Should Know)",
'lyrics' => "[Rarity] 'lyrics' => "[Rarity]
I'll be the toast of the town, the girl on the go I'll be the toast of the town, the girl on the go
I'm the type of pony everypony, everypony should know I'm the type of pony everypony, everypony should know
@ -998,44 +1000,44 @@ I'm the type of pony everypony, everypony should know
Because I'm the type of pony Because I'm the type of pony
Yes, I'm the type of pony Yes, I'm the type of pony
Yes, I'm the type of pony everypony should know", Yes, I'm the type of pony everypony should know",
'slug' => "becoming-popular-the-pony-everypony-should-know", 'slug' => "becoming-popular-the-pony-everypony-should-know",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 22, 'id' => 22,
'title' => "The Heart Carol", 'title' => "The Heart Carol",
'lyrics' => "[Choir] 'lyrics' => "[Choir]
The fire of friendship lives in our hearts The fire of friendship lives in our hearts
As long as it burns we cannot drift apart As long as it burns we cannot drift apart
Though quarrels arise, their numbers are few Though quarrels arise, their numbers are few
Laughter and singing will see us through (will see us through) Laughter and singing will see us through (will see us through)
We are a circle of pony friends We are a circle of pony friends
A circle of friends we'll be to the very end", A circle of friends we'll be to the very end",
'slug' => "the-heart-carol", 'slug' => "the-heart-carol",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 23, 'id' => 23,
'title' => "Happy Monthiversary", 'title' => "Happy Monthiversary",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
Happy monthiversary to you and you today Happy monthiversary to you and you today
[very quickly] I can't believe you're already a month old time sure flies doesn't it well it seems like only yesterday you were born. [very quickly] I can't believe you're already a month old time sure flies doesn't it well it seems like only yesterday you were born.
But now you're a month old today, hey!", But now you're a month old today, hey!",
'slug' => "happy-monthiversary", 'slug' => "happy-monthiversary",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 24, 'id' => 24,
'title' => "Piggy Dance", 'title' => "Piggy Dance",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
First you jiggle your tail! Oink oink oink! First you jiggle your tail! Oink oink oink!
Then you wriggle your snout! Oink oink oink! Then you wriggle your snout! Oink oink oink!
Then you wiggle your rump! Oink oink oink! Then you wiggle your rump! Oink oink oink!
Then shout it out! Oink oink oink! Then shout it out! Oink oink oink!
[repeat verse two more times]", [repeat verse two more times]",
'slug' => "piggy-dance", 'slug' => "piggy-dance",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 25, 'id' => 25,
'title' => "The Flim Flam Brothers", 'title' => "The Flim Flam Brothers",
'lyrics' => "[Flim] 'lyrics' => "[Flim]
Well, lookie what we got here, brother of mine, it's the same in every town Well, lookie what we got here, brother of mine, it's the same in every town
Ponies with thirsty throats, dry tongues, and not a drop of cider to be found Ponies with thirsty throats, dry tongues, and not a drop of cider to be found
Maybe they're not aware that there's really no need for this teary despair Maybe they're not aware that there's really no need for this teary despair
@ -1195,12 +1197,12 @@ Traveling salesponies nonpareil
[Flim and Flam] [Flim and Flam]
Yeah!", Yeah!",
'slug' => "the-flim-flam-brothers", 'slug' => "the-flim-flam-brothers",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 26, 'id' => 26,
'title' => "The Perfect Stallion", 'title' => "The Perfect Stallion",
'lyrics' => "[Sweetie Belle] 'lyrics' => "[Sweetie Belle]
Cheerilee is sweet and kind. Cheerilee is sweet and kind.
She's the best teacher we could hope for. She's the best teacher we could hope for.
The perfect stallion you and I must find. The perfect stallion you and I must find.
@ -1278,12 +1280,12 @@ We did it girls. We've found the one.
Who will send our teacher's heart aflutter. Who will send our teacher's heart aflutter.
Apple Bloom: Wait a minute. Let me get this straight. Are you talking about my brother?", Apple Bloom: Wait a minute. Let me get this straight. Are you talking about my brother?",
'slug' => "the-perfect-stallion", 'slug' => "the-perfect-stallion",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 27, 'id' => 27,
'title' => "Smile Song", 'title' => "Smile Song",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
My name is Pinkie Pie (Hello!) My name is Pinkie Pie (Hello!)
And I am here to say (How ya doin'?) And I am here to say (How ya doin'?)
I'm gonna make you smile, and I will brighten up your day-aaay! I'm gonna make you smile, and I will brighten up your day-aaay!
@ -1354,21 +1356,21 @@ Smile, smile, smile, smile, smile!
[Pinkie Pie] [Pinkie Pie]
Come on and smile Come on and smile
Come on and smile!", Come on and smile!",
'slug' => "smile-song", 'slug' => "smile-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 28, 'id' => 28,
'title' => "Cranky Doodle Donkey", 'title' => "Cranky Doodle Donkey",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
You're a Cranky Doodle Donkey guy. You're a Cranky Doodle Donkey guy.
A Cranky Doodle Donkey. A Cranky Doodle Donkey.
I never met you but you're my new friend and I'm your best friend Pinkie Pie!", I never met you but you're my new friend and I'm your best friend Pinkie Pie!",
'slug' => "cranky-doodle-donkey", 'slug' => "cranky-doodle-donkey",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 29, 'id' => 29,
'title' => "Welcome Song", 'title' => "Welcome Song",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
Welcome welcome welcome Welcome welcome welcome
A fine welcome to you A fine welcome to you
Welcome welcome welcome Welcome welcome welcome
@ -1379,12 +1381,12 @@ Welcome welcome welcome
To Ponyville today To Ponyville today
Pinkie Pie: Wait for it!", Pinkie Pie: Wait for it!",
'slug' => "welcome-song", 'slug' => "welcome-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 30, 'id' => 30,
'title' => "Cranky Doodle Joy", 'title' => "Cranky Doodle Joy",
'lyrics' => "[Pinkie Pie] 'lyrics' => "[Pinkie Pie]
He had a Cranky Doodle sweetheart He had a Cranky Doodle sweetheart
She's his cranky doodle joy She's his cranky doodle joy
I helped the Cranky Doodle boy, yeah! I helped the Cranky Doodle boy, yeah!
@ -1392,12 +1394,12 @@ I helped the Cranky Doodle boy!
Cranky Doodle Donkey and Matilda: Pinkie! Cranky Doodle Donkey and Matilda: Pinkie!
Pinkie Pie: Whoops, privacy. Sorry.", Pinkie Pie: Whoops, privacy. Sorry.",
'slug' => "cranky-doodle-joy", 'slug' => "cranky-doodle-joy",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 31, 'id' => 31,
'title' => "Big Brother Best Friend Forever (B.B.B.F.F.)", 'title' => "Big Brother Best Friend Forever (B.B.B.F.F.)",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
When I was just a filly, I found it rather silly When I was just a filly, I found it rather silly
To see how many other ponies I could meet To see how many other ponies I could meet
I had my books to read, didn't know that I would ever need I had my books to read, didn't know that I would ever need
@ -1424,12 +1426,12 @@ I hoped that he would stay
My big brother best friend My big brother best friend
Forever... Forever...
Forever...", Forever...",
'slug' => "big-brother-best-friend-forever-bbbff", 'slug' => "big-brother-best-friend-forever-bbbff",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 32, 'id' => 32,
'title' => "This Day Aria", 'title' => "This Day Aria",
'lyrics' => "[Queen Chrysalis] 'lyrics' => "[Queen Chrysalis]
This day is going to be perfect This day is going to be perfect
The kind of day of which I've dreamed since I was small The kind of day of which I've dreamed since I was small
Everypony will gather 'round Everypony will gather 'round
@ -1475,12 +1477,12 @@ He'll end up marrying a fake
Shining Armor will be Shining Armor will be
[Queen Chrysalis]: ...mine, all mine. [evil laugh]", [Queen Chrysalis]: ...mine, all mine. [evil laugh]",
'slug' => "this-day-aria", 'slug' => "this-day-aria",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 33, 'id' => 33,
'title' => "Love Is In Bloom", 'title' => "Love Is In Bloom",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
Love is in bloom Love is in bloom
A beautiful bride, a handsome groom, A beautiful bride, a handsome groom,
Two hearts becoming one Two hearts becoming one
@ -1502,12 +1504,12 @@ A beautiful bride, a handsome groom
I said love is in bloom I said love is in bloom
You're starting a life and making room You're starting a life and making room
For us, (For us... For us...Aah...)", For us, (For us... For us...Aah...)",
'slug' => "love-is-in-bloom", 'slug' => "love-is-in-bloom",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 34, 'id' => 34,
'title' => "The Failure Song", 'title' => "The Failure Song",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
I was prepared to do my best I was prepared to do my best
Thought I could handle any test Thought I could handle any test
For I can do so many tricks For I can do so many tricks
@ -1554,12 +1556,12 @@ No I wasn't
[Twilight Sparkle and Spike] [Twilight Sparkle and Spike]
Prepared... for this!", Prepared... for this!",
'slug' => "the-failure-song", 'slug' => "the-failure-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 35, 'id' => 35,
'title' => "The Ballad of the Crystal Empire", 'title' => "The Ballad of the Crystal Empire",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
Princess Cadence needs our help Princess Cadence needs our help
Her magic will not last forever Her magic will not last forever
I think we can do it I think we can do it
@ -1597,12 +1599,12 @@ Can you learn it in a day?
Oh, we have to get this right Oh, we have to get this right
Yes we have to make them see Yes we have to make them see
We can save the Crystal Ponies... with their history!", We can save the Crystal Ponies... with their history!",
'slug' => "the-ballad-of-the-crystal-empire", 'slug' => "the-ballad-of-the-crystal-empire",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 36, 'id' => 36,
'title' => "The Success Song", 'title' => "The Success Song",
'lyrics' => "[Rarity] 'lyrics' => "[Rarity]
You were prepared to do your best You were prepared to do your best
Had what it takes to pass the test Had what it takes to pass the test
All those doubts you can dismiss All those doubts you can dismiss
@ -1644,12 +1646,12 @@ Turns out you were
[Spike, Applejack, Rainbow Dash, Rarity, Pinkie Pie, Fluttershy, and Twilight Sparkle] [Spike, Applejack, Rainbow Dash, Rarity, Pinkie Pie, Fluttershy, and Twilight Sparkle]
Prepared... for this!", Prepared... for this!",
'slug' => "the-success-song", 'slug' => "the-success-song",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 37, 'id' => 37,
'title' => "Babs Seed", 'title' => "Babs Seed",
'lyrics' => "[Cutie Mark Crusaders] 'lyrics' => "[Cutie Mark Crusaders]
Yeah, yeah, yeah Yeah, yeah, yeah
Yeah, yeah, yeah Yeah, yeah, yeah
Yeah, yeah, yeah, yeah, yeah Yeah, yeah, yeah, yeah, yeah
@ -1708,12 +1710,12 @@ Babs Seed, Babs Seed-
[Scootaloo] [Scootaloo]
She's just a bad, bad seed", She's just a bad, bad seed",
'slug' => "babs-seed", 'slug' => "babs-seed",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 38, 'id' => 38,
'title' => "Raise This Barn", 'title' => "Raise This Barn",
'lyrics' => "[Applejack] 'lyrics' => "[Applejack]
Yee-hoo! Yee-hoo!
Raise this barn, raise this barn Raise this barn, raise this barn
@ -1803,12 +1805,12 @@ All we need to strive to be
Is part of the Apple family Is part of the Apple family
Apple Bloom: Yeah!", Apple Bloom: Yeah!",
'slug' => "raise-this-barn", 'slug' => "raise-this-barn",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 39, 'id' => 39,
'title' => "Morning in Ponyville", 'title' => "Morning in Ponyville",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
Morning in Ponyville shimmers Morning in Ponyville shimmers
Morning in Ponyville shines Morning in Ponyville shines
And I know for absolute certain And I know for absolute certain
@ -1828,12 +1830,12 @@ Morning in Ponyville shimmers
Morning in Ponyville shines Morning in Ponyville shines
And I know for absolute certain And I know for absolute certain
That everything is certainly...", That everything is certainly...",
'slug' => "morning-in-ponyville", 'slug' => "morning-in-ponyville",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 40, 'id' => 40,
'title' => "What My Cutie Mark Is Telling Me", 'title' => "What My Cutie Mark Is Telling Me",
'lyrics' => "[Rainbow Dash] 'lyrics' => "[Rainbow Dash]
These animals don't listen, no, not one little bit These animals don't listen, no, not one little bit
They run around out of control and throw their hissy fits They run around out of control and throw their hissy fits
It's up to me to stop them, 'cause plainly you can see It's up to me to stop them, 'cause plainly you can see
@ -1880,12 +1882,12 @@ It's what my cutie mark
[All] [All]
Yes, it's what my cutie mark is telling me!", Yes, it's what my cutie mark is telling me!",
'slug' => "what-my-cutie-mark-is-telling-me", 'slug' => "what-my-cutie-mark-is-telling-me",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 41, 'id' => 41,
'title' => "I've Got to Find a Way", 'title' => "I've Got to Find a Way",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
I have to find a way I have to find a way
To make this all okay To make this all okay
I can't believe this small mistake I can't believe this small mistake
@ -1899,12 +1901,12 @@ I don't know what to do
I fear I won't get through to you I fear I won't get through to you
Oh why, oh why", Oh why, oh why",
'slug' => "ive-got-to-find-a-way", 'slug' => "ive-got-to-find-a-way",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 42, 'id' => 42,
'title' => "A True, True Friend", 'title' => "A True, True Friend",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
A true, true friend helps a friend in need A true, true friend helps a friend in need
A friend will be there to help them see A friend will be there to help them see
@ -1982,12 +1984,12 @@ A true, true friend helps a friend in need
To see the light (to see the light) To see the light (to see the light)
That shines (that shines) That shines (that shines)
From a true, true friend!", From a true, true friend!",
'slug' => "a-true-true-friend", 'slug' => "a-true-true-friend",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 43, 'id' => 43,
'title' => "Celestia's Ballad", 'title' => "Celestia's Ballad",
'lyrics' => "[Princess Celestia] 'lyrics' => "[Princess Celestia]
You've come such a long, long way You've come such a long, long way
And I've watched you from that very first day And I've watched you from that very first day
To see how you might grow To see how you might grow
@ -2001,12 +2003,12 @@ To go where you will go
To see what you will see To see what you will see
To find what you will be To find what you will be
For it's time for you to fulfill your destiny", For it's time for you to fulfill your destiny",
'slug' => "celestias-ballad", 'slug' => "celestias-ballad",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 44, 'id' => 44,
'title' => "Behold, Princess Twilight Sparkle", 'title' => "Behold, Princess Twilight Sparkle",
'lyrics' => "[Choir] 'lyrics' => "[Choir]
Thou Princess Twilight cometh Thou Princess Twilight cometh
Behold, behold Behold, behold
A Princess here before us A Princess here before us
@ -2017,12 +2019,12 @@ The Princess Twilight cometh
Behold, behold (behold, behold) Behold, behold (behold, behold)
The Princess is The Princess is
The Princess is here", The Princess is here",
'slug' => "behold-princess-twilight-sparkle", 'slug' => "behold-princess-twilight-sparkle",
]); ]);
DB::table('show_songs')->insert([ DB::table('show_songs')->insert([
'id' => 45, 'id' => 45,
'title' => "Life in Equestria", 'title' => "Life in Equestria",
'lyrics' => "[Twilight Sparkle] 'lyrics' => "[Twilight Sparkle]
Life in Equestria shimmers Life in Equestria shimmers
Life in Equestria shines Life in Equestria shines
And I know for absolute certain And I know for absolute certain
@ -2034,17 +2036,18 @@ Yes, everything is certainly fine
It’s fine It’s fine
Twilight Sparkle: Yes! Everything’s going to be just fine!", Twilight Sparkle: Yes! Everything’s going to be just fine!",
'slug' => "life-in-equestria", 'slug' => "life-in-equestria",
]); ]);
} }
public function down() { public function down()
Schema::table('show_song_track', function($table){ {
$table->dropForeign('show_song_track_track_id_foreign'); Schema::table('show_song_track', function ($table) {
$table->dropForeign('show_song_track_show_song_id_foreign'); $table->dropForeign('show_song_track_track_id_foreign');
}); $table->dropForeign('show_song_track_show_song_id_foreign');
});
Schema::drop('show_song_track'); Schema::drop('show_song_track');
Schema::drop('show_songs'); Schema::drop('show_songs');
} }
} }

View file

@ -2,44 +2,47 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateAlbums extends Migration { class CreateAlbums extends Migration
public function up() { {
Schema::create('albums', function($table) { public function up()
$table->increments('id'); {
$table->integer('user_id')->unsigned(); Schema::create('albums', function ($table) {
$table->string('title')->index(); $table->increments('id');
$table->string('slug')->index(); $table->integer('user_id')->unsigned();
$table->text('description'); $table->string('title')->index();
$table->integer('cover_id')->unsigned()->nullable(); $table->string('slug')->index();
$table->text('description');
$table->integer('cover_id')->unsigned()->nullable();
$table->integer('track_count')->unsigned(); $table->integer('track_count')->unsigned();
$table->integer('view_count')->unsigned(); $table->integer('view_count')->unsigned();
$table->integer('download_count')->unsigned(); $table->integer('download_count')->unsigned();
$table->integer('favourite_count')->unsigned(); $table->integer('favourite_count')->unsigned();
$table->integer('comment_count')->unsigned(); $table->integer('comment_count')->unsigned();
$table->timestamps(); $table->timestamps();
$table->timestamp('deleted_at')->nullable()->index(); $table->timestamp('deleted_at')->nullable()->index();
$table->foreign('cover_id')->references('id')->on('images'); $table->foreign('cover_id')->references('id')->on('images');
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
}); });
Schema::table('tracks', function($table) { Schema::table('tracks', function ($table) {
$table->integer('album_id')->unsigned()->nullable(); $table->integer('album_id')->unsigned()->nullable();
$table->integer('track_number')->unsigned()->nullable(); $table->integer('track_number')->unsigned()->nullable();
$table->foreign('album_id')->references('id')->on('albums'); $table->foreign('album_id')->references('id')->on('albums');
}); });
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
$table->dropForeign('tracks_album_id_foreign'); Schema::table('tracks', function ($table) {
$table->dropColumn('album_id'); $table->dropForeign('tracks_album_id_foreign');
$table->dropColumn('track_number'); $table->dropColumn('album_id');
}); $table->dropColumn('track_number');
});
Schema::drop('albums'); Schema::drop('albums');
} }
} }

View file

@ -2,66 +2,69 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreatePlaylists extends Migration { class CreatePlaylists extends Migration
public function up() { {
Schema::create('playlists', function($table) { public function up()
$table->increments('id'); {
$table->integer('user_id')->unsigned()->index(); Schema::create('playlists', function ($table) {
$table->string('title'); $table->increments('id');
$table->string('slug'); $table->integer('user_id')->unsigned()->index();
$table->text('description'); $table->string('title');
$table->boolean('is_public'); $table->string('slug');
$table->text('description');
$table->boolean('is_public');
$table->integer('track_count')->unsigned(); $table->integer('track_count')->unsigned();
$table->integer('view_count')->unsigned(); $table->integer('view_count')->unsigned();
$table->integer('download_count')->unsigned(); $table->integer('download_count')->unsigned();
$table->integer('favourite_count')->unsigned(); $table->integer('favourite_count')->unsigned();
$table->integer('follow_count')->unsigned(); $table->integer('follow_count')->unsigned();
$table->integer('comment_count')->unsigned(); $table->integer('comment_count')->unsigned();
$table->timestamps(); $table->timestamps();
$table->date('deleted_at')->nullable()->index(); $table->date('deleted_at')->nullable()->index();
$table->foreign('user_id')->references('id')->on('users')->on_update('cascade'); $table->foreign('user_id')->references('id')->on('users')->on_update('cascade');
}); });
Schema::create('playlist_track', function($table){ Schema::create('playlist_track', function ($table) {
$table->increments('id'); $table->increments('id');
$table->timestamps(); $table->timestamps();
$table->integer('playlist_id')->unsigned()->index(); $table->integer('playlist_id')->unsigned()->index();
$table->integer('track_id')->unsigned()->index(); $table->integer('track_id')->unsigned()->index();
$table->integer('position')->unsigned(); $table->integer('position')->unsigned();
$table->foreign('playlist_id')->references('id')->on('playlists')->on_update('cascade')->on_delete('cascade'); $table->foreign('playlist_id')->references('id')->on('playlists')->on_update('cascade')->on_delete('cascade');
$table->foreign('track_id')->references('id')->on('tracks')->on_update('cascade'); $table->foreign('track_id')->references('id')->on('tracks')->on_update('cascade');
}); });
Schema::create('pinned_playlists', function($table) { Schema::create('pinned_playlists', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->index(); $table->integer('user_id')->unsigned()->index();
$table->integer('playlist_id')->unsigned()->index(); $table->integer('playlist_id')->unsigned()->index();
$table->timestamps(); $table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->on_update('cascade'); $table->foreign('user_id')->references('id')->on('users')->on_update('cascade');
$table->foreign('playlist_id')->references('id')->on('playlists')->on_update('cascade'); $table->foreign('playlist_id')->references('id')->on('playlists')->on_update('cascade');
}); });
} }
public function down() { public function down()
Schema::table('playlist_track', function($table){ {
$table->dropForeign('playlist_track_playlist_id_foreign'); Schema::table('playlist_track', function ($table) {
$table->dropForeign('playlist_track_track_id_foreign'); $table->dropForeign('playlist_track_playlist_id_foreign');
}); $table->dropForeign('playlist_track_track_id_foreign');
});
Schema::drop('playlist_track'); Schema::drop('playlist_track');
Schema::drop('pinned_playlists'); Schema::drop('pinned_playlists');
Schema::table('playlists', function($table){ Schema::table('playlists', function ($table) {
$table->dropForeign('playlists_user_id_foreign'); $table->dropForeign('playlists_user_id_foreign');
}); });
Schema::drop('playlists'); Schema::drop('playlists');
} }
} }

View file

@ -2,37 +2,40 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateComments extends Migration { class CreateComments extends Migration
public function up() { {
Schema::create('comments', function($table){ public function up()
$table->increments('id'); {
$table->integer('user_id')->unsigned(); Schema::create('comments', function ($table) {
$table->string('ip_address', 46); $table->increments('id');
$table->text('content'); $table->integer('user_id')->unsigned();
$table->string('ip_address', 46);
$table->text('content');
$table->timestamps(); $table->timestamps();
$table->timestamp('deleted_at')->nullable()->index(); $table->timestamp('deleted_at')->nullable()->index();
$table->integer('profile_id')->unsigned()->nullable()->index(); $table->integer('profile_id')->unsigned()->nullable()->index();
$table->integer('track_id')->unsigned()->nullable()->index(); $table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index(); $table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index(); $table->integer('playlist_id')->unsigned()->nullable()->index();
$table->foreign('profile_id')->references('id')->on('users'); $table->foreign('profile_id')->references('id')->on('users');
$table->foreign('user_id')->references('id')->on('users'); $table->foreign('user_id')->references('id')->on('users');
$table->foreign('track_id')->references('id')->on('tracks'); $table->foreign('track_id')->references('id')->on('tracks');
$table->foreign('album_id')->references('id')->on('albums'); $table->foreign('album_id')->references('id')->on('albums');
$table->foreign('playlist_id')->references('id')->on('playlists'); $table->foreign('playlist_id')->references('id')->on('playlists');
}); });
} }
public function down() { public function down()
Schema::table('comments', function($table){ {
$table->dropForeign('comments_user_id_foreign'); Schema::table('comments', function ($table) {
$table->dropForeign('comments_track_id_foreign'); $table->dropForeign('comments_user_id_foreign');
$table->dropForeign('comments_album_id_foreign'); $table->dropForeign('comments_track_id_foreign');
$table->dropForeign('comments_playlist_id_foreign'); $table->dropForeign('comments_album_id_foreign');
}); $table->dropForeign('comments_playlist_id_foreign');
Schema::drop('comments'); });
} Schema::drop('comments');
}
} }

View file

@ -2,56 +2,59 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateUserTables extends Migration { class CreateUserTables extends Migration
public function up() { {
Schema::create('resource_users', function($table){ public function up()
$table->increments('id'); {
$table->integer('user_id')->unsigned()->index(); Schema::create('resource_users', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('track_id')->unsigned()->nullable()->index(); $table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index(); $table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index(); $table->integer('playlist_id')->unsigned()->nullable()->index();
$table->integer('artist_id')->unsigned()->nullable()->index(); $table->integer('artist_id')->unsigned()->nullable()->index();
$table->boolean('is_followed'); $table->boolean('is_followed');
$table->boolean('is_favourited'); $table->boolean('is_favourited');
$table->boolean('is_pinned'); $table->boolean('is_pinned');
$table->integer('view_count'); $table->integer('view_count');
$table->integer('play_count'); $table->integer('play_count');
$table->integer('download_count'); $table->integer('download_count');
$table->foreign('artist_id')->references('id')->on('users')->on_delete('cascade'); $table->foreign('artist_id')->references('id')->on('users')->on_delete('cascade');
$table->foreign('user_id')->references('id')->on('users')->on_delete('cascade'); $table->foreign('user_id')->references('id')->on('users')->on_delete('cascade');
$table->foreign('track_id')->references('id')->on('tracks')->on_delete('cascade');; $table->foreign('track_id')->references('id')->on('tracks')->on_delete('cascade');;
$table->foreign('album_id')->references('id')->on('albums')->on_delete('cascade');; $table->foreign('album_id')->references('id')->on('albums')->on_delete('cascade');;
$table->foreign('playlist_id')->references('id')->on('playlists')->on_delete('cascade');; $table->foreign('playlist_id')->references('id')->on('playlists')->on_delete('cascade');;
$table->unique(['user_id', 'track_id', 'album_id', 'playlist_id', 'artist_id'], 'resource_unique'); $table->unique(['user_id', 'track_id', 'album_id', 'playlist_id', 'artist_id'], 'resource_unique');
}); });
Schema::create('resource_log_items', function($table){ Schema::create('resource_log_items', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->nullable()->index(); $table->integer('user_id')->unsigned()->nullable()->index();
$table->integer('log_type')->unsigned(); $table->integer('log_type')->unsigned();
$table->string('ip_address', 46)->index(); $table->string('ip_address', 46)->index();
$table->integer('track_format_id')->unsigned()->nullable(); $table->integer('track_format_id')->unsigned()->nullable();
$table->integer('track_id')->unsigned()->nullable()->index(); $table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index(); $table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index(); $table->integer('playlist_id')->unsigned()->nullable()->index();
$table->timestamp('created_at'); $table->timestamp('created_at');
$table->foreign('user_id')->references('id')->on('users')->on_delete('cascade'); $table->foreign('user_id')->references('id')->on('users')->on_delete('cascade');
$table->foreign('track_id')->references('id')->on('tracks'); $table->foreign('track_id')->references('id')->on('tracks');
$table->foreign('album_id')->references('id')->on('albums'); $table->foreign('album_id')->references('id')->on('albums');
$table->foreign('playlist_id')->references('id')->on('playlists'); $table->foreign('playlist_id')->references('id')->on('playlists');
}); });
} }
public function down() { public function down()
Schema::drop('resource_users'); {
Schema::drop('resource_log_items'); Schema::drop('resource_users');
} Schema::drop('resource_log_items');
}
} }

View file

@ -1,34 +1,37 @@
<?php <?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateFavourites extends Migration { class CreateFavourites extends Migration
public function up() { {
Schema::create('favourites', function($table){ public function up()
$table->increments('id'); {
$table->integer('user_id')->unsigned()->index(); Schema::create('favourites', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('track_id')->unsigned()->nullable()->index(); $table->integer('track_id')->unsigned()->nullable()->index();
$table->integer('album_id')->unsigned()->nullable()->index(); $table->integer('album_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index(); $table->integer('playlist_id')->unsigned()->nullable()->index();
$table->timestamp('created_at'); $table->timestamp('created_at');
$table->foreign('user_id')->references('id')->on('users')->on_delete('cascade'); $table->foreign('user_id')->references('id')->on('users')->on_delete('cascade');
$table->foreign('track_id')->references('id')->on('tracks'); $table->foreign('track_id')->references('id')->on('tracks');
$table->foreign('album_id')->references('id')->on('albums'); $table->foreign('album_id')->references('id')->on('albums');
$table->foreign('playlist_id')->references('id')->on('playlists'); $table->foreign('playlist_id')->references('id')->on('playlists');
}); });
} }
public function down() { public function down()
Schema::table('favourites', function($table){ {
$table->dropForeign('favourites_user_id_foreign'); Schema::table('favourites', function ($table) {
$table->dropForeign('favourites_track_id_foreign'); $table->dropForeign('favourites_user_id_foreign');
$table->dropForeign('favourites_album_id_foreign'); $table->dropForeign('favourites_track_id_foreign');
$table->dropForeign('favourites_playlist_id_foreign'); $table->dropForeign('favourites_album_id_foreign');
}); $table->dropForeign('favourites_playlist_id_foreign');
});
Schema::drop('favourites'); Schema::drop('favourites');
} }
} }

View file

@ -2,24 +2,27 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateFollowers extends Migration { class CreateFollowers extends Migration
public function up() { {
Schema::create('followers', function($table){ public function up()
$table->increments('id'); {
$table->integer('user_id')->unsigned()->index(); Schema::create('followers', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->integer('artist_id')->unsigned()->nullable()->index(); $table->integer('artist_id')->unsigned()->nullable()->index();
$table->integer('playlist_id')->unsigned()->nullable()->index(); $table->integer('playlist_id')->unsigned()->nullable()->index();
$table->timestamp('created_at'); $table->timestamp('created_at');
$table->foreign('user_id')->references('id')->on('users')->on_delete('cascade'); $table->foreign('user_id')->references('id')->on('users')->on_delete('cascade');
$table->foreign('artist_id')->references('id')->on('users')->on_delete('cascade'); $table->foreign('artist_id')->references('id')->on('users')->on_delete('cascade');
$table->foreign('playlist_id')->references('id')->on('playlists'); $table->foreign('playlist_id')->references('id')->on('playlists');
}); });
} }
public function down() { public function down()
Schema::drop('followers'); {
} Schema::drop('followers');
}
} }

View file

@ -2,21 +2,24 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class Oauth extends Migration { class Oauth extends Migration
public function up() { {
Schema::create('oauth2_tokens', function($table) { public function up()
$table->increments('id'); {
$table->integer('user_id'); Schema::create('oauth2_tokens', function ($table) {
$table->integer('external_user_id'); $table->increments('id');
$table->text('access_token'); $table->integer('user_id');
$table->timestamp('expires'); $table->integer('external_user_id');
$table->text('refresh_token'); $table->text('access_token');
$table->string('type'); $table->timestamp('expires');
$table->string('service'); $table->text('refresh_token');
}); $table->string('type');
} $table->string('service');
});
}
public function down() { public function down()
Schema::drop('oauth2_tokens'); {
} Schema::drop('oauth2_tokens');
}
} }

View file

@ -2,20 +2,23 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateNewsTable extends Migration { class CreateNewsTable extends Migration
public function up() { {
Schema::create('news', function($table){ public function up()
$table->increments('id'); {
$table->integer('user_id')->unsigned()->index(); Schema::create('news', function ($table) {
$table->string('post_hash', 32)->index(); $table->increments('id');
$table->timestamps(); $table->integer('user_id')->unsigned()->index();
$table->string('post_hash', 32)->index();
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
}); });
} }
public function down() { public function down()
Schema::drop('news'); {
} Schema::drop('news');
}
} }

View file

@ -2,13 +2,15 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateLatestColumn extends Migration { class CreateLatestColumn extends Migration
public function up() { {
Schema::table('tracks', function($table) { public function up()
$table->boolean('is_latest')->notNullable()->indexed(); {
}); Schema::table('tracks', function ($table) {
$table->boolean('is_latest')->notNullable()->indexed();
});
DB::update(' DB::update('
UPDATE UPDATE
tracks tracks
SET SET
@ -27,11 +29,12 @@ class CreateLatestColumn extends Migration {
) = tracks.id ) = tracks.id
AND AND
published_at IS NOT NULL'); published_at IS NOT NULL');
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
$table->dropColumn('is_latest'); Schema::table('tracks', function ($table) {
}); $table->dropColumn('is_latest');
} });
}
} }

View file

@ -1,23 +1,26 @@
<?php <?php
use Entities\Track; use App\Track;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class CreateTrackHashes extends Migration { class CreateTrackHashes extends Migration
public function up() { {
Schema::table('tracks', function($table) { public function up()
$table->string('hash', 32)->notNullable()->indexed(); {
}); Schema::table('tracks', function ($table) {
$table->string('hash', 32)->notNullable()->indexed();
});
foreach (Track::with('user')->get() as $track) { foreach (Track::with('user')->get() as $track) {
$track->updateHash(); $track->updateHash();
$track->save(); $track->save();
} }
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
$table->dropColumn('hash'); Schema::table('tracks', function ($table) {
}); $table->dropColumn('hash');
} });
}
} }

View file

@ -2,22 +2,25 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class TrackIsListed extends Migration { class TrackIsListed extends Migration
public function up() { {
Schema::table('tracks', function($table) { public function up()
$table->boolean('is_listed')->notNullable()->indexed(); {
}); Schema::table('tracks', function ($table) {
$table->boolean('is_listed')->notNullable()->indexed();
});
DB::update(' DB::update('
UPDATE UPDATE
tracks tracks
SET SET
is_listed = true'); is_listed = true');
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
$table->dropColumn('is_listed'); Schema::table('tracks', function ($table) {
}); $table->dropColumn('is_listed');
} });
}
} }

View file

@ -1,16 +1,19 @@
<?php <?php
use App\Track;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Entities\Track;
class UpdateTrackHash extends Migration { class UpdateTrackHash extends Migration
public function up() { {
foreach (Track::with('user')->get() as $track) { public function up()
$track->updateHash(); {
$track->save(); foreach (Track::with('user')->get() as $track) {
} $track->updateHash();
} $track->save();
}
}
public function down() { public function down()
} {
}
} }

View file

@ -2,16 +2,19 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class AddRememberMeField extends Migration { class AddRememberMeField extends Migration
public function up() { {
Schema::table('users', function($table) { public function up()
$table->string('remember_token', 100)->nullable()->indexed(); {
}); Schema::table('users', function ($table) {
} $table->string('remember_token', 100)->nullable()->indexed();
});
}
public function down() { public function down()
Schema::table('users', function($table) { {
$table->dropColumn('remember_token'); Schema::table('users', function ($table) {
}); $table->dropColumn('remember_token');
} });
}
} }

View file

@ -2,30 +2,31 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class AddArchivedProfileField extends Migration { class AddArchivedProfileField extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
* *
* @return void * @return void
*/ */
public function up() public function up()
{ {
Schema::table('users', function ( $table ) { Schema::table('users', function ($table) {
$table->boolean( 'is_archived' )->default(false); $table->boolean('is_archived')->default(false);
} ); });
} }
/** /**
* Reverse the migrations. * Reverse the migrations.
* *
* @return void * @return void
*/ */
public function down() public function down()
{ {
Schema::table( 'users', function ( $table ) { Schema::table('users', function ($table) {
$table->dropColumn( 'is_archived' ); $table->dropColumn('is_archived');
} ); });
} }
} }

View file

@ -1,5 +1,6 @@
<?php <?php
use App\Track;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;