Idea/proposal for idempotent rust-defined database structure #1663
Replies: 2 comments 3 replies
-
I agree with your points, and I am aware of the difference between "Entity first" sv "Schema first" approaches. I am keen to support the "entity first" approach. What needs to be done are:
If you are interested in working on any part of it, we can have more discussions on the design and implementation. |
Beta Was this translation helpful? Give feedback.
-
Note to self: we have had some disscussions in Discord https://discord.com/channels/873880840487206962/901137465916657714/1110189907550408815 and what's outstanding is how'd we integrate that into the current cli / migration infrastructure. |
Beta Was this translation helpful? Give feedback.
-
This may be out of scope for this ORM, but I had an idea:
Some problems with the current architecture
derive
, andserde(skip)
columns, but what about other column attributes?What if instead of writing migrations, and generating
.rs
files based on the database schema we instead defined the structure of tables in rust (generatingTableDef
s)Taking inspiration from sqldef's idempotent schema management:
DROP
andCREATE
operationsTake this use case
Using sea-schema, we could generate a TableDef from this struct, and then use the
discovery
module of sea-schema to get the current database'sTableDef
, generate a diff and apply the individual changes to get the database to the desired rust-defined state with thewriter
moduleBenefits
Beta Was this translation helpful? Give feedback.
All reactions