move when to run migrations

This commit is contained in:
Ed Chalstrey 2022-02-21 17:28:42 +00:00
parent 297467fcb9
commit e726e0adf2

View File

@ -153,6 +153,9 @@ password `<pgpassword>` is arbitrary and probably should not be your Ubuntu logi
sudo -u postgres psql -c "SELECT 1 FROM pg_user WHERE usename = '<username>';" | grep -q 1 || sudo -u postgres psql -c "CREATE ROLE <username> SUPERUSER LOGIN PASSWORD '<pgpassword>';"
```
_TODO: temp instruction, find a better place to move this:_
> If you are creating from a CL db, run the above with `<username>` as "cldbadmin" and use that from now on, but also run the above a second time with `<username>` as "clwebapp".
Set the `<pgpassword>` as an environment variable.
```bash
@ -181,13 +184,6 @@ create extension pg_trgm;
Then quit `psql` by typing `\q` and hitting return.
Now run all 'up' migrations to create tables, data types, indexes etc. The `.sql` scripts to
do this are located in the `migrations` folder of your local repository.
```bash
ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d <colouringlondondb> -U <username> -h localhost < $migration; done;
```
## Setting up Node
Now upgrade the npm package manager to the most recent release with global privileges. This
@ -314,6 +310,15 @@ Create a building record per outline.
```
</details>
#### Run migrations
Now run all 'up' migrations to create tables, data types, indexes etc. The `.sql` scripts to
do this are located in the `migrations` folder of your local repository.
```bash
ls ./colouring-london/migrations/*.up.sql 2>/dev/null | while read -r migration; do psql -d <colouringlondondb> -U <username> -h localhost < $migration; done;
```
## Running the application
Now we are ready to run the application. The `APP_COOKIE_SECRET` is arbitrary.