Thanks. Do you have a system for truncating (or dropping and resetting) the databases while working? Right now I’m trying to create a bash script that will do it, but I’m not sure if someone has already solved this kind of problem.
Something like this (unfinished, non-working import script):
# Step 1
dropdb discourse_development
dropdb discourse_test
dropdb discourse_test_multisite
# Step 2
echo `whoami` > /tmp/username
sudo su - postgres
# Step 3
# createuser --createdb --superuser -Upostgres $(cat /tmp/username)
# psql -c "ALTER USER $(cat /tmp/username) WITH PASSWORD '$PASSWORD';"
psql -c "create database discourse_development owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -c "create database discourse_test_multisite owner $(cat /tmp/username) encoding 'UTF8' TEMPLATE template0;"
psql -d discourse_development -c "CREATE EXTENSION hstore;"
psql -d discourse_development -c "CREATE EXTENSION pg_trgm;"
psql -d discourse_test -c "CREATE EXTENSION hstore;"
psql -d discourse_test -c "CREATE EXTENSION pg_trgm;"
psql -d discourse_test_multisite -c "CREATE EXTENSION hstore;"
psql -d discourse_test_multisite -c "CREATE EXTENSION pg_trgm;"
# Step 4
exit # postgres user
rails db:migrate
# To create an admin user
rake admin:create
# Run import script
export IMPORT=1
bundle install
RAILS_ENV=development bundle exec ruby script/import_scripts/drupal_7/importer.rb