mirror of
https://github.com/ilyakooo0/reshape.git
synced 2024-10-26 18:17:49 +03:00
9f23ed38c1
Before, we explicitly tracked the current schema and relied on that in our migrations. This makes things more complicated as we need to keep track of not just tables and columns but also primary keys, constraints etc. This commit remove the schema tracking and instead queries the database for the current schema. During migrations, we temporarily store the changes that are made, for example having temporary columns override real ones and combine these with the current schema in the database. This is handled in schema.rs. These changes also broke our previously handling of triggers and functions and how we detected if an insert/update was made against the old or new schema during a migration. The previous method, using a temporary __reshape_is_new column has been replaced with some helper functions which inspect the search_path setting and uses that to determine which schema is being used. During migrations, we can also set the custom "reshape.is_old_schema" setting to force the old schema, for example during batch updates. This greatly simplifies the triggers as we can now simply call a helper function in Postgres, `reshape.is_old_schema()`, to determine which schema the modification was made for.
16 lines
334 B
TOML
16 lines
334 B
TOML
[package]
|
|
name = "reshape"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[dependencies]
|
|
postgres = { version = "0.19.2", features = ["with-serde_json-1"] }
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|
|
typetag = "0.1.7"
|
|
anyhow = "1.0.44"
|
|
clap = "3.0.0-beta.5"
|
|
toml = "0.5"
|
|
version = "3.0.0"
|
|
colored = "2"
|
|
bimap = "0.6.1" |