Skip to content

Commit 8c80cb2

Browse files
committed
fixtures
1 parent a7b00e5 commit 8c80cb2

File tree

17 files changed

+169
-4
lines changed

17 files changed

+169
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- Deploy project-a:base_schema to pg
2+
3+
BEGIN;
4+
5+
CREATE SCHEMA base;
6+
7+
COMMIT;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Deploy project-a:base_types to pg
2+
-- requires: base_schema
3+
4+
BEGIN;
5+
6+
CREATE TYPE base.status AS ENUM ('active', 'inactive', 'pending');
7+
8+
COMMIT;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
%syntax-version=1.0.0
2+
%project=project-a
3+
%uri=https://github.com/test/project-a
4+
5+
base_schema 2024-01-01T00:00:00Z test <[email protected]> # Create base schema
6+
base_types [base_schema] 2024-01-02T00:00:00Z test <[email protected]> # Create base types
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Deploy project-b:app_schema to pg
2+
-- requires: project-a:base_schema
3+
4+
BEGIN;
5+
6+
CREATE SCHEMA app;
7+
8+
COMMIT;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Deploy project-b:app_tables to pg
2+
-- requires: app_schema
3+
-- requires: project-a:base_types
4+
5+
BEGIN;
6+
7+
CREATE TABLE app.items (
8+
id SERIAL PRIMARY KEY,
9+
name TEXT NOT NULL,
10+
status base.status DEFAULT 'pending'
11+
);
12+
13+
COMMIT;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
%syntax-version=1.0.0
2+
%project=project-b
3+
%uri=https://github.com/test/project-b
4+
5+
app_schema [project-a:base_schema] 2024-01-03T00:00:00Z test <[email protected]> # Create app schema
6+
app_tables [app_schema project-a:base_types] 2024-01-04T00:00:00Z test <[email protected]> # Create app tables using base types
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Deploy test-simple:index to pg
2+
-- requires: table
3+
4+
BEGIN;
5+
6+
CREATE INDEX idx_users_email ON test_app.users(email);
7+
CREATE INDEX idx_users_created_at ON test_app.users(created_at);
8+
9+
COMMIT;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- Deploy test-simple:schema to pg
2+
3+
BEGIN;
4+
5+
CREATE SCHEMA test_app;
6+
7+
COMMIT;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- Deploy test-simple:table to pg
2+
-- requires: schema
3+
4+
BEGIN;
5+
6+
CREATE TABLE test_app.users (
7+
id SERIAL PRIMARY KEY,
8+
name TEXT NOT NULL,
9+
email TEXT UNIQUE NOT NULL,
10+
created_at TIMESTAMPTZ DEFAULT NOW()
11+
);
12+
13+
COMMIT;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Revert test-simple:index from pg
2+
3+
BEGIN;
4+
5+
DROP INDEX test_app.idx_users_email;
6+
DROP INDEX test_app.idx_users_created_at;
7+
8+
COMMIT;

0 commit comments

Comments
 (0)