-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[db] Fix duplicate calls to recreate tables on startup #10919
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
🦋 Changeset detectedLatest commit: 3b014fd The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Does this mean you can't access things from the Vite part anymore inside seeding? ex: content collections using |
|
@Princesseuh This is correct, though this was in an inconsistent state before as it did not work with |
I am myself 😅 Both for |
delucis
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.
Approving in principle as #NWTWWHB — happy to let you figure out what makes sense w/r/t availability of other virtual modules. Seems nice to do if possible (maybe in a follow-up PR?)
Spotted a bit of unused code which I’m not sure why linting isn’t flagging?
This reverts commit 558e2de.
This reverts commit ffd004e.
Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: Chris Swithinbank <[email protected]>
145409d to
1b41be4
Compare
* feat: load seed files with full vite dev server * chore: remove unused export
Changes
This simplifies table initialization by pulling table creation and seeding out of Vite.
Before
astro:dbis loadedastro:dbcallsrecreateTableswith top-levelawait.astro:dbcallsseedLocal()with top-levelawait. Seed files are loaded as Vite modules.After
astro:dbis loadedrecreateTablesis called.db executeCLI command.Changes
astro:db:seedvirtual module used for deduping. This dramatically simplifies the DB vite plugin by removing theresolveIdspecial case.invalidateModule()call on theastro:dbmodule, which introduced a race condition when unit testing. This removal means that, if you edit the seed file, we no longer "eagerly" re-seed the database; you still need to refresh your dev server to trigger a seed. We still have eager seeding on dev startup though, so SQLite inspectors should still have a nice experience.seed-local.tsqueries.jsout of runtime and into core. Less code shipped to SSR!Testing
Ensure all tests still pass. Also tested against
@astrojs/web-vitalsto ensure tests pass when this merges.Docs
N/A