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

Group seeds by top level model + plus data tables #28

Merged
merged 3 commits into from
Aug 28, 2023

Conversation

kaspth
Copy link
Owner

@kaspth kaspth commented Aug 28, 2023

We're moving further away from Fixtures 1-1 where a file maps to one table.
We started this by allowing updates to multiple models in one file, but now we're adding
an additional conceptual layer to help reveal apps' systems.

We'll be recommending that apps have files for their top-level model: their account concept.
Which could be Account, Team, Organization, etc.

This way, we still get the slice of the world that fixtures are good at, but way easier to
understand how things connect because they're all hanging off that top-level model.

I'm also recommending a test/seeds/data folder for any clear data-tables that apps need, which also contain production data.

kaspth added 3 commits August 28, 2023 18:16
We're moving further away from Fixtures 1-1 where a file maps to one table.
We started this by allowing updates to multiple models in one file, but now we're adding
an additional conceptual layer to help reveal apps' systems.

We'll be recommending that apps have files for their top-level model: their account concept.
Which could be Account, Team, Organization, etc.

This way, we still get the slice of the world that fixtures are good at, but way easier to
understand how things connect because they're all hanging off that top-level model.

I'm also recommending a `test/seeds/data` folder for any clear data-tables that apps need, which also contain production data.
Comments are usually attached to posts and their user creator's, whereas plans are
tables we want to ensure are in the database from the get-go.

I'm also swapping our test check to `after_save` to prevent a silent failure where the record
is already in the DB and then won't trigger `after_create`.
@kaspth kaspth merged commit 0aac4d8 into main Aug 28, 2023
@kaspth kaspth deleted the seeds-by-top-level-model branch August 28, 2023 16:38
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.

1 participant