Before anything do a non-preboot deployment:
$ bundle exec rake ttm:deploy:production
Be warned: this will restart the app.
Once that's done the next set of migration tasks can be done in any order, or in parallel.
-
Copy 'temp_session.dump' from the 'ttm-utilities' S3 bucket.
-
Restore the dump to the master shard: (Ignore any warnings about the zmance user ... nailed it.)
$ pg_restore -U -h -p -d -t tmp_session_last_attempt_date temp_session.dump
-
Add an index to the temp table:
CREATE INDEX ON tmp_session_last_attempt_date (session_id);
-
Run this on the master shard: (may take up to an hour)
UPDATE student_sessions SET last_attempt_date = t.last_attempt_date FROM tmp_session_last_attempt_date t WHERE student_sessions.id = t.session_id;
-
Drop the temp table from the master shard:
DROP TABLE tmp_session_last_attempt;
-
Set the database password in an environment variable:
$ heroku config -a ttm-production | grep DATABASE_URL
$ export PGPASSWORD={found password}
-
Run the script
$ ruby db/migration_helper/assign_live_help_classroom.rb
For more read db/pathway_replication_sync/README.md
.
-
Set the database password in an environment variable:
$ heroku config -a ttm-production | grep DATABASE_URL
$ export PGPASSWORD={found password}
-
Run the synchronization process:
$ cd db/pathway_replication_sync $ ./dump_production $ ./execute $ ./load_production