mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
bug fix - Fixed error in cleanDatabase that would cause drift
Added an extra line to ensure the query does not include the migration table. This kept on getting cleared. Reintroduced shadow db to detect drift.
This commit is contained in:
@@ -6,9 +6,10 @@ generator client {
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
|
||||
directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
|
||||
provider = "postgresql"
|
||||
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
|
||||
directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
|
||||
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
|
||||
@@ -13,8 +13,9 @@ const cleanDatabase = async () => {
|
||||
DO $$
|
||||
DECLARE
|
||||
statements CURSOR FOR
|
||||
SELECT tablename FROM pg_tables
|
||||
WHERE schemaname = 'public';
|
||||
SELECT tablename FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
AND tablename != '_prisma_migrations';
|
||||
BEGIN
|
||||
FOR statement IN statements LOOP
|
||||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(statement.tablename) || ' CASCADE;';
|
||||
|
||||
Reference in New Issue
Block a user