Diff comments:

> diff --git a/backend/README.md b/backend/README.md
> index 9bf524c..966db8c 100644
> --- a/backend/README.md
> +++ b/backend/README.md
> @@ -86,3 +86,49 @@ The application can be run via
>  ```
>  tox -e run run
>  ```
> +
> +## Delete and recreate the database
> +
> +There is not yet functionality to migrate the database with MAAS site 
> manager.
> +However a database is created for you on application startup. If the schema 
> changes
> +or you just want a fresh start, you can do the following.
> +
> +### Using docker
> +
> +To recreate the database stop the app (e.g. `docker compose down`) and run
> +
> +```
> +docker volume rm maas-site-manager_postgres-data
> +```
> +
> +A new database will be created for you on the next `docker-compose up`.
> +
> +### Any postgresql database
> +
> +(This also works if you use docker. In that case make sure to connect with 
> the correct credentials)
> +
> +If you are using your own postgres you can usually do the following to empty 
> the database:
> +
> +- Connect to your database
> +```
> +psql
> +\c <database_name>
> +```
> +
> +- Execute the following to empty and recreate the database.
> +```
> +DROP SCHEMA public CASCADE;
> +CREATE SCHEMA public;
> +
> +GRANT ALL ON SCHEMA public TO postgres;
> +GRANT ALL ON SCHEMA public TO public;
> +```
> +
> +### Importing test data to the database

I am not sure about this one. What if you want to start with an empty DB for 
some reason or reuse your existing db but still rebuild the container. Anyways, 
I'll have a look if we can somehow load it in case of a first start or using a 
different command.

> +
> +There are CSV files available that can be used as test data.
> +
> +If you are running the app in docker you can easily load those
> +
> +- go to the test data directory `cd ../testdata`
> +- run the loading script `./import.sh`


-- 
https://code.launchpad.net/~thorsten-merten/maas-site-manager/+git/maas-site-manager/+merge/439266
Your team MAAS Committers is subscribed to branch 
~thorsten-merten/maas-site-manager:MAASENG-1486-add-testdata.


-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : sts-sponsors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to