diff --git a/app/Commands/AddTrackToPlaylistCommand.php b/app/Commands/AddTrackToPlaylistCommand.php index d2cead99..df556e8f 100644 --- a/app/Commands/AddTrackToPlaylistCommand.php +++ b/app/Commands/AddTrackToPlaylistCommand.php @@ -67,7 +67,7 @@ class AddTrackToPlaylistCommand extends CommandBase } - $songIndex = $this->_playlist->tracks()->count() + 1; + $songIndex = $this->_playlist->trackCount() + 1; $this->_playlist->tracks()->attach($this->_track, ['position' => $songIndex]); $this->_playlist->touch(); diff --git a/app/Commands/EditAlbumCommand.php b/app/Commands/EditAlbumCommand.php index 2f7fe285..42bbcfe0 100644 --- a/app/Commands/EditAlbumCommand.php +++ b/app/Commands/EditAlbumCommand.php @@ -63,7 +63,6 @@ class EditAlbumCommand extends CommandBase 'title' => 'required|min:3|max:50', 'cover' => 'image|mimes:png|min_width:350|min_height:350', 'cover_id' => 'exists:images,id', - 'track_ids' => 'exists:tracks,id', 'username' => 'exists:users,username' ]; @@ -73,6 +72,14 @@ class EditAlbumCommand extends CommandBase return CommandResponse::fail($validator); } + $trackIds = explode(',', $this->_input['track_ids']); + $trackIdsCount = count($trackIds); + $trackDbCount = DB::table('tracks')->whereIn('id', $trackIds)->count(); + + if ($trackDbCount != $trackIdsCount) { + return CommandResponse::fail("Track IDs invalid"); + } + $this->_album->title = $this->_input['title']; $this->_album->description = $this->_input['description']; diff --git a/app/Commands/ParseTrackTagsCommand.php b/app/Commands/ParseTrackTagsCommand.php index e6428441..bb035376 100644 --- a/app/Commands/ParseTrackTagsCommand.php +++ b/app/Commands/ParseTrackTagsCommand.php @@ -80,7 +80,7 @@ class ParseTrackTagsCommand extends CommandBase if ($this->track->album_id === null) { $this->track->track_number = null; } else { - $this->track->track_number = $this->input['track_number'] ?? $parsedTags['track_number']; + $this->track->track_number = filter_var($this->input['track_number'] ?? $parsedTags['track_number'], FILTER_SANITIZE_NUMBER_INT); } $this->track->released_at = isset($this->input['released_at']) @@ -95,10 +95,30 @@ class ParseTrackTagsCommand extends CommandBase $this->track->is_downloadable = $this->input['is_downloadable'] ?? true; $this->track->is_listed = $this->input['is_listed'] ?? true; + $this->track = $this->unsetNullVariables($this->track); + $this->track->save(); return CommandResponse::succeed(); } + /** + * If a value is null, remove it! Helps prevent weird SQL errors + * + * @param Track + * @return Track + */ + private function unsetNullVariables($track) { + $vars = $track->getAttributes(); + + foreach ($vars as $key => $value) { + if ($value == null) { + unset($track->{"$key"}); + } + } + + return $track; + } + /** * Returns the ID of the given genre, creating it if necessary. * @@ -340,7 +360,7 @@ class ParseTrackTagsCommand extends CommandBase } elseif (isset($tags['creation_date'])) { $releaseDate = $this->parseDateString($tags['creation_date'][0]); } else { - $releaseDate = 0; + $releaseDate = null; } return [ diff --git a/app/Commands/ToggleFavouriteCommand.php b/app/Commands/ToggleFavouriteCommand.php index 68c3ce74..c4926f91 100644 --- a/app/Commands/ToggleFavouriteCommand.php +++ b/app/Commands/ToggleFavouriteCommand.php @@ -49,7 +49,7 @@ class ToggleFavouriteCommand extends CommandBase return $user != null; } - + private function getEntityBeingFavourited():Favouritable { switch ($this->_resourceType) { @@ -80,10 +80,9 @@ class ToggleFavouriteCommand extends CommandBase $fav = new Favourite(); $fav->$typeId = $this->_resourceId; $fav->user_id = Auth::user()->id; - $fav->created_at = time(); $fav->save(); $isFavourited = true; - + Notification::newFavourite($this->getEntityBeingFavourited(), $fav->user); } diff --git a/app/Commands/ToggleFollowingCommand.php b/app/Commands/ToggleFollowingCommand.php index a9bb9910..60cd49ac 100644 --- a/app/Commands/ToggleFollowingCommand.php +++ b/app/Commands/ToggleFollowingCommand.php @@ -62,10 +62,9 @@ class ToggleFollowingCommand extends CommandBase $follow = new Follower(); $follow->$typeId = $this->_resourceId; $follow->user_id = Auth::user()->id; - $follow->created_at = time(); $follow->save(); $isFollowed = true; - + Notification::newFollower($follow->artist, Auth::user()); } diff --git a/app/Http/Controllers/Api/Web/AlbumsController.php b/app/Http/Controllers/Api/Web/AlbumsController.php index 4d3533a2..cbc42e93 100644 --- a/app/Http/Controllers/Api/Web/AlbumsController.php +++ b/app/Http/Controllers/Api/Web/AlbumsController.php @@ -128,14 +128,16 @@ class AlbumsController extends ApiControllerBase $query = Album::summary() ->with('user', 'user.avatar', 'cover') ->userDetails() - ->orderBy('title', 'asc') // An album with only one track is not really an album. ->where('track_count', '>', 1); $count = $query->count(); $perPage = 40; - $query->skip(($page - 1) * $perPage)->take($perPage); + $query + ->orderBy('title', 'asc') + ->skip(($page - 1) * $perPage) + ->take($perPage); $albums = []; foreach ($query->get() as $album) { diff --git a/app/Http/Controllers/Api/Web/ArtistsController.php b/app/Http/Controllers/Api/Web/ArtistsController.php index 03946b11..7c91c2ec 100644 --- a/app/Http/Controllers/Api/Web/ArtistsController.php +++ b/app/Http/Controllers/Api/Web/ArtistsController.php @@ -213,12 +213,13 @@ class ArtistsController extends ApiControllerBase $page = Input::get('page'); } - $query = User::orderBy('display_name', 'asc') - ->where('track_count', '>', 0); - + $query = User::where('track_count', '>', 0); $count = $query->count(); - $perPage = 40; + // The query results are ordered after they're counted + // due to Postgres's behaviour when combining those two operations. + $query->orderBy('display_name', 'asc'); + $perPage = 40; $query->skip(($page - 1) * $perPage)->take($perPage); $users = []; diff --git a/app/Http/Controllers/Api/Web/PlaylistsController.php b/app/Http/Controllers/Api/Web/PlaylistsController.php index c4164dbd..1451beac 100644 --- a/app/Http/Controllers/Api/Web/PlaylistsController.php +++ b/app/Http/Controllers/Api/Web/PlaylistsController.php @@ -81,11 +81,10 @@ class PlaylistsController extends ApiControllerBase ->where('track_count', '>', 1) ->whereIsPublic(true); - $this->applyFilters($query); - $count = $query->count(); - $perPage = 40; + $this->applyOrdering($query); + $perPage = 40; $query->skip(($page - 1) * $perPage)->take($perPage); $playlists = []; @@ -211,7 +210,16 @@ class PlaylistsController extends ApiControllerBase return Response::json($playlists, 200); } - private function applyFilters($query) + + /** + * This function should not deal with anything other than applying order, + * which is done after the query's total possible results are counted due + * to Postgres not allowing "ORDER BY" to be combined with "COUNT()". + * + * @param $query + * @return mixed + */ + private function applyOrdering($query) { if (Input::has('order')) { $order = \Input::get('order'); diff --git a/app/Http/Controllers/Api/Web/StatsController.php b/app/Http/Controllers/Api/Web/StatsController.php index c9672713..e7e05a6c 100644 --- a/app/Http/Controllers/Api/Web/StatsController.php +++ b/app/Http/Controllers/Api/Web/StatsController.php @@ -33,17 +33,17 @@ use Carbon\Carbon; class StatsController extends ApiControllerBase { private function getStatsData($id, $hourly = false) { - $playRange = "1 MONTH"; + $playRange = "'1 MONTH'"; if ($hourly) { - $playRange = "2 DAY"; + $playRange = "'2 DAY'"; } $statQuery = DB::table('resource_log_items') - ->selectRaw('created_at, COUNT(1) AS `plays`') + ->selectRaw('created_at, COUNT(1) AS "plays"') ->where('track_id', '=', $id) ->where('log_type', '=', ResourceLogItem::PLAY) - ->whereRaw('`created_at` > now() - INTERVAL '.$playRange) + ->whereRaw('"created_at" > now() - INTERVAL '.$playRange) ->groupBy('created_at') ->orderBy('created_at') ->get(); diff --git a/app/Http/Controllers/Api/Web/TracksController.php b/app/Http/Controllers/Api/Web/TracksController.php index ccc5e388..d0bfdb5e 100644 --- a/app/Http/Controllers/Api/Web/TracksController.php +++ b/app/Http/Controllers/Api/Web/TracksController.php @@ -156,8 +156,9 @@ class TracksController extends ApiControllerBase } $this->applyFilters($query); - $totalCount = $query->count(); + $this->applyOrdering($query); + $query->take($perPage)->skip($perPage * ($page - 1)); $tracks = []; @@ -205,7 +206,15 @@ class TracksController extends ApiControllerBase return Response::json(Track::mapPrivateTrackShow($track), 200); } - private function applyFilters($query) + /** + * To be run after aggregating the total number of tracks for a given query. + * This is separated from applyFilters() because Postgres doesn't allow + * ORDER BY statements in a COUNT(*) query that returns a single value. + * + * @param $query + * @return mixed + */ + private function applyOrdering($query) { if (Input::has('order')) { $order = \Input::get('order'); @@ -213,6 +222,17 @@ class TracksController extends ApiControllerBase $query->orderBy($parts[0], $parts[1]); } + return $query; + } + + /** + * This should be run before count()'ing a query's results. + * + * @param $query + * @return mixed + */ + private function applyFilters($query) + { if (Input::has('is_vocal')) { $isVocal = \Input::get('is_vocal'); if ($isVocal == 'true') { diff --git a/app/Models/Playlist.php b/app/Models/Playlist.php index c700b12a..a210457a 100644 --- a/app/Models/Playlist.php +++ b/app/Models/Playlist.php @@ -204,13 +204,23 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable ]; } - public function tracks() + public function tracks(bool $ordered = true) { - return $this + $query = $this ->belongsToMany(Track::class) ->withPivot('position') - ->withTimestamps() - ->orderBy('position', 'asc'); + ->withTimestamps(); + + if ($ordered) { + $query = $query->orderBy('position', 'asc'); + } + + return $query; + } + + public function trackCount():int + { + return $this->tracks(false)->count(); } public function trackFiles() @@ -233,7 +243,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable { return $this->hasMany(PinnedPlaylist::class); } - + public function favourites():HasMany { return $this->hasMany(Favourite::class); } diff --git a/app/Models/ShowSong.php b/app/Models/ShowSong.php index 34667ea1..52c885a1 100644 --- a/app/Models/ShowSong.php +++ b/app/Models/ShowSong.php @@ -39,7 +39,7 @@ class ShowSong extends Model public function trackCountRelation() { return $this->belongsToMany(Track::class) ->select(['show_song_id', DB::raw('count(*) as track_count')]) - ->groupBy('show_song_id'); + ->groupBy('show_song_id', 'track_id'); } public function tracks(){ diff --git a/app/Models/Track.php b/app/Models/Track.php index abb6b117..1a2886d0 100644 --- a/app/Models/Track.php +++ b/app/Models/Track.php @@ -277,18 +277,18 @@ class Track extends Model implements Searchable, Commentable, Favouritable $query = static ::published() ->listed() - ->join(DB::raw(' - ( SELECT `track_id`, `created_at` - FROM `resource_log_items` - WHERE track_id IS NOT NULL AND log_type = 3 AND `created_at` > now() - INTERVAL 1 DAY - ) AS ranged_plays'), + ->join(DB::raw('( + SELECT "track_id" + FROM "resource_log_items" + WHERE track_id IS NOT NULL AND log_type = 3 AND "created_at" > now() - INTERVAL \'1\' DAY + ) ranged_plays'), 'tracks.id', '=', 'ranged_plays.track_id') - ->groupBy('id') + ->groupBy(['id', 'track_id']) ->orderBy('plays', 'desc') ->take($count); if (!$allowExplicit) { - $query->whereIsExplicit(false); + $query->where('is_explicit', false); } $results = []; @@ -298,7 +298,8 @@ class Track extends Model implements Searchable, Commentable, Favouritable } return $results; - }); + } + ); if (!count($trackIds)) { return []; diff --git a/composer.json b/composer.json index e1a15e3c..dc7b86fa 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,9 @@ }, "autoload": { "classmap": [ - "database", + "database/factories", + "database/migrations", + "database/seeds", "app/Library" ], "psr-4": { diff --git a/composer.lock b/composer.lock index 49ff6f90..d98acbbd 100644 --- a/composer.lock +++ b/composer.lock @@ -63,28 +63,31 @@ }, { "name": "barryvdh/laravel-ide-helper", - "version": "v2.1.4", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-ide-helper.git", - "reference": "f1ebd847aac9a4545325d35108cafc285fe1605f" + "reference": "a9484c67d1305e9e2c71d2dfaaed6639200d874c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/f1ebd847aac9a4545325d35108cafc285fe1605f", - "reference": "f1ebd847aac9a4545325d35108cafc285fe1605f", + "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/a9484c67d1305e9e2c71d2dfaaed6639200d874c", + "reference": "a9484c67d1305e9e2c71d2dfaaed6639200d874c", "shasum": "" }, "require": { - "illuminate/console": "5.0.x|5.1.x|5.2.x", - "illuminate/filesystem": "5.0.x|5.1.x|5.2.x", - "illuminate/support": "5.0.x|5.1.x|5.2.x", + "barryvdh/reflection-docblock": "^2.0.4", + "illuminate/console": "^5.0,<5.4", + "illuminate/filesystem": "^5.0,<5.4", + "illuminate/support": "^5.0,<5.4", "php": ">=5.4.0", - "phpdocumentor/reflection-docblock": "^2.0.4", - "symfony/class-loader": "~2.3|~3.0" + "symfony/class-loader": "^2.3|^3.0" }, "require-dev": { - "doctrine/dbal": "~2.3" + "doctrine/dbal": "~2.3", + "phpunit/phpunit": "4.*", + "scrutinizer/ocular": "~1.1", + "squizlabs/php_codesniffer": "~2.3" }, "suggest": { "doctrine/dbal": "Load information from the database about models for phpdocs (~2.3)" @@ -122,20 +125,69 @@ "phpstorm", "sublime" ], - "time": "2016-03-03 08:45:00" + "time": "2016-06-13 19:36:24" }, { - "name": "beberlei/assert", - "version": "v2.5", + "name": "barryvdh/reflection-docblock", + "version": "v2.0.4", "source": { "type": "git", - "url": "https://github.com/beberlei/assert.git", - "reference": "91e2690c4ecc8a4e3e2d333430069f6a0c694a7a" + "url": "https://github.com/barryvdh/ReflectionDocBlock.git", + "reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beberlei/assert/zipball/91e2690c4ecc8a4e3e2d333430069f6a0c694a7a", - "reference": "91e2690c4ecc8a4e3e2d333430069f6a0c694a7a", + "url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/3dcbd98b5d9384a5357266efba8fd29884458e5c", + "reference": "3dcbd98b5d9384a5357266efba8fd29884458e5c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0,<4.5" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Barryvdh": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2016-06-13 19:28:20" + }, + { + "name": "beberlei/assert", + "version": "v2.5.1", + "source": { + "type": "git", + "url": "https://github.com/beberlei/assert.git", + "reference": "8a9ad22f1220e47a6d174843e8abef08f5eac441" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/beberlei/assert/zipball/8a9ad22f1220e47a6d174843e8abef08f5eac441", + "reference": "8a9ad22f1220e47a6d174843e8abef08f5eac441", "shasum": "" }, "require": { @@ -175,7 +227,7 @@ "assertion", "validation" ], - "time": "2016-03-22 14:34:51" + "time": "2016-06-20 12:01:28" }, { "name": "classpreloader/classpreloader", @@ -277,16 +329,16 @@ }, { "name": "cviebrock/laravel-elasticsearch", - "version": "1.0.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/cviebrock/laravel-elasticsearch.git", - "reference": "52aa1f8228006cb0bb60954e26c068af523bf47b" + "reference": "279478b4d287e799f3d64d8dadf79e55875c6b45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cviebrock/laravel-elasticsearch/zipball/52aa1f8228006cb0bb60954e26c068af523bf47b", - "reference": "52aa1f8228006cb0bb60954e26c068af523bf47b", + "url": "https://api.github.com/repos/cviebrock/laravel-elasticsearch/zipball/279478b4d287e799f3d64d8dadf79e55875c6b45", + "reference": "279478b4d287e799f3d64d8dadf79e55875c6b45", "shasum": "" }, "require": { @@ -315,14 +367,14 @@ "email": "brandonmartel@gmail.com" } ], - "description": "An easy way to use the official PHP ElasticSearch client in your Laravel applications", + "description": "An easy way to use the official PHP ElasticSearch client in your Laravel applications.", "keywords": [ "client", "elasticsearch", "laravel", "search" ], - "time": "2016-01-06 15:58:07" + "time": "2016-06-20 19:25:50" }, { "name": "danielstjules/stringy", @@ -884,16 +936,16 @@ }, { "name": "elasticsearch/elasticsearch", - "version": "v2.1.5", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "c1675245c0a6f789cbb80b3e0b333b9ef521a627" + "reference": "11ebdf2c847d0e2c4a47ac993485beb5a19d5dc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/c1675245c0a6f789cbb80b3e0b333b9ef521a627", - "reference": "c1675245c0a6f789cbb80b3e0b333b9ef521a627", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/11ebdf2c847d0e2c4a47ac993485beb5a19d5dc4", + "reference": "11ebdf2c847d0e2c4a47ac993485beb5a19d5dc4", "shasum": "" }, "require": { @@ -902,10 +954,10 @@ "psr/log": "~1.0" }, "require-dev": { - "athletic/athletic": "~0.1", "cpliakas/git-wrapper": "~1.0", "mockery/mockery": "0.9.4", "phpunit/phpunit": "~4.7", + "sami/sami": "~3.2", "symfony/yaml": "2.4.3 as 2.4.2", "twig/twig": "1.*" }, @@ -921,7 +973,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache 2" + "Apache-2.0" ], "authors": [ { @@ -934,7 +986,7 @@ "elasticsearch", "search" ], - "time": "2016-03-18 16:31:37" + "time": "2016-06-03 21:09:29" }, { "name": "fgrosse/phpasn1", @@ -1172,16 +1224,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "31382fef2889136415751badebbd1cb022a4ed72" + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72", - "reference": "31382fef2889136415751badebbd1cb022a4ed72", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", "shasum": "" }, "require": { @@ -1197,7 +1249,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -1226,7 +1278,7 @@ "stream", "uri" ], - "time": "2016-04-13 19:56:01" + "time": "2016-06-24 23:00:38" }, { "name": "guzzlehttp/ringphp", @@ -1662,16 +1714,16 @@ }, { "name": "laravel/framework", - "version": "v5.1.36", + "version": "v5.1.40", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "5945837bc61227f21530c8c4455de0842dc18c9a" + "reference": "555269ee07cfe4e966ad16b394c89fa0b586d8b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/5945837bc61227f21530c8c4455de0842dc18c9a", - "reference": "5945837bc61227f21530c8c4455de0842dc18c9a", + "url": "https://api.github.com/repos/laravel/framework/zipball/555269ee07cfe4e966ad16b394c89fa0b586d8b0", + "reference": "555269ee07cfe4e966ad16b394c89fa0b586d8b0", "shasum": "" }, "require": { @@ -1787,20 +1839,20 @@ "framework", "laravel" ], - "time": "2016-05-26 14:23:48" + "time": "2016-06-17 19:23:17" }, { "name": "league/flysystem", - "version": "1.0.22", + "version": "1.0.24", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "bd73a91703969a2d20ab4bfbf971d6c2cbe36612" + "reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/bd73a91703969a2d20ab4bfbf971d6c2cbe36612", - "reference": "bd73a91703969a2d20ab4bfbf971d6c2cbe36612", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9aca859a303fdca30370f42b8c611d9cf0dedf4b", + "reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b", "shasum": "" }, "require": { @@ -1870,7 +1922,7 @@ "sftp", "storage" ], - "time": "2016-04-28 06:53:12" + "time": "2016-06-03 19:11:39" }, { "name": "maximebf/debugbar", @@ -1935,16 +1987,16 @@ }, { "name": "mdanter/ecc", - "version": "v0.3.0", + "version": "v0.3.1", "source": { "type": "git", "url": "https://github.com/phpecc/phpecc.git", - "reference": "8b588fc094ba743d8f8c84980bcc6b470c4baed7" + "reference": "182d94bc3bbeee6a8591bde36e66a80d8b07ae4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpecc/phpecc/zipball/8b588fc094ba743d8f8c84980bcc6b470c4baed7", - "reference": "8b588fc094ba743d8f8c84980bcc6b470c4baed7", + "url": "https://api.github.com/repos/phpecc/phpecc/zipball/182d94bc3bbeee6a8591bde36e66a80d8b07ae4b", + "reference": "182d94bc3bbeee6a8591bde36e66a80d8b07ae4b", "shasum": "" }, "require": { @@ -2363,67 +2415,18 @@ ], "time": "2015-08-07 21:42:41" }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2015-02-03 12:10:50" - }, { "name": "predis/predis", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/nrk/predis.git", - "reference": "0e17edbefb50c6cbd1acc4a6f6ef06399deb1af2" + "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nrk/predis/zipball/0e17edbefb50c6cbd1acc4a6f6ef06399deb1af2", - "reference": "0e17edbefb50c6cbd1acc4a6f6ef06399deb1af2", + "url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1", + "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1", "shasum": "" }, "require": { @@ -2460,7 +2463,7 @@ "predis", "redis" ], - "time": "2016-06-01 22:06:21" + "time": "2016-06-16 16:22:20" }, { "name": "psr/http-message", @@ -2829,7 +2832,7 @@ }, { "name": "symfony/class-loader", - "version": "v3.1.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", @@ -2885,16 +2888,16 @@ }, { "name": "symfony/console", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dfb9d26a4dd62fc9389c42196cf4a087400948b8" + "reference": "1db9bfd331383f3ba0b3c2f54da418df68c867c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dfb9d26a4dd62fc9389c42196cf4a087400948b8", - "reference": "dfb9d26a4dd62fc9389c42196cf4a087400948b8", + "url": "https://api.github.com/repos/symfony/console/zipball/1db9bfd331383f3ba0b3c2f54da418df68c867c4", + "reference": "1db9bfd331383f3ba0b3c2f54da418df68c867c4", "shasum": "" }, "require": { @@ -2940,20 +2943,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-04-20 06:32:07" + "time": "2016-06-06 14:41:06" }, { "name": "symfony/css-selector", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b6e5e9087ed7affbd4c38948da8f93513a87de43" + "reference": "d255e420795234173c0b9c9dff3cde5a82b0a108" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b6e5e9087ed7affbd4c38948da8f93513a87de43", - "reference": "b6e5e9087ed7affbd4c38948da8f93513a87de43", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/d255e420795234173c0b9c9dff3cde5a82b0a108", + "reference": "d255e420795234173c0b9c9dff3cde5a82b0a108", "shasum": "" }, "require": { @@ -2993,20 +2996,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2016-03-04 07:52:28" + "time": "2016-06-06 11:03:51" }, { "name": "symfony/debug", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "3b97c83b471d49c3d1187d67b501d1e703ee3928" + "reference": "00f654c530e5e6f6d3d444e2a70f9cf6608edb5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/3b97c83b471d49c3d1187d67b501d1e703ee3928", - "reference": "3b97c83b471d49c3d1187d67b501d1e703ee3928", + "url": "https://api.github.com/repos/symfony/debug/zipball/00f654c530e5e6f6d3d444e2a70f9cf6608edb5f", + "reference": "00f654c530e5e6f6d3d444e2a70f9cf6608edb5f", "shasum": "" }, "require": { @@ -3050,11 +3053,11 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-03-30 09:14:15" + "time": "2016-06-06 11:49:15" }, { "name": "symfony/dom-crawler", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -3109,16 +3112,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.6", + "version": "v2.8.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a158f13992a3147d466af7a23b564ac719a4ddd8" + "reference": "2a6b8713f8bdb582058cfda463527f195b066110" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a158f13992a3147d466af7a23b564ac719a4ddd8", - "reference": "a158f13992a3147d466af7a23b564ac719a4ddd8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2a6b8713f8bdb582058cfda463527f195b066110", + "reference": "2a6b8713f8bdb582058cfda463527f195b066110", "shasum": "" }, "require": { @@ -3165,20 +3168,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-05-03 18:59:18" + "time": "2016-06-06 11:11:27" }, { "name": "symfony/finder", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0bacc7c9fc1905cfce20212633013a5b300dce52" + "reference": "5795f68a72b7c7a11cc4e6dc4214663473b44857" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0bacc7c9fc1905cfce20212633013a5b300dce52", - "reference": "0bacc7c9fc1905cfce20212633013a5b300dce52", + "url": "https://api.github.com/repos/symfony/finder/zipball/5795f68a72b7c7a11cc4e6dc4214663473b44857", + "reference": "5795f68a72b7c7a11cc4e6dc4214663473b44857", "shasum": "" }, "require": { @@ -3214,20 +3217,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-03-10 10:49:29" + "time": "2016-06-06 11:03:51" }, { "name": "symfony/http-foundation", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "dea1508c965603051e359f2a5f8b7d923ba358fb" + "reference": "5d4e7461f0856a96bdceefc311d8cb8d50740627" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/dea1508c965603051e359f2a5f8b7d923ba358fb", - "reference": "dea1508c965603051e359f2a5f8b7d923ba358fb", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5d4e7461f0856a96bdceefc311d8cb8d50740627", + "reference": "5d4e7461f0856a96bdceefc311d8cb8d50740627", "shasum": "" }, "require": { @@ -3270,20 +3273,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2016-04-05 16:36:43" + "time": "2016-06-06 11:03:51" }, { "name": "symfony/http-kernel", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "e4f13b59323ca66c8a7cad46fcb7a4ac99e9e823" + "reference": "99abc1b5d2718d2e92bee6052dd143db84947c55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/e4f13b59323ca66c8a7cad46fcb7a4ac99e9e823", - "reference": "e4f13b59323ca66c8a7cad46fcb7a4ac99e9e823", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/99abc1b5d2718d2e92bee6052dd143db84947c55", + "reference": "99abc1b5d2718d2e92bee6052dd143db84947c55", "shasum": "" }, "require": { @@ -3352,7 +3355,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2016-05-09 20:35:33" + "time": "2016-06-06 15:23:26" }, { "name": "symfony/polyfill-mbstring", @@ -3523,16 +3526,16 @@ }, { "name": "symfony/process", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "a49e4c67a6a52e9c5bce1f28d9ea8618f36a43d0" + "reference": "86de601a573faa104df1e0166d4afd9a7646173a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/a49e4c67a6a52e9c5bce1f28d9ea8618f36a43d0", - "reference": "a49e4c67a6a52e9c5bce1f28d9ea8618f36a43d0", + "url": "https://api.github.com/repos/symfony/process/zipball/86de601a573faa104df1e0166d4afd9a7646173a", + "reference": "86de601a573faa104df1e0166d4afd9a7646173a", "shasum": "" }, "require": { @@ -3568,20 +3571,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-04-12 11:52:58" + "time": "2016-06-06 11:03:51" }, { "name": "symfony/routing", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "07c44ac73b42f7c6123fc024ccab03a36e87a2cc" + "reference": "ad60d48d322ad87a1dcce40b38a611b0f6709909" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/07c44ac73b42f7c6123fc024ccab03a36e87a2cc", - "reference": "07c44ac73b42f7c6123fc024ccab03a36e87a2cc", + "url": "https://api.github.com/repos/symfony/routing/zipball/ad60d48d322ad87a1dcce40b38a611b0f6709909", + "reference": "ad60d48d322ad87a1dcce40b38a611b0f6709909", "shasum": "" }, "require": { @@ -3642,20 +3645,20 @@ "uri", "url" ], - "time": "2016-04-28 10:50:58" + "time": "2016-05-30 06:56:59" }, { "name": "symfony/translation", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e75d88c9af3c9c06341f4dad7ce776c9bddf94de" + "reference": "8c8d47680768735fe7297a846cdc5d63c941130c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e75d88c9af3c9c06341f4dad7ce776c9bddf94de", - "reference": "e75d88c9af3c9c06341f4dad7ce776c9bddf94de", + "url": "https://api.github.com/repos/symfony/translation/zipball/8c8d47680768735fe7297a846cdc5d63c941130c", + "reference": "8c8d47680768735fe7297a846cdc5d63c941130c", "shasum": "" }, "require": { @@ -3705,20 +3708,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2016-03-24 09:06:43" + "time": "2016-06-06 11:03:51" }, { "name": "symfony/var-dumper", - "version": "v2.7.13", + "version": "v2.7.14", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "3e5b8bad0b94e3c59089048f214aec8814c174cc" + "reference": "121aea605a5db457a179a45eda79e136cde2f66c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3e5b8bad0b94e3c59089048f214aec8814c174cc", - "reference": "3e5b8bad0b94e3c59089048f214aec8814c174cc", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/121aea605a5db457a179a45eda79e136cde2f66c", + "reference": "121aea605a5db457a179a45eda79e136cde2f66c", "shasum": "" }, "require": { @@ -3764,7 +3767,7 @@ "debug", "dump" ], - "time": "2016-04-22 12:44:08" + "time": "2016-05-19 13:58:47" }, { "name": "venturecraft/revisionable", @@ -4134,6 +4137,152 @@ ], "time": "2016-05-22 21:52:33" }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-06-10 09:48:41" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-06-10 07:14:17" + }, { "name": "phpspec/php-diff", "version": "v1.0.2", @@ -4248,32 +4397,32 @@ }, { "name": "phpspec/prophecy", - "version": "v1.6.0", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", - "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1", - "sebastian/recursion-context": "~1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -4306,7 +4455,7 @@ "spy", "stub" ], - "time": "2016-02-15 07:46:21" + "time": "2016-06-07 08:13:47" }, { "name": "phpunit/php-code-coverage", @@ -4847,16 +4996,16 @@ }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { @@ -4864,12 +5013,13 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -4909,7 +5059,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2016-06-17 09:04:28" }, { "name": "sebastian/global-state", @@ -5052,16 +5202,16 @@ }, { "name": "symfony/yaml", - "version": "v3.1.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a" + "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", - "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c5a7e7fc273c758b92b85dcb9c46149ccda89623", + "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623", "shasum": "" }, "require": { @@ -5097,7 +5247,56 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-05-26 21:46:24" + "time": "2016-06-14 11:18:07" + }, + { + "name": "webmozart/assert", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2015-08-24 13:29:44" } ], "aliases": [], diff --git a/config/database.php b/config/database.php index b71c5e30..9088f5a3 100644 --- a/config/database.php +++ b/config/database.php @@ -26,7 +26,8 @@ return [ | */ - 'default' => env('DB_CONNECTION', 'mysql'), + //'mysql' => env('DB_CONNECTION', 'mysql'), + 'default' => env('DB_CONNECTION', 'pgsql'), /* |-------------------------------------------------------------------------- @@ -72,10 +73,10 @@ return [ 'pgsql' => [ 'driver' => 'pgsql', - 'host' => env('DB_HOST', 'localhost'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), + 'host' => env('POSTGRESQL_DB_HOST', 'localhost'), + 'database' => env('POSTGRESQL_DB_DATABASE', 'homestead'), + 'username' => env('POSTGRESQL_DB_USERNAME', 'homestead'), + 'password' => env('POSTGRESQL_DB_PASSWORD', 'secret'), 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public', diff --git a/database/after-import.sql b/database/after-import.sql new file mode 100644 index 00000000..2d4c5e1d --- /dev/null +++ b/database/after-import.sql @@ -0,0 +1,38 @@ +ALTER TABLE users ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone, ALTER bio SET DEFAULT ''; + +ALTER TABLE tracks ALTER created_at TYPE timestamp(0) without time zone, +ALTER updated_at TYPE timestamp(0) without time zone, +ALTER deleted_at TYPE timestamp(0) without time zone, +ALTER published_at TYPE timestamp(0) without time zone, +ALTER released_at TYPE timestamp(0) without time zone, +ALTER license_id DROP NOT NULL, +ALTER genre_id DROP NOT NULL, +ALTER track_type_id DROP NOT NULL, +ALTER description DROP NOT NULL, +ALTER lyrics DROP NOT NULL, +ALTER cover_id DROP NOT NULL, +ALTER album_id DROP NOT NULL, +ALTER track_number DROP NOT NULL, +ALTER hash DROP NOT NULL, +ALTER metadata DROP NOT NULL, +ALTER original_tags DROP NOT NULL, +ALTER is_vocal SET DEFAULT false, +ALTER is_explicit SET DEFAULT false, +ALTER is_downloadable SET DEFAULT false, +ALTER view_count SET DEFAULT 0, +ALTER play_count SET DEFAULT 0, +ALTER download_count SET DEFAULT 0, +ALTER favourite_count SET DEFAULT 0, +ALTER comment_count SET DEFAULT 0, +ALTER is_latest SET DEFAULT false, +ALTER is_listed SET DEFAULT true; + +ALTER TABLE track_files ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone; +ALTER TABLE images ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone; +ALTER TABLE genres ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone; +ALTER TABLE resource_users ALTER is_followed SET DEFAULT false, ALTER is_favourited SET DEFAULT false, ALTER is_pinned SET DEFAULT false, ALTER view_count SET DEFAULT 0, ALTER play_count SET DEFAULT 0, ALTER download_count SET DEFAULT 0; +ALTER TABLE comments ALTER ip_address DROP NOT NULL, ALTER profile_id DROP NOT NULL, ALTER track_id DROP NOT NULL, ALTER album_id DROP NOT NULL, ALTER playlist_id DROP NOT NULL, ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone, ALTER deleted_at TYPE timestamp(0) without time zone; +ALTER TABLE playlists ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone, ALTER deleted_at TYPE timestamp(0) without time zone, ALTER track_count SET DEFAULT 0, ALTER view_count SET DEFAULT 0, ALTER download_count SET DEFAULT 0, ALTER favourite_count SET DEFAULT 0, ALTER follow_count SET DEFAULT 0, ALTER comment_count SET DEFAULT 0; +ALTER TABLE playlist_track ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone; +ALTER TABLE albums ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone, ALTER deleted_at TYPE timestamp(0) without time zone; +ALTER TABLE show_songs ALTER created_at TYPE timestamp(0) without time zone, ALTER updated_at TYPE timestamp(0) without time zone, ALTER deleted_at TYPE timestamp(0) without time zone; diff --git a/database/migrations/2013_06_07_003952_create_users_table.php b/database/legacy_migrations/2013_06_07_003952_create_users_table.php similarity index 100% rename from database/migrations/2013_06_07_003952_create_users_table.php rename to database/legacy_migrations/2013_06_07_003952_create_users_table.php diff --git a/database/migrations/2013_06_27_015259_create_tracks_table.php b/database/legacy_migrations/2013_06_27_015259_create_tracks_table.php similarity index 100% rename from database/migrations/2013_06_27_015259_create_tracks_table.php rename to database/legacy_migrations/2013_06_27_015259_create_tracks_table.php diff --git a/database/migrations/2013_07_26_230827_create_images_table.php b/database/legacy_migrations/2013_07_26_230827_create_images_table.php similarity index 100% rename from database/migrations/2013_07_26_230827_create_images_table.php rename to database/legacy_migrations/2013_07_26_230827_create_images_table.php diff --git a/database/migrations/2013_07_28_034328_create_songs_table.php b/database/legacy_migrations/2013_07_28_034328_create_songs_table.php similarity index 100% rename from database/migrations/2013_07_28_034328_create_songs_table.php rename to database/legacy_migrations/2013_07_28_034328_create_songs_table.php diff --git a/database/migrations/2013_07_28_060804_create_albums.php b/database/legacy_migrations/2013_07_28_060804_create_albums.php similarity index 100% rename from database/migrations/2013_07_28_060804_create_albums.php rename to database/legacy_migrations/2013_07_28_060804_create_albums.php diff --git a/database/migrations/2013_07_28_135136_create_playlists.php b/database/legacy_migrations/2013_07_28_135136_create_playlists.php similarity index 100% rename from database/migrations/2013_07_28_135136_create_playlists.php rename to database/legacy_migrations/2013_07_28_135136_create_playlists.php diff --git a/database/migrations/2013_08_01_051337_create_comments.php b/database/legacy_migrations/2013_08_01_051337_create_comments.php similarity index 100% rename from database/migrations/2013_08_01_051337_create_comments.php rename to database/legacy_migrations/2013_08_01_051337_create_comments.php diff --git a/database/migrations/2013_08_18_041928_create_user_tables.php b/database/legacy_migrations/2013_08_18_041928_create_user_tables.php similarity index 100% rename from database/migrations/2013_08_18_041928_create_user_tables.php rename to database/legacy_migrations/2013_08_18_041928_create_user_tables.php diff --git a/database/migrations/2013_08_18_045248_create_favourites.php b/database/legacy_migrations/2013_08_18_045248_create_favourites.php similarity index 100% rename from database/migrations/2013_08_18_045248_create_favourites.php rename to database/legacy_migrations/2013_08_18_045248_create_favourites.php diff --git a/database/migrations/2013_08_29_025516_create_followers.php b/database/legacy_migrations/2013_08_29_025516_create_followers.php similarity index 100% rename from database/migrations/2013_08_29_025516_create_followers.php rename to database/legacy_migrations/2013_08_29_025516_create_followers.php diff --git a/database/migrations/2013_09_01_025031_oauth.php b/database/legacy_migrations/2013_09_01_025031_oauth.php similarity index 100% rename from database/migrations/2013_09_01_025031_oauth.php rename to database/legacy_migrations/2013_09_01_025031_oauth.php diff --git a/database/migrations/2013_09_01_232520_create_news_table.php b/database/legacy_migrations/2013_09_01_232520_create_news_table.php similarity index 100% rename from database/migrations/2013_09_01_232520_create_news_table.php rename to database/legacy_migrations/2013_09_01_232520_create_news_table.php diff --git a/database/migrations/2013_09_10_014644_create_latest_column.php b/database/legacy_migrations/2013_09_10_014644_create_latest_column.php similarity index 100% rename from database/migrations/2013_09_10_014644_create_latest_column.php rename to database/legacy_migrations/2013_09_10_014644_create_latest_column.php diff --git a/database/migrations/2013_09_23_031316_create_track_hashes.php b/database/legacy_migrations/2013_09_23_031316_create_track_hashes.php similarity index 100% rename from database/migrations/2013_09_23_031316_create_track_hashes.php rename to database/legacy_migrations/2013_09_23_031316_create_track_hashes.php diff --git a/database/migrations/2013_09_24_055911_track_is_listed.php b/database/legacy_migrations/2013_09_24_055911_track_is_listed.php similarity index 100% rename from database/migrations/2013_09_24_055911_track_is_listed.php rename to database/legacy_migrations/2013_09_24_055911_track_is_listed.php diff --git a/database/migrations/2014_05_28_071738_update_track_hash.php b/database/legacy_migrations/2014_05_28_071738_update_track_hash.php similarity index 100% rename from database/migrations/2014_05_28_071738_update_track_hash.php rename to database/legacy_migrations/2014_05_28_071738_update_track_hash.php diff --git a/database/migrations/2015_04_30_064436_add_remember_me_field.php b/database/legacy_migrations/2015_04_30_064436_add_remember_me_field.php similarity index 100% rename from database/migrations/2015_04_30_064436_add_remember_me_field.php rename to database/legacy_migrations/2015_04_30_064436_add_remember_me_field.php diff --git a/database/migrations/2015_05_20_155236_add_archived_profile_field.php b/database/legacy_migrations/2015_05_20_155236_add_archived_profile_field.php similarity index 100% rename from database/migrations/2015_05_20_155236_add_archived_profile_field.php rename to database/legacy_migrations/2015_05_20_155236_add_archived_profile_field.php diff --git a/database/migrations/2015_05_25_011121_create_track_files_table.php b/database/legacy_migrations/2015_05_25_011121_create_track_files_table.php similarity index 100% rename from database/migrations/2015_05_25_011121_create_track_files_table.php rename to database/legacy_migrations/2015_05_25_011121_create_track_files_table.php diff --git a/database/migrations/2015_09_04_160648_make_email_nullable.php b/database/legacy_migrations/2015_09_04_160648_make_email_nullable.php similarity index 100% rename from database/migrations/2015_09_04_160648_make_email_nullable.php rename to database/legacy_migrations/2015_09_04_160648_make_email_nullable.php diff --git a/database/migrations/2015_09_05_113647_add_new_indices.php b/database/legacy_migrations/2015_09_05_113647_add_new_indices.php similarity index 100% rename from database/migrations/2015_09_05_113647_add_new_indices.php rename to database/legacy_migrations/2015_09_05_113647_add_new_indices.php diff --git a/database/migrations/2015_09_05_143300_create_mlpma_table.php b/database/legacy_migrations/2015_09_05_143300_create_mlpma_table.php similarity index 100% rename from database/migrations/2015_09_05_143300_create_mlpma_table.php rename to database/legacy_migrations/2015_09_05_143300_create_mlpma_table.php diff --git a/database/migrations/2015_09_12_225021_create_session_table.php b/database/legacy_migrations/2015_09_12_225021_create_session_table.php similarity index 100% rename from database/migrations/2015_09_12_225021_create_session_table.php rename to database/legacy_migrations/2015_09_12_225021_create_session_table.php diff --git a/database/migrations/2015_09_29_035228_AddAlphabeticalIndices.php b/database/legacy_migrations/2015_09_29_035228_AddAlphabeticalIndices.php similarity index 100% rename from database/migrations/2015_09_29_035228_AddAlphabeticalIndices.php rename to database/legacy_migrations/2015_09_29_035228_AddAlphabeticalIndices.php diff --git a/database/migrations/2015_10_26_192855_update_track_files_with_cache.php b/database/legacy_migrations/2015_10_26_192855_update_track_files_with_cache.php similarity index 100% rename from database/migrations/2015_10_26_192855_update_track_files_with_cache.php rename to database/legacy_migrations/2015_10_26_192855_update_track_files_with_cache.php diff --git a/database/migrations/2015_10_26_231224_AddTrackSourceColumn.php b/database/legacy_migrations/2015_10_26_231224_AddTrackSourceColumn.php similarity index 100% rename from database/migrations/2015_10_26_231224_AddTrackSourceColumn.php rename to database/legacy_migrations/2015_10_26_231224_AddTrackSourceColumn.php diff --git a/database/migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php b/database/legacy_migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php similarity index 100% rename from database/migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php rename to database/legacy_migrations/2015_10_28_162655_AddTrackFilesForDeletedTracks.php diff --git a/database/migrations/2015_10_29_153827_update_track_files_with_filesize.php b/database/legacy_migrations/2015_10_29_153827_update_track_files_with_filesize.php similarity index 100% rename from database/migrations/2015_10_29_153827_update_track_files_with_filesize.php rename to database/legacy_migrations/2015_10_29_153827_update_track_files_with_filesize.php diff --git a/database/migrations/2015_11_05_004145_AddUnclassifiedTrackType.php b/database/legacy_migrations/2015_11_05_004145_AddUnclassifiedTrackType.php similarity index 100% rename from database/migrations/2015_11_05_004145_AddUnclassifiedTrackType.php rename to database/legacy_migrations/2015_11_05_004145_AddUnclassifiedTrackType.php diff --git a/database/migrations/2015_11_21_020332_RenameUsernameAndIndexIsArchived.php b/database/legacy_migrations/2015_11_21_020332_RenameUsernameAndIndexIsArchived.php similarity index 100% rename from database/migrations/2015_11_21_020332_RenameUsernameAndIndexIsArchived.php rename to database/legacy_migrations/2015_11_21_020332_RenameUsernameAndIndexIsArchived.php diff --git a/database/migrations/2015_11_24_025733_create_revisions_table.php b/database/legacy_migrations/2015_11_24_025733_create_revisions_table.php similarity index 100% rename from database/migrations/2015_11_24_025733_create_revisions_table.php rename to database/legacy_migrations/2015_11_24_025733_create_revisions_table.php diff --git a/database/migrations/2015_11_24_182326_AddDeletedAtColumnToGenres.php b/database/legacy_migrations/2015_11_24_182326_AddDeletedAtColumnToGenres.php similarity index 100% rename from database/migrations/2015_11_24_182326_AddDeletedAtColumnToGenres.php rename to database/legacy_migrations/2015_11_24_182326_AddDeletedAtColumnToGenres.php diff --git a/database/migrations/2015_12_05_235108_create_failed_jobs_table.php b/database/legacy_migrations/2015_12_05_235108_create_failed_jobs_table.php similarity index 100% rename from database/migrations/2015_12_05_235108_create_failed_jobs_table.php rename to database/legacy_migrations/2015_12_05_235108_create_failed_jobs_table.php diff --git a/database/migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php b/database/legacy_migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php similarity index 100% rename from database/migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php rename to database/legacy_migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php diff --git a/database/migrations/2015_12_24_151903_add_sensible_defaults.php b/database/legacy_migrations/2015_12_24_151903_add_sensible_defaults.php similarity index 100% rename from database/migrations/2015_12_24_151903_add_sensible_defaults.php rename to database/legacy_migrations/2015_12_24_151903_add_sensible_defaults.php diff --git a/database/migrations/2015_12_25_154727_add_more_defaults.php b/database/legacy_migrations/2015_12_25_154727_add_more_defaults.php similarity index 100% rename from database/migrations/2015_12_25_154727_add_more_defaults.php rename to database/legacy_migrations/2015_12_25_154727_add_more_defaults.php diff --git a/database/migrations/2015_12_25_155223_add_metadata_columns.php b/database/legacy_migrations/2015_12_25_155223_add_metadata_columns.php similarity index 100% rename from database/migrations/2015_12_25_155223_add_metadata_columns.php rename to database/legacy_migrations/2015_12_25_155223_add_metadata_columns.php diff --git a/database/migrations/2015_12_29_152005_add_account_disabled_column.php b/database/legacy_migrations/2015_12_29_152005_add_account_disabled_column.php similarity index 100% rename from database/migrations/2015_12_29_152005_add_account_disabled_column.php rename to database/legacy_migrations/2015_12_29_152005_add_account_disabled_column.php diff --git a/database/migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php b/database/legacy_migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php similarity index 100% rename from database/migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php rename to database/legacy_migrations/2016_01_01_001340_update_model_namespaces_in_revisions.php diff --git a/database/migrations/2016_01_06_123513_add_genre_timestamps.php b/database/legacy_migrations/2016_01_06_123513_add_genre_timestamps.php similarity index 100% rename from database/migrations/2016_01_06_123513_add_genre_timestamps.php rename to database/legacy_migrations/2016_01_06_123513_add_genre_timestamps.php diff --git a/database/migrations/2016_01_14_021607_setup_elasticsearch.php b/database/legacy_migrations/2016_01_14_021607_setup_elasticsearch.php similarity index 100% rename from database/migrations/2016_01_14_021607_setup_elasticsearch.php rename to database/legacy_migrations/2016_01_14_021607_setup_elasticsearch.php diff --git a/database/migrations/2016_01_23_062640_EnforceUniqueTracksInPlaylists.php b/database/legacy_migrations/2016_01_23_062640_EnforceUniqueTracksInPlaylists.php similarity index 100% rename from database/migrations/2016_01_23_062640_EnforceUniqueTracksInPlaylists.php rename to database/legacy_migrations/2016_01_23_062640_EnforceUniqueTracksInPlaylists.php diff --git a/database/migrations/2016_04_06_152844_create_notifications_tables.php b/database/legacy_migrations/2016_04_06_152844_create_notifications_tables.php similarity index 100% rename from database/migrations/2016_04_06_152844_create_notifications_tables.php rename to database/legacy_migrations/2016_04_06_152844_create_notifications_tables.php diff --git a/database/migrations/2016_06_05_193032_enforce_unique_slugs.php b/database/legacy_migrations/2016_06_05_193032_enforce_unique_slugs.php similarity index 100% rename from database/migrations/2016_06_05_193032_enforce_unique_slugs.php rename to database/legacy_migrations/2016_06_05_193032_enforce_unique_slugs.php diff --git a/database/migrations/2016_06_05_221208_add_timestamps_to_show_songs.php b/database/legacy_migrations/2016_06_05_221208_add_timestamps_to_show_songs.php similarity index 100% rename from database/migrations/2016_06_05_221208_add_timestamps_to_show_songs.php rename to database/legacy_migrations/2016_06_05_221208_add_timestamps_to_show_songs.php diff --git a/database/migrations/2016_06_10_010314_create_subscription_table.php b/database/legacy_migrations/2016_06_10_010314_create_subscription_table.php similarity index 100% rename from database/migrations/2016_06_10_010314_create_subscription_table.php rename to database/legacy_migrations/2016_06_10_010314_create_subscription_table.php diff --git a/database/migrations/2016_06_15_075023_fix_cache_table.php b/database/legacy_migrations/2016_06_15_075023_fix_cache_table.php similarity index 100% rename from database/migrations/2016_06_15_075023_fix_cache_table.php rename to database/legacy_migrations/2016_06_15_075023_fix_cache_table.php diff --git a/database/migrations/2016_06_15_080045_fix_cache_table_2.php b/database/legacy_migrations/2016_06_15_080045_fix_cache_table_2.php similarity index 100% rename from database/migrations/2016_06_15_080045_fix_cache_table_2.php rename to database/legacy_migrations/2016_06_15_080045_fix_cache_table_2.php diff --git a/database/migrations/2016_06_26_225535_create_activities_table.php b/database/migrations/2016_06_26_225535_create_activities_table.php new file mode 100644 index 00000000..3fb6943c --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_activities_table.php @@ -0,0 +1,37 @@ +bigInteger('id', true)->unsigned(); + $table->dateTime('created_at')->index(); + $table->integer('user_id')->unsigned(); + $table->unsignedTinyInteger('activity_type'); + $table->unsignedTinyInteger('resource_type'); + $table->integer('resource_id')->unsigned(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('activities'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_albums_table.php b/database/migrations/2016_06_26_225535_create_albums_table.php new file mode 100644 index 00000000..1a62ad78 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_albums_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index('albums_user_id_foreign'); + $table->string('title')->index(); + $table->string('slug')->index(); + $table->text('description', 65535); + $table->integer('cover_id')->unsigned()->nullable()->index('albums_cover_id_foreign'); + $table->integer('track_count')->unsigned()->default(0); + $table->integer('view_count')->unsigned()->default(0); + $table->integer('download_count')->unsigned()->default(0); + $table->integer('favourite_count')->unsigned()->default(0); + $table->integer('comment_count')->unsigned()->default(0); + $table->timestamps(); + $table->softDeletes()->index(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('albums'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_cache_table.php b/database/migrations/2016_06_26_225535_create_cache_table.php new file mode 100644 index 00000000..af8bb77f --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_cache_table.php @@ -0,0 +1,34 @@ +string('key')->index(); + $table->text('value', 65535); + $table->integer('expiration')->unsigned()->index(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('cache'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_comments_table.php b/database/migrations/2016_06_26_225535_create_comments_table.php new file mode 100644 index 00000000..cc93f9ca --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_comments_table.php @@ -0,0 +1,41 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index('comments_user_id_foreign'); + $table->string('ip_address', 46)->nullable(); + $table->text('content', 65535); + $table->timestamps(); + $table->softDeletes()->index(); + $table->integer('profile_id')->unsigned()->nullable()->index(); + $table->integer('track_id')->unsigned()->nullable()->index(); + $table->integer('album_id')->unsigned()->nullable()->index(); + $table->integer('playlist_id')->unsigned()->nullable()->index(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('comments'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_failed_jobs_table_2.php b/database/migrations/2016_06_26_225535_create_failed_jobs_table_2.php new file mode 100644 index 00000000..cf73737d --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_failed_jobs_table_2.php @@ -0,0 +1,41 @@ +increments('id'); + $table->text('connection', 65535); + $table->text('queue', 65535); + $table->text('payload'); + $table->dateTime('failed_at')->default('now()'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('failed_jobs'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_favourites_table.php b/database/migrations/2016_06_26_225535_create_favourites_table.php new file mode 100644 index 00000000..7adadee3 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_favourites_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index(); + $table->integer('track_id')->unsigned()->nullable()->index(); + $table->integer('album_id')->unsigned()->nullable()->index(); + $table->integer('playlist_id')->unsigned()->nullable()->index(); + $table->dateTime('created_at')->default('now()')->nullable(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('favourites'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_followers_table.php b/database/migrations/2016_06_26_225535_create_followers_table.php new file mode 100644 index 00000000..48596cff --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_followers_table.php @@ -0,0 +1,36 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index(); + $table->integer('artist_id')->unsigned()->nullable()->index(); + $table->integer('playlist_id')->unsigned()->nullable()->index(); + $table->dateTime('created_at')->default('now()')->nullable(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('followers'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_genres_table.php b/database/migrations/2016_06_26_225535_create_genres_table.php new file mode 100644 index 00000000..dcf2da07 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_genres_table.php @@ -0,0 +1,36 @@ +increments('id'); + $table->string('name')->unique(); + $table->string('slug', 200)->index(); + $table->softDeletes()->index(); + $table->nullableTimestamps(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('genres'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_images_table_2.php b/database/migrations/2016_06_26_225535_create_images_table_2.php new file mode 100644 index 00000000..692177e1 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_images_table_2.php @@ -0,0 +1,44 @@ +increments('id'); + $table->string('filename', 256); + $table->string('mime', 100); + $table->string('extension', 32); + $table->unsignedInteger('size'); + $table->string('hash', 32)->index(); + $table->unsignedInteger('uploaded_by')->index(); + $table->timestamps(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('images'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_licenses_table.php b/database/migrations/2016_06_26_225535_create_licenses_table.php new file mode 100644 index 00000000..f929562b --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_licenses_table.php @@ -0,0 +1,73 @@ +increments('id'); + $table->string('title', 100); + $table->text('description', 65535); + $table->boolean('affiliate_distribution'); + $table->boolean('open_distribution'); + $table->boolean('remix'); + }); + + DB::table('licenses')->insert([ + 'id' => 1, + 'title' => 'Personal', + 'description' => 'Only you and Pony.fm are allowed to distribute and broadcast the track.', + 'affiliate_distribution' => 0, + 'open_distribution' => 0, + 'remix' => 0 + ]); + + DB::table('licenses')->insert([ + 'id' => 2, + 'title' => 'Broadcast', + 'description' => 'You, Pony.fm, and its affiliates may distribute and broadcast the track.', + 'affiliate_distribution' => 1, + 'open_distribution' => 0, + 'remix' => 0 + ]); + + DB::table('licenses')->insert([ + 'id' => 3, + 'title' => 'Open', + 'description' => 'Anyone is permitted to broadcast and distribute the song in its original form, with attribution to you.', + 'affiliate_distribution' => 1, + 'open_distribution' => 1, + 'remix' => 0 + ]); + + DB::table('licenses')->insert([ + 'id' => 4, + '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.', + 'affiliate_distribution' => 1, + 'open_distribution' => 1, + 'remix' => 1 + ]); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('licenses'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_mlpma_tracks_table.php b/database/migrations/2016_06_26_225535_create_mlpma_tracks_table.php new file mode 100644 index 00000000..cd638e78 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_mlpma_tracks_table.php @@ -0,0 +1,39 @@ +increments('id'); + $table->integer('track_id')->unsigned()->index(); + $table->string('path')->index(); + $table->string('filename')->index(); + $table->string('extension')->index(); + $table->dateTime('imported_at'); + $table->text('parsed_tags'); + $table->text('raw_tags'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('mlpma_tracks'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_news_table_2.php b/database/migrations/2016_06_26_225535_create_news_table_2.php new file mode 100644 index 00000000..c0e5c874 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_news_table_2.php @@ -0,0 +1,40 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index(); + $table->string('post_hash', 32)->index(); + $table->timestamps(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('news'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_notifications_table.php b/database/migrations/2016_06_26_225535_create_notifications_table.php new file mode 100644 index 00000000..93f0c384 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_notifications_table.php @@ -0,0 +1,35 @@ +bigInteger('id', true)->unsigned(); + $table->bigInteger('activity_id')->unsigned()->index(); + $table->integer('user_id')->unsigned()->index(); + $table->boolean('is_read')->default(false)->index(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('notifications'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_oauth2_tokens_table.php b/database/migrations/2016_06_26_225535_create_oauth2_tokens_table.php new file mode 100644 index 00000000..1e4dc91c --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_oauth2_tokens_table.php @@ -0,0 +1,39 @@ +increments('id'); + $table->integer('user_id')->unsigned(); + $table->integer('external_user_id')->unsigned(); + $table->text('access_token', 65535); + $table->dateTime('expires')->default('now()'); + $table->text('refresh_token', 65535); + $table->string('type'); + $table->string('service'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('oauth2_tokens'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_pinned_playlists_table.php b/database/migrations/2016_06_26_225535_create_pinned_playlists_table.php new file mode 100644 index 00000000..14beeddf --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_pinned_playlists_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index(); + $table->integer('playlist_id')->unsigned()->index(); + $table->timestamps(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('pinned_playlists'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_playlist_track_table.php b/database/migrations/2016_06_26_225535_create_playlist_track_table.php new file mode 100644 index 00000000..ba4e8274 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_playlist_track_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->timestamps(); + $table->integer('playlist_id')->unsigned()->index(); + $table->integer('track_id')->unsigned()->index(); + $table->integer('position')->unsigned(); + $table->unique(['playlist_id','track_id']); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('playlist_track'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_playlists_table.php b/database/migrations/2016_06_26_225535_create_playlists_table.php new file mode 100644 index 00000000..4f3382a7 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_playlists_table.php @@ -0,0 +1,45 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index(); + $table->string('title')->index(); + $table->string('slug'); + $table->text('description', 65535); + $table->boolean('is_public')->index(); + $table->integer('track_count')->unsigned()->default(0)->index(); + $table->integer('view_count')->unsigned()->default(0); + $table->integer('download_count')->unsigned()->default(0); + $table->integer('favourite_count')->unsigned()->default(0); + $table->integer('follow_count')->unsigned()->default(0); + $table->integer('comment_count')->unsigned()->default(0); + $table->timestamps(); + $table->date('deleted_at')->nullable()->index(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('playlists'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_resource_log_items_table.php b/database/migrations/2016_06_26_225535_create_resource_log_items_table.php new file mode 100644 index 00000000..5b905d61 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_resource_log_items_table.php @@ -0,0 +1,40 @@ +increments('id'); + $table->integer('user_id')->unsigned()->nullable()->index(); + $table->tinyInteger('log_type')->unsigned(); + $table->string('ip_address', 46)->index(); + $table->tinyInteger('track_format_id')->unsigned()->nullable(); + $table->integer('track_id')->unsigned()->nullable()->index(); + $table->integer('album_id')->unsigned()->nullable()->index(); + $table->integer('playlist_id')->unsigned()->nullable()->index(); + $table->dateTime('created_at')->default('now()'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('resource_log_items'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_resource_users_table.php b/database/migrations/2016_06_26_225535_create_resource_users_table.php new file mode 100644 index 00000000..45328280 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_resource_users_table.php @@ -0,0 +1,44 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index(); + $table->integer('track_id')->unsigned()->nullable()->index(); + $table->integer('album_id')->unsigned()->nullable()->index(); + $table->integer('playlist_id')->unsigned()->nullable()->index(); + $table->integer('artist_id')->unsigned()->nullable()->index(); + $table->boolean('is_followed')->default(false); + $table->boolean('is_favourited')->default(false); + $table->boolean('is_pinned')->default(false); + $table->unsignedInteger('view_count')->default(0); + $table->unsignedInteger('play_count')->default(0); + $table->unsignedInteger('download_count')->default(0); + $table->unique(['user_id','track_id','album_id','playlist_id','artist_id'], 'resource_unique'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('resource_users'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_revisions_table_2.php b/database/migrations/2016_06_26_225535_create_revisions_table_2.php new file mode 100644 index 00000000..cf4d7249 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_revisions_table_2.php @@ -0,0 +1,46 @@ +increments('id'); + $table->string('revisionable_type'); + $table->integer('revisionable_id'); + $table->unsignedInteger('user_id')->nullable(); + $table->string('key'); + $table->text('old_value', 65535)->nullable(); + $table->text('new_value', 65535)->nullable(); + $table->timestamps(); + $table->index(['revisionable_id','revisionable_type']); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('revisions'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_role_user_table.php b/database/migrations/2016_06_26_225535_create_role_user_table.php new file mode 100644 index 00000000..96db8517 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_role_user_table.php @@ -0,0 +1,35 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index(); + $table->integer('role_id')->unsigned()->index(); + $table->timestamps(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('role_user'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_roles_table.php b/database/migrations/2016_06_26_225535_create_roles_table.php new file mode 100644 index 00000000..38fa2000 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_roles_table.php @@ -0,0 +1,36 @@ +increments('id'); + $table->string('name'); + }); + + DB::table('roles')->insert(['name' => 'super_admin']); + DB::table('roles')->insert(['name' => 'admin']); + DB::table('roles')->insert(['name' => 'moderator']); + DB::table('roles')->insert(['name' => 'user']); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('roles'); + } +} diff --git a/database/migrations/2016_06_26_225535_create_sessions_table.php b/database/migrations/2016_06_26_225535_create_sessions_table.php new file mode 100644 index 00000000..f341e8d0 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_sessions_table.php @@ -0,0 +1,34 @@ +string('id')->unique(); + $table->text('payload'); + $table->integer('last_activity'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('sessions'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_show_song_track_table.php b/database/migrations/2016_06_26_225535_create_show_song_track_table.php new file mode 100644 index 00000000..f4cc9fb4 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_show_song_track_table.php @@ -0,0 +1,34 @@ +increments('id'); + $table->integer('track_id')->unsigned()->index('show_song_track_track_id_foreign'); + $table->integer('show_song_id')->unsigned()->index('show_song_track_show_song_id_foreign'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('show_song_track'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_show_songs_table.php b/database/migrations/2016_06_26_225535_create_show_songs_table.php new file mode 100644 index 00000000..a4937c64 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_show_songs_table.php @@ -0,0 +1,37 @@ +increments('id'); + $table->string('title', 100)->index('show_songs_title_fulltext'); + $table->text('lyrics', 65535); + $table->string('slug', 200); + $table->timestamps(); + $table->timestamp('deleted_at')->default(DB::raw('CURRENT_TIMESTAMP')); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('show_songs'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_subscriptions_table.php b/database/migrations/2016_06_26_225535_create_subscriptions_table.php new file mode 100644 index 00000000..b34de79d --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_subscriptions_table.php @@ -0,0 +1,37 @@ +bigInteger('id', true)->unsigned(); + $table->integer('user_id')->unsigned()->index(); + $table->string('endpoint'); + $table->string('p256dh'); + $table->string('auth'); + $table->nullableTimestamps(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('subscriptions'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_track_files_table_2.php b/database/migrations/2016_06_26_225535_create_track_files_table_2.php new file mode 100644 index 00000000..4556108d --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_track_files_table_2.php @@ -0,0 +1,45 @@ +increments('id'); + $table->integer('track_id')->unsigned()->index('track_files_track_id_foreign'); + $table->boolean('is_master')->default(false)->index(); + $table->string('format')->index(); + $table->timestamps(); + $table->boolean('is_cacheable')->default(false)->index(); + $table->unsignedTinyInteger('status')->default(false); + $table->dateTime('expires_at')->nullable()->index(); + $table->integer('filesize')->unsigned()->nullable(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('track_files'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_track_types_table.php b/database/migrations/2016_06_26_225535_create_track_types_table.php new file mode 100644 index 00000000..28adcb0e --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_track_types_table.php @@ -0,0 +1,70 @@ +increments('id'); + $table->string('title'); + $table->string('editor_title'); + }); + + DB::table('track_types')->insert([ + 'id' => 1, + 'title' => 'Original Song', + 'editor_title' => 'an original song' + ]); + + DB::table('track_types')->insert([ + 'id' => 2, + 'title' => 'Official Song Remix', + 'editor_title' => 'a remix of an official song' + ]); + + DB::table('track_types')->insert([ + 'id' => 3, + 'title' => 'Fan Song Remix', + 'editor_title' => 'a remix of a fan song' + ]); + + DB::table('track_types')->insert([ + 'id' => 4, + 'title' => 'Ponified Song', + 'editor_title' => 'a non-pony song, turned pony' + ]); + + DB::table('track_types')->insert([ + 'id' => 5, + 'title' => 'Official Show Audio Remix', + 'editor_title' => 'a remix of official show audio' + ]); + + DB::table('track_types')->insert([ + 'id' => 6, + 'title' => 'Unclassified', + 'editor_title' => 'an unclassified track' + ]); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('track_types'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_tracks_table_2.php b/database/migrations/2016_06_26_225535_create_tracks_table_2.php new file mode 100644 index 00000000..3872884f --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_tracks_table_2.php @@ -0,0 +1,67 @@ +increments('id'); + $table->integer('user_id')->unsigned()->index('tracks_user_id_foreign'); + $table->integer('license_id')->unsigned()->nullable()->index('tracks_license_id_foreign'); + $table->integer('genre_id')->unsigned()->nullable()->index(); + $table->integer('track_type_id')->unsigned()->nullable()->index('tracks_track_type_id_foreign'); + $table->string('title', 100)->index(); + $table->string('slug', 200)->index(); + $table->text('description', 65535)->nullable(); + $table->text('lyrics', 65535)->nullable(); + $table->boolean('is_vocal')->default(0); + $table->boolean('is_explicit')->default(0); + $table->integer('cover_id')->unsigned()->nullable()->index('tracks_cover_id_foreign'); + $table->boolean('is_downloadable')->default(0); + $table->float('duration')->unsigned(); + $table->integer('play_count')->unsigned()->default(0); + $table->integer('view_count')->unsigned()->default(0); + $table->integer('download_count')->unsigned()->default(0); + $table->integer('favourite_count')->unsigned()->default(0); + $table->integer('comment_count')->unsigned()->default(0); + $table->timestamps(); + $table->softDeletes()->index(); + $table->dateTime('published_at')->nullable()->index(); + $table->dateTime('released_at')->nullable(); + $table->integer('album_id')->unsigned()->nullable()->index('tracks_album_id_foreign'); + $table->integer('track_number')->unsigned()->nullable(); + $table->boolean('is_latest')->default(0); + $table->string('hash', 32)->nullable(); + $table->boolean('is_listed')->default(1); + $table->string('source', 40)->default('direct_upload'); + $table->jsonb('metadata')->nullable(); + $table->jsonb('original_tags')->nullable(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('tracks'); + } + +} diff --git a/database/migrations/2016_06_26_225535_create_users_table_2.php b/database/migrations/2016_06_26_225535_create_users_table_2.php new file mode 100644 index 00000000..6508e040 --- /dev/null +++ b/database/migrations/2016_06_26_225535_create_users_table_2.php @@ -0,0 +1,53 @@ +increments('id'); + $table->string('display_name')->index(); + $table->string('username')->nullable(); + $table->boolean('sync_names')->default(true); + $table->string('email', 150)->nullable(); + $table->string('gravatar')->nullable(); + $table->string('slug')->unique(); + $table->boolean('uses_gravatar')->default(true); + $table->boolean('can_see_explicit_content')->default(false); + $table->text('bio', 65535)->default(''); + $table->integer('track_count')->unsigned()->default(0)->index(); + $table->integer('comment_count')->unsigned()->default(0); + $table->timestamps(); + $table->integer('avatar_id')->unsigned()->nullable()->index('users_avatar_id_foreign'); + $table->string('remember_token', 100)->nullable(); + $table->boolean('is_archived')->default(false)->index(); + $table->dateTime('disabled_at')->nullable()->index(); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('users'); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_albums_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_albums_table.php new file mode 100644 index 00000000..add196b6 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_albums_table.php @@ -0,0 +1,37 @@ +foreign('cover_id')->references('id')->on('images')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('albums', function(Blueprint $table) + { + $table->dropForeign('albums_cover_id_foreign'); + $table->dropForeign('albums_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_comments_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_comments_table.php new file mode 100644 index 00000000..c53d84b1 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_comments_table.php @@ -0,0 +1,43 @@ +foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('profile_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('comments', function(Blueprint $table) + { + $table->dropForeign('comments_album_id_foreign'); + $table->dropForeign('comments_playlist_id_foreign'); + $table->dropForeign('comments_profile_id_foreign'); + $table->dropForeign('comments_track_id_foreign'); + $table->dropForeign('comments_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_favourites_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_favourites_table.php new file mode 100644 index 00000000..e6372454 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_favourites_table.php @@ -0,0 +1,41 @@ +foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('favourites', function(Blueprint $table) + { + $table->dropForeign('favourites_album_id_foreign'); + $table->dropForeign('favourites_playlist_id_foreign'); + $table->dropForeign('favourites_track_id_foreign'); + $table->dropForeign('favourites_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_followers_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_followers_table.php new file mode 100644 index 00000000..f18e0447 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_followers_table.php @@ -0,0 +1,39 @@ +foreign('artist_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('followers', function(Blueprint $table) + { + $table->dropForeign('followers_artist_id_foreign'); + $table->dropForeign('followers_playlist_id_foreign'); + $table->dropForeign('followers_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_images_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_images_table.php new file mode 100644 index 00000000..382d079e --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_images_table.php @@ -0,0 +1,35 @@ +foreign('uploaded_by')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('images', function(Blueprint $table) + { + $table->dropForeign('images_uploaded_by_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_mlpma_tracks_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_mlpma_tracks_table.php new file mode 100644 index 00000000..f684544e --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_mlpma_tracks_table.php @@ -0,0 +1,35 @@ +foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('mlpma_tracks', function(Blueprint $table) + { + $table->dropForeign('mlpma_tracks_track_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_news_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_news_table.php new file mode 100644 index 00000000..47c4becc --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_news_table.php @@ -0,0 +1,35 @@ +foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('news', function(Blueprint $table) + { + $table->dropForeign('news_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_notifications_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_notifications_table.php new file mode 100644 index 00000000..752fb671 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_notifications_table.php @@ -0,0 +1,37 @@ +foreign('activity_id')->references('id')->on('activities')->onUpdate('RESTRICT')->onDelete('CASCADE'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('notifications', function(Blueprint $table) + { + $table->dropForeign('notifications_activity_id_foreign'); + $table->dropForeign('notifications_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_pinned_playlists_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_pinned_playlists_table.php new file mode 100644 index 00000000..bc007b11 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_pinned_playlists_table.php @@ -0,0 +1,37 @@ +foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('pinned_playlists', function(Blueprint $table) + { + $table->dropForeign('pinned_playlists_playlist_id_foreign'); + $table->dropForeign('pinned_playlists_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_playlist_track_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_playlist_track_table.php new file mode 100644 index 00000000..0f1b08a5 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_playlist_track_table.php @@ -0,0 +1,37 @@ +foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('playlist_track', function(Blueprint $table) + { + $table->dropForeign('playlist_track_playlist_id_foreign'); + $table->dropForeign('playlist_track_track_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_playlists_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_playlists_table.php new file mode 100644 index 00000000..f28f06f3 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_playlists_table.php @@ -0,0 +1,35 @@ +foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('playlists', function(Blueprint $table) + { + $table->dropForeign('playlists_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_resource_log_items_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_resource_log_items_table.php new file mode 100644 index 00000000..8c05d9c8 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_resource_log_items_table.php @@ -0,0 +1,41 @@ +foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('resource_log_items', function(Blueprint $table) + { + $table->dropForeign('resource_log_items_album_id_foreign'); + $table->dropForeign('resource_log_items_playlist_id_foreign'); + $table->dropForeign('resource_log_items_track_id_foreign'); + $table->dropForeign('resource_log_items_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_resource_users_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_resource_users_table.php new file mode 100644 index 00000000..be4d39fb --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_resource_users_table.php @@ -0,0 +1,43 @@ +foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('artist_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('playlist_id')->references('id')->on('playlists')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('resource_users', function(Blueprint $table) + { + $table->dropForeign('resource_users_album_id_foreign'); + $table->dropForeign('resource_users_artist_id_foreign'); + $table->dropForeign('resource_users_playlist_id_foreign'); + $table->dropForeign('resource_users_track_id_foreign'); + $table->dropForeign('resource_users_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_role_user_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_role_user_table.php new file mode 100644 index 00000000..21bff8bd --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_role_user_table.php @@ -0,0 +1,37 @@ +foreign('role_id')->references('id')->on('roles')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('role_user', function(Blueprint $table) + { + $table->dropForeign('role_user_role_id_foreign'); + $table->dropForeign('role_user_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_show_song_track_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_show_song_track_table.php new file mode 100644 index 00000000..0d1c42cc --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_show_song_track_table.php @@ -0,0 +1,37 @@ +foreign('show_song_id')->references('id')->on('show_songs')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('show_song_track', function(Blueprint $table) + { + $table->dropForeign('show_song_track_show_song_id_foreign'); + $table->dropForeign('show_song_track_track_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_subscriptions_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_subscriptions_table.php new file mode 100644 index 00000000..aeddd668 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_subscriptions_table.php @@ -0,0 +1,35 @@ +foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('subscriptions', function(Blueprint $table) + { + $table->dropForeign('subscriptions_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_track_files_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_track_files_table.php new file mode 100644 index 00000000..84992aec --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_track_files_table.php @@ -0,0 +1,35 @@ +foreign('track_id')->references('id')->on('tracks')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('track_files', function(Blueprint $table) + { + $table->dropForeign('track_files_track_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_tracks_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_tracks_table.php new file mode 100644 index 00000000..71119fda --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_tracks_table.php @@ -0,0 +1,45 @@ +foreign('album_id')->references('id')->on('albums')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('cover_id')->references('id')->on('images')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('genre_id')->references('id')->on('genres')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('license_id')->references('id')->on('licenses')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('track_type_id')->references('id')->on('track_types')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('tracks', function(Blueprint $table) + { + $table->dropForeign('tracks_album_id_foreign'); + $table->dropForeign('tracks_cover_id_foreign'); + $table->dropForeign('tracks_genre_id_foreign'); + $table->dropForeign('tracks_license_id_foreign'); + $table->dropForeign('tracks_track_type_id_foreign'); + $table->dropForeign('tracks_user_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_06_26_225537_add_foreign_keys_to_users_table.php b/database/migrations/2016_06_26_225537_add_foreign_keys_to_users_table.php new file mode 100644 index 00000000..a0ba5675 --- /dev/null +++ b/database/migrations/2016_06_26_225537_add_foreign_keys_to_users_table.php @@ -0,0 +1,35 @@ +foreign('avatar_id')->references('id')->on('images')->onUpdate('RESTRICT')->onDelete('RESTRICT'); + }); + } + + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function(Blueprint $table) + { + $table->dropForeign('users_avatar_id_foreign'); + }); + } + +} diff --git a/database/migrations/2016_07_14_154357_MysqlToPostgres.php b/database/migrations/2016_07_14_154357_MysqlToPostgres.php new file mode 100644 index 00000000..b949cfaf --- /dev/null +++ b/database/migrations/2016_07_14_154357_MysqlToPostgres.php @@ -0,0 +1,73 @@ +console = new ConsoleOutput(); + + // Generate pgloader config + $mysqlConnection = "from mysql://" . env('DB_USERNAME') . ":" . env('DB_PASSWORD') . "@" . env('DB_HOST') . "/" . env('DB_DATABASE'); + $postgresConnection = "into postgresql://" . env('POSTGRESQL_DB_USERNAME', 'homestead') . ":" . env('POSTGRESQL_DB_PASSWORD', 'secret') . "@" . env('POSTGRESQL_DB_HOST', 'localhost') . "/" . env('POSTGRESQL_DB_DATABASE', 'homestead'); + + $header = "LOAD DATABASE"; + $body = <<<'EOD' +with truncate + +CAST type datetime to timestamp using zero-dates-to-null, + type date to timestamp using zero-dates-to-null + +EXCLUDING TABLE NAMES MATCHING 'migrations'; +EOD; + + $output = implode("\n", array($header, $mysqlConnection, $postgresConnection, $body)); + $configPath = base_path() . "/pfmimport.load"; + file_put_contents($configPath, $output); + + // Run pgloader + $this->execRunWithCallback("pgloader " . $configPath); + + // Run after-import.sql + DB::unprepared(file_get_contents(base_path() . "/database/after-import.sql")); + + // Remove pgloader config + unlink($configPath); + } + + private function execRunWithCallback($command) + { + $array = array(); + exec($command, $array); + + if (!empty($array)) { + foreach ($array as $line) { + $this->execCallback($line); + } + } + } + + private function execCallback($line) { + $this->console->writeln("[PGLOADER] " . $line); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/seeds/ShowSongTableSeeder.php b/database/seeds/ShowSongTableSeeder.php index e6e4e77b..c6325a03 100644 --- a/database/seeds/ShowSongTableSeeder.php +++ b/database/seeds/ShowSongTableSeeder.php @@ -22,25 +22,12 @@ use Illuminate\Database\Seeder; class ShowSongTableSeeder extends Seeder { - /** - * Run the database seeds. - * - * @return void - */ - public function run() - { - // This table only needs to be filled once. - // - // Song lyrics used are (C) Hasbro and - // sourced from http://mlp.wikia.com/wiki/Songs - if (DB::table('show_songs')->count() === 0) { - DB::table('show_songs')->insert( - [ - [ - 'title' => 'My Little Pony Theme Song', - 'slug' => 'my-little-pony-theme-song', - 'lyrics' => -"[Backup singer] + private $showSongs = [ + [ + 'title' => 'My Little Pony Theme Song', + 'slug' => 'my-little-pony-theme-song', + 'lyrics' => + "[Backup singer] My Little Pony, My Little Pony Ahh, ahh, ahh, ahhh... @@ -71,12 +58,12 @@ And magic makes it all complete You have my little ponies Do you know you're all my very best friends?" - ], - [ - 'title' => 'Laughter Song (Giggle at the Ghostly)', - 'slug' => 'laughter-song', - 'lyrics' => -"[Pinkie Pie] + ], + [ + 'title' => 'Laughter Song (Giggle at the Ghostly)', + 'slug' => 'laughter-song', + 'lyrics' => + "[Pinkie Pie] When I was a little filly and the sun was going down... Twilight Sparkle: Tell me she's not... @@ -116,12 +103,12 @@ And tell that big dumb scary face to take a hike and leave you alone and if he t Laaaaaaauuugh!" - ], - [ - 'title' => 'Winter Wrap-Up', - 'slug' => 'winter-wrap-up', - 'lyrics' => -"[Rainbow Dash] + ], + [ + 'title' => 'Winter Wrap-Up', + 'slug' => 'winter-wrap-up', + 'lyrics' => + "[Rainbow Dash] Three months of winter coolness And awesome holidays @@ -256,12 +243,12 @@ Winter Wrap Up! Winter Wrap Up! 'Cause tomorrow spring is here 'Cause tomorrow spring is here 'Cause tomorrow spring is here!" - ], - [ - 'title' => 'EQG - Helping Twilight Win The Crown', - 'slug' => 'helping-twilight-win-the-crown', - 'lyrics' => -"[Pinkie Pie, Rainbow Dash, Applejack, Fluttershy, Rarity] + ], + [ + 'title' => 'EQG - Helping Twilight Win The Crown', + 'slug' => 'helping-twilight-win-the-crown', + 'lyrics' => + "[Pinkie Pie, Rainbow Dash, Applejack, Fluttershy, Rarity] Hey! Hey! Everybody! We've got something to say. We may seem as different, @@ -354,8 +341,28 @@ Jump up, make a sound. Hey! Stomp your hooves, turn around. Canterlot Wondercolts Help her win the crown..." - ] - ]); + ] + ]; + + /** + * Run the database seeds. + * + * @return void + */ + public function run() + { + // This table only needs to be filled once. + // + // Song lyrics used are (C) Hasbro and + // sourced from http://mlp.wikia.com/wiki/Songs + if (DB::table('show_songs')->count() === 0) { + $now = \Carbon\Carbon::now(); + $showSongs = array_map(function(array $item) use ($now) { + $item['created_at'] = $now; + $item['updated_at'] = $now; + return $item; + }, $this->showSongs); + DB::table('show_songs')->insert($showSongs); } } } diff --git a/vagrant/install.sh b/vagrant/install.sh index a3a9b513..46d4f342 100755 --- a/vagrant/install.sh +++ b/vagrant/install.sh @@ -27,6 +27,8 @@ sudo apt-get -qq install -y AtomicParsley flac vorbis-tools imagemagick oracle-j echo "Installing PHP extensions" sudo apt-get -qq install -y libgmp-dev php-gmp +echo "Installing Postgres migration tool" +sudo apt-get -qq install -y pgloader if type ffmpeg &>/dev/null; then echo "ffmpeg is installed!"