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,11 +1,13 @@
<?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()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->string('display_name', 255); $table->string('display_name', 255);
$table->string('mlpforums_name')->nullable(); $table->string('mlpforums_name')->nullable();
@ -21,12 +23,12 @@ class CreateUsersTable extends Migration {
$table->timestamps(); $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();
@ -36,7 +38,7 @@ class CreateUsersTable extends Migration {
$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();
@ -48,7 +50,8 @@ class CreateUsersTable extends Migration {
DB::table('roles')->insert(['name' => 'user']); DB::table('roles')->insert(['name' => 'user']);
} }
public function down() { public function down()
{
Schema::drop('cache'); Schema::drop('cache');
Schema::drop('role_user'); Schema::drop('role_user');
Schema::drop('roles'); Schema::drop('roles');

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('licenses', function ($table) {
$table->increments('id'); $table->increments('id');
$table->string('title', 100); $table->string('title', 100);
$table->text('description'); $table->text('description');
@ -13,25 +15,25 @@ class CreateTracksTable extends Migration {
$table->boolean('remix'); $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();
@ -119,7 +121,8 @@ class CreateTracksTable extends Migration {
]); ]);
} }
public function down() { public function down()
{
Schema::drop('tracks'); Schema::drop('tracks');
Schema::drop('licenses'); Schema::drop('licenses');
Schema::drop('track_types'); Schema::drop('track_types');

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('images', function ($table) {
$table->increments('id'); $table->increments('id');
$table->string('filename', 256); $table->string('filename', 256);
$table->string('mime', 100); $table->string('mime', 100);
@ -17,24 +19,25 @@ class CreateImagesTable extends Migration {
$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) { {
Schema::table('tracks', function ($table) {
$table->dropForeign('tracks_cover_id_foreign'); $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');
}); });

View file

@ -2,16 +2,18 @@
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()
{
Schema::create('show_songs', function ($table) {
$table->increments('id'); $table->increments('id');
$table->string('title', 100); $table->string('title', 100);
$table->text('lyrics'); $table->text('lyrics');
$table->string('slug', 200)->indexed(); $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();
@ -178,7 +180,7 @@ And tell that big dumb scary face to take a hike and leave you alone and if he t
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]
@ -198,8 +200,8 @@ Oh the Grand Galloping Gala is the best place for me
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]
@ -223,8 +225,8 @@ 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]
@ -233,8 +235,8 @@ 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]
@ -253,8 +255,8 @@ 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]
@ -268,8 +270,8 @@ 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]
@ -408,8 +410,8 @@ 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!",
'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]
@ -427,8 +429,8 @@ 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]
@ -468,8 +470,8 @@ 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]
@ -503,8 +505,8 @@ 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]
@ -557,8 +559,8 @@ 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]
@ -595,8 +597,8 @@ 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]
@ -619,8 +621,8 @@ 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]
@ -649,8 +651,8 @@ 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!
@ -764,8 +766,8 @@ 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]
@ -781,8 +783,8 @@ I'm at the Grand Galloping GalaaaaaaaaaaAAAAAAAAAAAA!
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]
@ -831,8 +833,8 @@ 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]
@ -970,8 +972,8 @@ 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]
@ -999,8 +1001,8 @@ 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]
@ -1011,8 +1013,8 @@ 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]
@ -1020,8 +1022,8 @@ 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]
@ -1031,8 +1033,8 @@ 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]
@ -1196,8 +1198,8 @@ 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]
@ -1279,8 +1281,8 @@ 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]
@ -1355,8 +1357,8 @@ Smile, smile, smile, smile, smile!
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]
@ -1364,8 +1366,8 @@ 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]
@ -1380,8 +1382,8 @@ 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]
@ -1393,8 +1395,8 @@ 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]
@ -1425,8 +1427,8 @@ 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]
@ -1477,7 +1479,7 @@ 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]
@ -1504,7 +1506,7 @@ 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]
@ -1556,7 +1558,7 @@ No I wasn't
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]
@ -1599,7 +1601,7 @@ 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]
@ -1646,7 +1648,7 @@ Turns out you were
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]
@ -1710,7 +1712,7 @@ Babs Seed, Babs Seed-
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]
@ -1805,7 +1807,7 @@ 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]
@ -1830,7 +1832,7 @@ Morning in Ponyville shines
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]
@ -1882,7 +1884,7 @@ It's what my cutie mark
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]
@ -1901,7 +1903,7 @@ 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]
@ -1984,7 +1986,7 @@ 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]
@ -2003,7 +2005,7 @@ 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]
@ -2019,7 +2021,7 @@ 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]
@ -2038,8 +2040,9 @@ Twilight Sparkle: Yes! Everything’s going to be just fine!",
]); ]);
} }
public function down() { public function down()
Schema::table('show_song_track', function($table){ {
Schema::table('show_song_track', function ($table) {
$table->dropForeign('show_song_track_track_id_foreign'); $table->dropForeign('show_song_track_track_id_foreign');
$table->dropForeign('show_song_track_show_song_id_foreign'); $table->dropForeign('show_song_track_show_song_id_foreign');
}); });

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('albums', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned(); $table->integer('user_id')->unsigned();
$table->string('title')->index(); $table->string('title')->index();
@ -25,7 +27,7 @@ class CreateAlbums extends Migration {
$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();
@ -33,8 +35,9 @@ class CreateAlbums extends Migration {
}); });
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
Schema::table('tracks', function ($table) {
$table->dropForeign('tracks_album_id_foreign'); $table->dropForeign('tracks_album_id_foreign');
$table->dropColumn('album_id'); $table->dropColumn('album_id');
$table->dropColumn('track_number'); $table->dropColumn('track_number');

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('playlists', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->index(); $table->integer('user_id')->unsigned()->index();
$table->string('title'); $table->string('title');
@ -25,7 +27,7 @@ class CreatePlaylists extends Migration {
$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();
@ -36,7 +38,7 @@ class CreatePlaylists extends Migration {
$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();
@ -47,8 +49,9 @@ class CreatePlaylists extends Migration {
}); });
} }
public function down() { public function down()
Schema::table('playlist_track', function($table){ {
Schema::table('playlist_track', function ($table) {
$table->dropForeign('playlist_track_playlist_id_foreign'); $table->dropForeign('playlist_track_playlist_id_foreign');
$table->dropForeign('playlist_track_track_id_foreign'); $table->dropForeign('playlist_track_track_id_foreign');
}); });
@ -57,7 +60,7 @@ class CreatePlaylists extends Migration {
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');
}); });

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('comments', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned(); $table->integer('user_id')->unsigned();
$table->string('ip_address', 46); $table->string('ip_address', 46);
@ -26,8 +28,9 @@ class CreateComments extends Migration {
}); });
} }
public function down() { public function down()
Schema::table('comments', function($table){ {
Schema::table('comments', function ($table) {
$table->dropForeign('comments_user_id_foreign'); $table->dropForeign('comments_user_id_foreign');
$table->dropForeign('comments_track_id_foreign'); $table->dropForeign('comments_track_id_foreign');
$table->dropForeign('comments_album_id_foreign'); $table->dropForeign('comments_album_id_foreign');

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('resource_users', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->index(); $table->integer('user_id')->unsigned()->index();
@ -30,7 +32,7 @@ class CreateUserTables extends Migration {
$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();
@ -50,7 +52,8 @@ class CreateUserTables extends Migration {
}); });
} }
public function down() { public function down()
{
Schema::drop('resource_users'); Schema::drop('resource_users');
Schema::drop('resource_log_items'); Schema::drop('resource_log_items');
} }

View file

@ -1,10 +1,12 @@
<?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()
{
Schema::create('favourites', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->index(); $table->integer('user_id')->unsigned()->index();
@ -21,8 +23,9 @@
}); });
} }
public function down() { public function down()
Schema::table('favourites', function($table){ {
Schema::table('favourites', function ($table) {
$table->dropForeign('favourites_user_id_foreign'); $table->dropForeign('favourites_user_id_foreign');
$table->dropForeign('favourites_track_id_foreign'); $table->dropForeign('favourites_track_id_foreign');
$table->dropForeign('favourites_album_id_foreign'); $table->dropForeign('favourites_album_id_foreign');
@ -31,4 +34,4 @@
Schema::drop('favourites'); Schema::drop('favourites');
} }
} }

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('followers', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->index(); $table->integer('user_id')->unsigned()->index();
@ -19,7 +21,8 @@ class CreateFollowers extends Migration {
}); });
} }
public function down() { public function down()
{
Schema::drop('followers'); Schema::drop('followers');
} }
} }

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('oauth2_tokens', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id'); $table->integer('user_id');
$table->integer('external_user_id'); $table->integer('external_user_id');
@ -16,7 +18,8 @@ class Oauth extends Migration {
}); });
} }
public function down() { public function down()
{
Schema::drop('oauth2_tokens'); Schema::drop('oauth2_tokens');
} }
} }

