Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres seed #21

Merged
merged 4 commits into from
Jul 16, 2024
Merged

Postgres seed #21

merged 4 commits into from
Jul 16, 2024

Conversation

nirapx
Copy link
Contributor

@nirapx nirapx commented Jul 15, 2024

No description provided.

@avivpxi
Copy link
Collaborator

avivpxi commented Jul 15, 2024

@nirapx I'm not seeing anything postgress specific in this package...seems like it can be called sql seed and work just as well. Wouldn't it?

@nirapx
Copy link
Contributor Author

nirapx commented Jul 16, 2024

@avivpxi the insert statement is a bit different:
https://stackoverflow.com/a/52341791

I can generalize this usage if you think it's better. In this case, I'll need to pass one more tag for each field

@avivpxi
Copy link
Collaborator

avivpxi commented Jul 16, 2024

Got it. Then let's keep it postgress.
One last thing, can you run a quick search to make sure no mongo related stuff slipped by from the copy paste phase? Look for mongo references or other stuff. I see that we still have collection and document which need to be changed to table and row.

@nirapx
Copy link
Contributor Author

nirapx commented Jul 16, 2024

@avivpxi done

ClientProvider func() (*sql.DB, error) `json:"-"`

// Setup - a string that contains the SQL setup script to run before seeding the data.
Setup string `json:"-"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have json tag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added. where is it being used?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Envite can be used as a cli tool using yaml files...this allows parsing external yaml/json

// SeedTableData represents data for a Postgres table.
type SeedTableData struct {
// TableName - the name of the target postgres table
TableName string `json:"table,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you align json tag with field name? table_name

@avivpxi
Copy link
Collaborator

avivpxi commented Jul 16, 2024

@nirapx added 2 last comments

@nirapx nirapx merged commit a70935a into main Jul 16, 2024
4 checks passed
@nirapx nirapx deleted the postgres-seed branch July 16, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants