add Init and Down script for tests
This commit is contained in:
2
src/test/resources/fixtures/down.sql
Normal file
2
src/test/resources/fixtures/down.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
drop schema public cascade;
|
||||
create schema if not exists public;
|
||||
@@ -1,3 +1,8 @@
|
||||
-- create database test;
|
||||
-- create user test with encrypted password 'test';
|
||||
-- grant all privileges on database test to test;
|
||||
-- ALTER SCHEMA public owner to test;
|
||||
|
||||
create table if not exists test
|
||||
(
|
||||
id serial not null
|
||||
@@ -14,7 +19,8 @@ create table if not exists test2
|
||||
constraint test2_test_id_fk
|
||||
references test
|
||||
);
|
||||
INSERT INTO public.test (id, name) VALUES (1, 'plop');
|
||||
INSERT INTO public.test2 (id, title, test_id) VALUES (1, 'plop', 1);
|
||||
INSERT INTO public.test2 (id, title, test_id) VALUES (2, 'plip', 1);
|
||||
INSERT INTO public.test2 (id, title, test_id) VALUES (3, 'ttt', null);
|
||||
|
||||
INSERT INTO test (id, name) VALUES (1, 'plop') ON CONFLICT DO NOTHING;
|
||||
INSERT INTO test2 (id, title, test_id) VALUES (1, 'plop', 1) ON CONFLICT DO NOTHING;
|
||||
INSERT INTO test2 (id, title, test_id) VALUES (2, 'plip', 1) ON CONFLICT DO NOTHING;
|
||||
INSERT INTO test2 (id, title, test_id) VALUES (3, 'ttt', null) ON CONFLICT DO NOTHING;
|
||||
|
||||
Reference in New Issue
Block a user