#7 Decide migration implementation approach

Otwarty
otworzone 2 tygodni temu przez kestrel · 0 komentarzy
kestrel skomentował 2 tygodni temu

Broadly speaking, there are two paths forwards for implementing migrations.

Migration approach 1: Column-based

In this approach, a migration consists of a mapper that provides new values for changed entities on a per-entity basis, for each column; possibly this is then followed up with an arbitrary pass to perform more complicated fixups.

Migration approach 2: Type wrapper-based migration

In this approach, a migration consists of a mapper that converts entities of the old schema to entities of the new schema.

Implementation details vary but would probably look something like:

trait NewWrapper<O: Entity, N: Entity> {
    fn map(&mut self, old: O) -> Result<Option<N>>;
}

Other issues

Specifying new Entity types involves recreating every Schema type on the path from the root to the leaf, which could be very obnoxious for some schemata.

Broadly speaking, there are two paths forwards for implementing migrations. #### Migration approach 1: Column-based In this approach, a migration consists of a mapper that provides new values for changed entities on a per-entity basis, for each column; possibly this is then followed up with an arbitrary pass to perform more complicated fixups. #### Migration approach 2: Type wrapper-based migration In this approach, a migration consists of a mapper that converts entities of the old schema to entities of the new schema. Implementation details vary but would probably look something like: ```rust trait NewWrapper<O: Entity, N: Entity> { fn map(&mut self, old: O) -> Result<Option<N>>; } ``` #### Other issues Specifying new Entity types involves recreating every `Schema` type on the path from the root to the leaf, which could be very obnoxious for some schemata.
Zaloguj się, aby dołączyć do tej rozmowy.
Brak etykiety
Brak kamienia milowego
Brak przypisania
1 uczestników
Ładowanie...
Anuluj
Zapisz
Nie ma jeszcze treści.