Skip to content

Instantly share code, notes, and snippets.

@cwinters
Forked from seejee/gist:5031415
Last active December 14, 2015 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwinters/5084446 to your computer and use it in GitHub Desktop.
Save cwinters/5084446 to your computer and use it in GitHub Desktop.
2013-03-05 Deployment info

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.

Assign data to student_session.last_session_date

  1. Copy 'temp_session.dump' from the 'ttm-utilities' S3 bucket.

  2. 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

  3. Add an index to the temp table:

    CREATE INDEX ON tmp_session_last_attempt_date (session_id);

  4. 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;

  5. Drop the temp table from the master shard:

    DROP TABLE tmp_session_last_attempt;

Assign data to live_help_transcripts.classroom_id

  1. Set the database password in an environment variable:

    $ heroku config -a ttm-production | grep DATABASE_URL

    password is string between ':' and '@'

    $ export PGPASSWORD={found password}

  2. Run the script

    $ ruby db/migration_helper/assign_live_help_classroom.rb

Sync pathway changes

For more read db/pathway_replication_sync/README.md.

  1. Set the database password in an environment variable:

    $ heroku config -a ttm-production | grep DATABASE_URL

    password is string between ':' and '@'

    $ export PGPASSWORD={found password}

  2. Run the synchronization process:

    $ cd db/pathway_replication_sync $ ./dump_production $ ./execute $ ./load_production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment