Skip to content

Commit

Permalink
Remove function truncate_tables from relational schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf Peschke committed Aug 28, 2024
1 parent d1e7daa commit ab81ad9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
13 changes: 0 additions & 13 deletions dev/sql/schema_relational.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@ begin
RETURN NULL; -- AFTER TRIGGER needs no return
end;
$not_null_trigger$ language plpgsql;

CREATE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' RESTART IDENTITY CASCADE;';
END LOOP;
END;
$$ LANGUAGE plpgsql;

-- MODELS_YML_CHECKSUM = 'e3bcb2c45850469b5e56d3542d12ea15'
-- Type definitions

Expand Down
13 changes: 0 additions & 13 deletions dev/src/generate_sql_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,19 +616,6 @@ class Helper:
RETURN NULL; -- AFTER TRIGGER needs no return
end;
$not_null_trigger$ language plpgsql;
CREATE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$
DECLARE
statements CURSOR FOR
SELECT tablename FROM pg_tables
WHERE tableowner = username AND schemaname = 'public';
BEGIN
FOR stmt IN statements LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' RESTART IDENTITY CASCADE;';
END LOOP;
END;
$$ LANGUAGE plpgsql;
"""
)
FIELD_TEMPLATE = string.Template(
Expand Down

0 comments on commit ab81ad9

Please sign in to comment.