blob: 879cbc79e94157c7871e0bdf58a194f6d6ffe848 [file] [log] [blame]
Zack Williamsa2763112017-01-03 11:38:38 -07001-- Clear the XOS database (used for testing)
2
3CREATE OR REPLACE FUNCTION truncate_tables(username IN VARCHAR) RETURNS void AS $$
4DECLARE
5 statements CURSOR FOR
6 SELECT tablename FROM pg_tables
7 WHERE tableowner = username AND schemaname = 'public';
8BEGIN
9 FOR stmt IN statements LOOP
10 EXECUTE 'TRUNCATE TABLE ' || quote_ident(stmt.tablename) || ' CASCADE;';
11 END LOOP;
12END;
13$$ LANGUAGE plpgsql;
14
15SELECT truncate_tables('postgres');
16
17SELECT setval('core_tenant_id_seq', 1);
18
19SELECT setval('core_deployment_id_seq', 1);
20
21SELECT setval('core_flavor_id_seq', 1);
22
23SELECT setval('core_service_id_seq', 1);
24