diff --git a/database/migrations/2016_07_10_000354_add_deleted_at_column_to_activities.php b/database/migrations/2016_07_10_000354_add_deleted_at_column_to_activities.php index ad9b5303..e62de81a 100644 --- a/database/migrations/2016_07_10_000354_add_deleted_at_column_to_activities.php +++ b/database/migrations/2016_07_10_000354_add_deleted_at_column_to_activities.php @@ -33,35 +33,35 @@ class AddDeletedAtColumnToActivities extends Migration Schema::table('activities', function(Blueprint $table) { $table->softDeletes()->index(); }); - + // Retroactively fix activities that should be marked as deleted. // Tracks DB::table('activities') ->where('resource_type', 2) ->join('tracks', 'activities.resource_id', '=', 'tracks.id') ->whereNotNull('tracks.deleted_at') - ->update(['activities.deleted_at' => DB::raw('tracks.deleted_at')]); + ->update(['deleted_at' => DB::raw('tracks.deleted_at')]); // Albums DB::table('activities') ->where('resource_type', 3) ->join('albums', 'activities.resource_id', '=', 'albums.id') ->whereNotNull('albums.deleted_at') - ->update(['activities.deleted_at' => DB::raw('albums.deleted_at')]); + ->update(['deleted_at' => DB::raw('albums.deleted_at')]); // Playlists DB::table('activities') ->where('resource_type', 4) ->join('playlists', 'activities.resource_id', '=', 'playlists.id') ->whereNotNull('playlists.deleted_at') - ->update(['activities.deleted_at' => DB::raw('playlists.deleted_at')]); + ->update(['deleted_at' => DB::raw('playlists.deleted_at')]); // Comments DB::table('activities') ->where('resource_type', 5) ->join('comments', 'activities.resource_id', '=', 'comments.id') ->whereNotNull('comments.deleted_at') - ->update(['activities.deleted_at' => DB::raw('comments.deleted_at')]); + ->update(['deleted_at' => DB::raw('comments.deleted_at')]); } /** diff --git a/database/migrations/2016_07_14_154357_MysqlToPostgres.php b/database/migrations/2016_07_14_154357_MysqlToPostgres.php index b949cfaf..ca433303 100644 --- a/database/migrations/2016_07_14_154357_MysqlToPostgres.php +++ b/database/migrations/2016_07_14_154357_MysqlToPostgres.php @@ -15,34 +15,34 @@ class MysqlToPostgres extends Migration */ public function up() { - $this->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); +// $this->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)