Re: PostgreSQL DB in prod, test, debug

Поиск
Список
Период
Сортировка
От Simon Connah
Тема Re: PostgreSQL DB in prod, test, debug
Дата
Msg-id N9HjchUGC4j88lVbmBH0ZHC3F43upew-VMqbtZCBGXvFwTdv_WnGH4z_I7YapG7BIbmM0YqSV2weKvFKYvy1BlL27E6E2j2hVdkthlD70i0=@protonmail.com
обсуждение исходный текст
Ответ на Re: PostgreSQL DB in prod, test, debug  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-general
On Wednesday, 14 February 2024 at 10:25, Daniel Gustafsson <daniel@yesql.se> wrote:

>

>

> > On 14 Feb 2024, at 10:59, Simon Connah simon.n.connah@protonmail.com wrote:
>

> > This is probably a stupid question so I apologies in advance.
>

>

> There is no such thing.
>

> > What I think is the best way to do this is to do a pg_dump of the database (using the --schema-only flag) and then
loadit into a test only database that gets created at the start of the unit tests and destroyed at the end. The
automatedtests will insert, update, delete and select data to test if it all still works. 
>

>

> If the source of truth for your schema is the database, then sure. If the
> source of truth is a .sql file in your source code repository then you should
> use that. In essence, create the test database identically to how you create
> the production database to ensure that you are testing what you will run in
> production.
>

> --
> Daniel Gustafsson

Thank you. I'm a bit disorganised with things at the moment. I'm kinda developing this site in an ad hoc manner which
isprobably a bad idea so I'm trying to fix up a few mistakes I made early on. 

In terms of the database I've just added new functions as needed which I use instead of direct SQL in my Python code.
MaybeI should sit down with Visio and try and do a diagram before I go any further? 

I'll just write a simple script for backup and restore and call it before each test run but have the schema only dump
comefrom production. At this point it doesn't really matter as the website is so small. 

Simon.
Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Dominique Devienne
Дата:
Сообщение: Two test failures on v16 (compared to v14)
Следующее
От: Simon Connah
Дата:
Сообщение: Re: PostgreSQL DB in prod, test, debug