subzerocloud / subzero-starter-kit

Starter Kit and tooling for authoring GraphQL/REST API backends with subZero

Home Page:https://subzero.cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get search paths from datafiller? they are missing on default schema.

kevzettler opened this issue · comments

If I run the datafiller example on the default todos project it generates data.sql without any search_paths. It causes failures:

│psql:/src/db/src/sample_data/data.sql:14: ERROR:  relation "user" does not exist                                                                                                 │
│                                                                                                                                                                                 │
│psql:/src/db/src/sample_data/data.sql:14: ERROR:  relation "user" does not exist

The generated output looks like

-- fill table user (2)
\echo # filling table user (2)
COPY "user" (id,name,email,"password","role") FROM STDIN (FREEZE ON);
1	name_2_2	email_1_1_1_1_1_	password_1_1_	webuser
2	name_1_1_1_1_1	email_2_2_2	password_1_1_	webuser
\.
-- 
-- fill table todo (2)
\echo # filling table todo (2)
COPY todo (id,todo,private,owner_id) FROM STDIN (FREEZE ON);
1	todo_1_1_1	TRUE	2
2	todo_2_2_2_2_	FALSE	1
\.
-- 
-- restart sequences
ALTER SEQUENCE "user_id_seq" RESTART WITH 3;
ALTER SEQUENCE todo_id_seq RESTART WITH 3;
-- 
-- analyze modified tables
ANALYZE "user";
ANALYZE todo;

it should be "data.user" like the commited sample file at:

https://github.com/subzerocloud/subzero-starter-kit/blob/master/db/src/sample_data/data.sql#L13

after the file is generated, you can add set search_path = data, public; at the top.

@ruslantalpa how was the data.sql generated that is commited to the repo and has the correct paths? were those manually added ? https://github.com/subzerocloud/subzero-starter-kit/blob/master/db/src/sample_data/data.sql#L13