Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove function truncate_tables from relational schema generation #156

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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