# What is the latest recommended workflow for local development? (Ubuntu 16.04)

**URL:** <https://meta.discourse.org/t/what-is-the-latest-recommended-workflow-for-local-development-ubuntu-16-04/71213>\
**Category:** Development\
**Created:** [2017 年 10 月 2 日午後 10:08 UTC](https://meta.discourse.org/t/what-is-the-latest-recommended-workflow-for-local-development-ubuntu-16-04/71213 "2017-10-02T22:08:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![j127](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j127/32/79093_2.png) [@j127](https://meta.discourse.org/u/j127)\
**Post date:** [2017 年 10 月 2 日午後 11:25 UTC](https://meta.discourse.org/t/what-is-the-latest-recommended-workflow-for-local-development-ubuntu-16-04/71213/3 "2017-10-02T23:25:23Z")

</div>

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

```

---

_[View the full topic](https://meta.discourse.org/t/what-is-the-latest-recommended-workflow-for-local-development-ubuntu-16-04/71213)._