View file

@ -2,9 +2,11 @@
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()
{
Schema::create('news', function ($table) {
$table->increments('id'); $table->increments('id');
$table->integer('user_id')->unsigned()->index(); $table->integer('user_id')->unsigned()->index();
$table->string('post_hash', 32)->index(); $table->string('post_hash', 32)->index();
@ -14,7 +16,8 @@ class CreateNewsTable extends Migration {
}); });
} }
public function down() { public function down()
{
Schema::drop('news'); Schema::drop('news');
} }

View file

@ -2,9 +2,11 @@
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()
{
Schema::table('tracks', function ($table) {
$table->boolean('is_latest')->notNullable()->indexed(); $table->boolean('is_latest')->notNullable()->indexed();
}); });
@ -29,8 +31,9 @@ class CreateLatestColumn extends Migration {
published_at IS NOT NULL'); published_at IS NOT NULL');
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
Schema::table('tracks', function ($table) {
$table->dropColumn('is_latest'); $table->dropColumn('is_latest');
}); });
} }

View file

@ -1,11 +1,13 @@
<?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()
{
Schema::table('tracks', function ($table) {
$table->string('hash', 32)->notNullable()->indexed(); $table->string('hash', 32)->notNullable()->indexed();
}); });
@ -15,8 +17,9 @@ class CreateTrackHashes extends Migration {
} }
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
Schema::table('tracks', function ($table) {
$table->dropColumn('hash'); $table->dropColumn('hash');
}); });
} }

