Add dev script to generate full SQL schema files (#6394)

This commit is contained in:
Andrew Morgan 2019-12-11 13:16:01 +00:00 committed by GitHub
parent ea0f0ad414
commit 6676ee9c4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 198 additions and 19 deletions

View file

@ -0,0 +1,13 @@
# Building full schema dumps
These schemas need to be made from a database that has had all background updates run.
To do so, use `scripts-dev/make_full_schema.sh`. This will produce
`full.sql.postgres ` and `full.sql.sqlite` files.
Ensure postgres is installed and your user has the ability to run bash commands
such as `createdb`.
```
./scripts-dev/make_full_schema.sh -p postgres_username -o output_dir/
```

View file

@ -1,19 +0,0 @@
Building full schema dumps
==========================
These schemas need to be made from a database that has had all background updates run.
Postgres
--------
$ pg_dump --format=plain --schema-only --no-tablespaces --no-acl --no-owner $DATABASE_NAME| sed -e '/^--/d' -e 's/public\.//g' -e '/^SET /d' -e '/^SELECT /d' > full.sql.postgres
SQLite
------
$ sqlite3 $DATABASE_FILE ".schema" > full.sql.sqlite
After
-----
Delete the CREATE statements for "sqlite_stat1", "schema_version", "applied_schema_deltas", and "applied_module_schemas".