-
Notifications
You must be signed in to change notification settings - Fork 2
Add schema support #17
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
Conversation
7885ff6 to
364b48b
Compare
364b48b to
b2fd746
Compare
b2fd746 to
c84d061
Compare
guillaumervls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides comments in the code:
- it's probably simpler that
instantNeonaccepts ~ the same argument structure as the vite plugin. - less terms/names is better, so I'd go either for "seed" or "onCreate". Probably seed is actually better than "onCreate", so the
onCreatewould be better namedseed.
guillaumervls
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you removed schema.json, probably those lines can be simplified in the release workflow file https://github.com/neondatabase/neondb-cli/blob/c1bf20c61bd64f35a071f74e95efadca56dd2765/.github/workflows/release.yml#L80-L94
24d481f to
4bd6fb0
Compare
|
(we're getting there! 🙌 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for seeding a SQL script during database initialization. Key changes include:
- Modifying the InstantNeon API and postgresPlugin to accept a new seed option.
- Introducing a new CLI flag to specify a SQL file for seeding.
- Updating documentation, examples, and changelogs accordingly.
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/vite-plugin-postgres/src/index.ts | Updated options to use InstantNeonParams and forward the seed option. |
| packages/vite-plugin-postgres/README.md | Documented the new seed option and provided usage examples. |
| packages/neondb/src/lib/utils/args.ts | Added new CLI flag (sql) for specifying the seed file; updates to help text. |
| packages/neondb/src/lib/types.ts | Added the SqlScript type and updated InstantNeonParams with seed support. |
| packages/neondb/src/lib/seed-database.ts | Introduced a function to execute SQL seed commands after DB creation. |
| packages/neondb/src/lib/instant-neon.ts | Integrated seed support to push the schema if provided. |
| packages/neondb/src/cli.ts | Modified CLI logic to prompt/handle the seed file flag and pass through. |
| Other files (package.json, examples, changsets) | Updated scripts, examples, and changelogs for the new schema seeding feature. |
Comments suppressed due to low confidence (1)
packages/neondb/src/lib/utils/args.ts:26
- The CLI flag for specifying the SQL seed file is defined as 'sql' here, but the documentation and examples reference '--seed'. Consider aligning the flag name across the code and documentation for consistency.
sql: {
This PR adds support to SQL seed scripts
To test it
/examples/tanstack-startschema.sqlon root of this app, adjust the schema to your needsEasiest way to confirm the schema and data have been pushed is to claim the newly created DB to your account and check on Neon's Console.