forked from ScoDoc/ScoDoc
SQL truncate_tables: preserve alembic_version
This commit is contained in:
parent
d389c54f86
commit
21604259a4
@ -32,7 +32,8 @@ DECLARE
|
|||||||
SELECT tablename FROM pg_tables
|
SELECT tablename FROM pg_tables
|
||||||
WHERE tableowner = username AND schemaname = 'public'
|
WHERE tableowner = username AND schemaname = 'public'
|
||||||
AND tablename <> 'notes_semestres'
|
AND tablename <> 'notes_semestres'
|
||||||
AND tablename <> 'notes_form_modalites';
|
AND tablename <> 'notes_form_modalites'
|
||||||
|
AND tablename <> 'alembic_version';
|
||||||
BEGIN
|
BEGIN
|
||||||
FOR stmt IN statements LOOP
|
FOR stmt IN statements LOOP
|
||||||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
|
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
|
||||||
|
@ -34,7 +34,8 @@ DECLARE
|
|||||||
SELECT tablename FROM pg_tables
|
SELECT tablename FROM pg_tables
|
||||||
WHERE tableowner = username AND schemaname = 'public'
|
WHERE tableowner = username AND schemaname = 'public'
|
||||||
AND tablename <> 'notes_semestres'
|
AND tablename <> 'notes_semestres'
|
||||||
AND tablename <> 'notes_form_modalites';
|
AND tablename <> 'notes_form_modalites'
|
||||||
|
AND tablename <> 'alembic_version';
|
||||||
BEGIN
|
BEGIN
|
||||||
FOR stmt IN statements LOOP
|
FOR stmt IN statements LOOP
|
||||||
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
|
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
|
||||||
|
Loading…
Reference in New Issue
Block a user