← Back to team overview

sts-sponsors team mailing list archive

Re: [Merge] ~thorsten-merten/maas-site-manager:MAASENG-1486-add-testdata into maas-site-manager:main

 

Review: Approve

It's not up to date with the latest version of the spec, but other than that looks good.

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

Any reason why we shouldn't make the test data the default for new development environments?

> +
> +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.



References