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

[FeatureRequest] generate defineTable ts code with mammoth-cli #191

Open
xialvjun opened this issue Dec 11, 2020 · 4 comments
Open

[FeatureRequest] generate defineTable ts code with mammoth-cli #191

xialvjun opened this issue Dec 11, 2020 · 4 comments

Comments

@xialvjun
Copy link

xialvjun commented Dec 11, 2020

So we can include it in our build process.

@xialvjun xialvjun changed the title [Feature] generate defineTable ts code with mammoth-cli [FeatureRequest] generate defineTable ts code with mammoth-cli Dec 11, 2020
@martijndeh
Copy link
Contributor

And based on what should the defineTable() calls be generated? Your database schema or your migrations or what are you thinking?

@xialvjun
Copy link
Author

> mammoth generate -c postgres://localhost/my_db -o src/tables.ts
# Now my_db should have a table 'migration' and with a migration record. And comes out two files 'migrations/001.sql' and 'src/tables.ts'

Well, in this use case, we don't need to include it in ci.

@martijndeh
Copy link
Contributor

Right, so you want to generate all your defineTable() calls based your existing schema.

Question: when you introduce a new table, how do you do that? Do you not write your own defineTable call? Or do you only want to generate the defineTable calls once so you can more easily start using Mammoth?

@xialvjun
Copy link
Author

There are just 2 development mode:

  1. Manage the database schema with other things. Use mammoth generate and integrate with CI to help development;
  2. Manage the database schema with mammoth migrate. I think we can have mammoth test -c postgres://localhost/my_db in CI to check if anyone modify database schema.

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

No branches or pull requests

2 participants