Skip to content

Instantly share code, notes, and snippets.

@karenc
Created December 11, 2015 14:17
Show Gist options
  • Save karenc/46ae5a226d73f067ea37 to your computer and use it in GitHub Desktop.
Save karenc/46ae5a226d73f067ea37 to your computer and use it in GitHub Desktop.
Creating users in accounts using the users table from cnx-archive database

To create users in accounts using the users table in the cnx-archive database:

This assumes that you have accounts running and have created a oauth application for cnx (e.g. "OpenStax CNX").

  1. Download the sql file for exporting the cnx-archive users table to a csv file:

wget https://gist.githubusercontent.com/karenc/0d8ea492300a34c4bedd/raw/19691cb5bae345ee14de3ac22c400cfa202968cb/cnxarchive_users_to_csv.sql


2. Export the cnx-archive users table to a csv file:

```bash
psql -U cnxarchive cnxarchive -f cnxarchive_users_to_csv.sql >cnxarchive_users.csv
  1. Import the users into accounts:

rake accounts:import_users CSV_FILE=cnxarchive_users.csv APP_NAME='OpenStax CNX'

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