The answer is yes. Searching Discord bites, so impossible to find the discussions for you since the <#816286905163448340> channel has a ton of matches for some reason - and there was a reorg of channels a few months ago that might have left the most recent answers in <#615892613081333794> . The full answer goes something like this....
Last active 11 days ago
12 replies
3 views
- PK
The answer is yes. Searching Discord bites, so impossible to find the discussions for you since the <#816286905163448340> channel has a ton of matches for some reason - and there was a reorg of channels a few months ago that might have left the most recent answers in <#615892613081333794> .
The full answer goes something like this….
- PK
- develop locally
- create a new branch
staging
in your git repo - push your dev changes to the new
staging
branch - create a new NHost project and point it to your
staging
branch, not your main branch - fill your
staging
NHost project with test data, test, validate - when ready issue a PR from
staging
to your main/master branch which should still be tied to the production NHost project.
- MR
super-helpful, thank you. I guess the thing that worried me more than anything where migrations, and whether having different environments would somehow lose context on what DB changes need to be applied to prod
- EL
For reference: https://docs.nhost.io/platform/multiple-environments
- PK
@mr_clinton I think I can safely say that it works as expected - changes are made in both places at the right time: when you develop locally using the CLI you get the changes there, then when you push your changes to staging you get them and can see + test them there, then finally pushing to production they apply there as well and you can smoke test for the changes and voila.
- PK
Pretty great!
- PK
@elitan Cool, hadn't seen the new(ish) page.
- MR
btw, is there a way to add seed data for auth.users? I created /seeds/auth/file.sql but doesn't appear to work
- PK
This format works for me:
DO $$ DECLARE userid auth.users.id%TYPE = '12345678-1234-1234-1234-123456789012'; otherid other.id%TYPE; BEGIN INSERT INTO auth.users (id, display_name, email, email_verified, locale, metadata) VALUES (userid, 'Fake Tester', 'test@nowhere.com', TRUE, 'en', '{"lastName":"Tester","firstName":"Fake"}') RETURNING id INTO userid; INSERT INTO other (col1, col2, col3) VALUES ('Val1', 'Val2', 200) RETURNING id INTO otherid; END $$
In folder+file
nhost/seeds/default/001-initial.sql
. Runs on local dev when you first do annhost up
or perhaps evennhost dev -d
. I don't believe it runs in the cloud. - PK
If you want to apply it against your cloud instance(s), use a Postgres client (CLI or pgAdmin etc) to connect to the DB and run the script directly.
- PK
https://docs.nhost.io/database#seed-data
- MR
This is great, thanks for all your help so far PK. These would be good examples to add to the seed-data section in the docs.
Last active 11 days ago
12 replies
3 views