#7 Decide migration implementation approach

Отворено
отворено пре 2 недеља од kestrel · 0 коментара
kestrel коментирира пре 2 недеља

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.
Пријавите се да се прикључе у овом разговору.
Нема лабеле
Нема фазе
Нема одговорних
1 учесника
Учитавање...
Откажи
Сачувај
Још нема садржаја.