Commit Graph

14 Commits

Author SHA1 Message Date
Reid Barton 64a142f0a2 Fix running postgres-init-db via a relative path.
If the user runs ./scripts/setup/postgres-init-db, then dirname "$0"
would no longer refer to the correct directory after cd /.
2015-12-25 10:06:45 -08:00
Tim Abbott 421560af21 postgres-init-db: Stop all services before recreating database. 2015-11-01 18:11:39 -08:00
Tim Abbott 3c31f9a2e3 Drop database users prior to DROP/CREATE database.
This fixes an annoying issue where one tries to rebuild the database,
and it fails due to there being existing connections.

The one thing that is potentially scary about this implementation is
that it means it's now a lot easier to accidentally drop your
production database by running the wrong script; might be worth adding
a "--force" flag controlling this behavior or something.

Thanks to Nemanja Stanarevic and Neeraj Wahi for prototypes of this
implementation!  They did most of the work and testing for this.
2015-11-01 18:11:39 -08:00
Tim Abbott bf694fa832 Flush memcached whenever we drop the databases.
This fixes some issues that we've had where commands will fail is
confusing ways after the database is rebuilt because data from before
the database was dropped is still in the memcached cache.
2015-10-15 12:18:41 -04:00
Tim Abbott 2348a83678 postgres-init-db: Fix running with cwd=/root.
(imported from commit d2ac25fa8c54b89eed80e941b3eacf1a4c2f5546)
2015-09-25 00:22:15 -07:00
Reid Barton 5be0c2902e Connect to the zulip database correctly in postgres-init-db
(imported from commit b6ab80567ff5d229a00c7d2cf5866bca0ee9c7c5)
2015-08-29 12:07:33 -07:00
Reid Barton 4e61c06903 Fix postgres syntax when creating zulip schema in production
(imported from commit 51ba85b995e4b5044f914163dab7f2ae14df908f)
2015-08-28 09:37:46 -07:00
Reid Barton a3d85f501b Create tsearch_extras in production database setup
(imported from commit e6c699b06f022d923b57ccee7ad778f870bf890d)
2015-08-21 16:54:35 -07:00
Tim Abbott c54322f76a install: Move DROP SCHEMA PUBLIC to run in zulip database.
(imported from commit 1eef44e7255b8fe1314f7763ebfc6c04083305e5)
2013-11-13 15:35:45 -05:00
Tim Abbott c842b42b12 postgres-init-db: The zulip user doesn't need CREATE DB on enterprise.
Also clean up the series of similar blocks.

(imported from commit fdb468bd6be3077bdbf2d72289064397ea04f27a)
2013-11-13 15:35:45 -05:00
Tim Abbott 6aaa2b1a24 Create the zulip database owned by zulip.
(imported from commit cc6e895d9e97bdd9d084c7b1a7204bd5b7ae5cd8)
2013-11-13 12:02:50 -05:00
Tim Abbott b2d4883165 postgres-init-db: Split into internal and external versions for now.
(imported from commit 3516b1377e5914dac2b504961922ef8d08148d1f)
2013-11-13 12:02:50 -05:00
Tim Abbott 03bf4ba423 postgres-init-db: Don't hardcode LOCAL_DATABASE_PASSWORD.
(imported from commit e2cf6c6c0abb688c77661e4849e7b574b4222e68)
2013-11-12 09:38:43 -05:00
Tim Abbott cdd7ab895d Move postgres-init-db to scripts/setup/.
(imported from commit 7844fc5cac3e3c90466216e14b2c5b25b4830216)
2013-10-28 10:54:48 -04:00