View file

@ -2,9 +2,11 @@
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()
{
Schema::table('tracks', function ($table) {
$table->boolean('is_listed')->notNullable()->indexed(); $table->boolean('is_listed')->notNullable()->indexed();
}); });
@ -15,8 +17,9 @@ class TrackIsListed extends Migration {
is_listed = true'); is_listed = true');
} }
public function down() { public function down()
Schema::table('tracks', function($table) { {
Schema::table('tracks', function ($table) {
$table->dropColumn('is_listed'); $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() { {
public function up()
{
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()
{
} }
} }

View file

@ -2,15 +2,18 @@
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()
{
Schema::table('users', function ($table) {
$table->string('remember_token', 100)->nullable()->indexed(); $table->string('remember_token', 100)->nullable()->indexed();
}); });
} }
public function down() { public function down()
Schema::table('users', function($table) { {
Schema::table('users', function ($table) {
$table->dropColumn('remember_token'); $table->dropColumn('remember_token');
}); });
} }

View file

@ -2,7 +2,8 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class AddArchivedProfileField extends Migration { class AddArchivedProfileField extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
@ -11,9 +12,9 @@ class AddArchivedProfileField extends Migration {
*/ */
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);
} ); });
} }
/** /**
@ -23,9 +24,9 @@ class AddArchivedProfileField extends Migration {
*/ */
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;