Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit e25f789

Browse files
committed
feature: add row types for each table found
1 parent 9a2c052 commit e25f789

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

tests/data.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
insert into t1 (id) values (1);
2+
insert into t2 (id, c1, c2) values (1, 2, 3);
3+
insert into t2 (id, c1, c2) values (2, 4, null);
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
type Query {
2-
t1: Int!
3-
t2: Int!
2+
t1: T1!
3+
t2: T2!
4+
}
5+
6+
type T1 {
7+
id: Int!
8+
}
9+
10+
type T2 {
11+
id: Int!
12+
c1: Int!
13+
c2: Int!
414
}

tests/run.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ reset_database () {
241241
if [ -z "$keep_database" ]; then
242242
psql="PGPASSWORD=\"$PGQL_DB_PASSWORD\" psql -h \"$PGQL_DB_HOST\" -U \"$PGQL_DB_USER\" -w -v ON_ERROR_STOP=1 -q"
243243
echo "drop database if exists $PGQL_DB_NAME; create database $PGQL_DB_NAME" | eval "$psql"
244-
cat ./schema.sql | envsubst | eval "$psql" -d "$PGQL_DB_NAME"
244+
{
245+
echo "begin;"
246+
cat ./schema.sql ./data.sql
247+
echo "commit;"
248+
} | envsubst | eval "$psql" -d "$PGQL_DB_NAME"
245249
fi
246250
}
247251

tests/schema.sql

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
create table t1 (id int not null primary key);
2-
create table t2 (id int not null primary key);
1+
create table t1 (
2+
id int not null primary key
3+
);
4+
5+
create table t2 (
6+
id int not null primary key,
7+
c1 int not null,
8+
c2 int
9+
);

0 commit comments

Comments
 (0)