fixed another org id issue with merger
This commit is contained in:
@ -1806,6 +1806,7 @@
|
||||
" \"id\",",
|
||||
" \"modified_at\",",
|
||||
" \"modified_by\",",
|
||||
" \"organization_id\",",
|
||||
" \"type\"",
|
||||
")",
|
||||
"VALUES (",
|
||||
@ -1814,6 +1815,7 @@
|
||||
" '{{uuid:customer_id}}',",
|
||||
" '{{timestamp}}',",
|
||||
" '00000000-0000-0000-0000-000000000000',",
|
||||
" 'ffffffff-ffff-ffff-ffff-ffffffffffff',",
|
||||
" 'person'",
|
||||
")"
|
||||
],
|
||||
@ -1869,6 +1871,7 @@
|
||||
" \"date_of_birth\":\"2000-01-01\",",
|
||||
" \"first_name\":\"Bob\",",
|
||||
" \"last_name\":\"Smith\",",
|
||||
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||
" \"type\":\"person\"",
|
||||
" }',",
|
||||
" '{{uuid:customer_id}}',",
|
||||
@ -1964,12 +1967,14 @@
|
||||
" \"last_name\":\"Smith\",",
|
||||
" \"modified_at\":\"{{timestamp}}\",",
|
||||
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
|
||||
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||
" \"type\":\"person\"",
|
||||
" },",
|
||||
" \"new\":{",
|
||||
" \"date_of_birth\":\"2000-01-01\",",
|
||||
" \"first_name\":\"Bob\",",
|
||||
" \"last_name\":\"Smith\",",
|
||||
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||
" \"type\":\"person\"",
|
||||
" }",
|
||||
" }')"
|
||||
@ -3368,6 +3373,7 @@
|
||||
" \"id\",",
|
||||
" \"modified_at\",",
|
||||
" \"modified_by\",",
|
||||
" \"organization_id\",",
|
||||
" \"type\"",
|
||||
")",
|
||||
"VALUES (",
|
||||
@ -3376,6 +3382,7 @@
|
||||
" '{{uuid:person_id}}',",
|
||||
" '{{timestamp}}',",
|
||||
" '{{uuid}}',",
|
||||
" 'ffffffff-ffff-ffff-ffff-ffffffffffff',",
|
||||
" 'person'",
|
||||
")"
|
||||
],
|
||||
@ -3428,6 +3435,7 @@
|
||||
" '{",
|
||||
" \"first_name\":\"Const\",",
|
||||
" \"last_name\":\"Person\",",
|
||||
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||
" \"type\":\"person\"",
|
||||
" }',",
|
||||
" '{{uuid:person_id}}',",
|
||||
@ -3634,11 +3642,13 @@
|
||||
" \"last_name\":\"Person\",",
|
||||
" \"modified_at\":\"{{timestamp}}\",",
|
||||
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
|
||||
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||
" \"type\":\"person\"",
|
||||
" },",
|
||||
" \"new\":{",
|
||||
" \"first_name\":\"Const\",",
|
||||
" \"last_name\":\"Person\",",
|
||||
" \"organization_id\":\"ffffffff-ffff-ffff-ffff-ffffffffffff\",",
|
||||
" \"type\":\"person\"",
|
||||
" }",
|
||||
" }')"
|
||||
|
||||
@ -135,14 +135,18 @@ impl Merger {
|
||||
schema: &Arc<crate::database::schema::Schema>,
|
||||
) {
|
||||
if !relative.contains_key("organization_id") {
|
||||
if let Some(org_id) = entity_fields.get("organization_id") {
|
||||
if let Some(compiled_props) = schema.obj.compiled_properties.get() {
|
||||
if let Some(org_schema) = compiled_props.get("organization_id") {
|
||||
if org_schema.obj.const_.is_some() {
|
||||
return;
|
||||
}
|
||||
let mut const_val: Option<Value> = None;
|
||||
if let Some(compiled_props) = schema.obj.compiled_properties.get() {
|
||||
if let Some(org_schema) = compiled_props.get("organization_id") {
|
||||
if let Some(c) = &org_schema.obj.const_ {
|
||||
const_val = Some(c.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(c) = const_val {
|
||||
relative.insert("organization_id".to_string(), c);
|
||||
} else if let Some(org_id) = entity_fields.get("organization_id") {
|
||||
relative.insert("organization_id".to_string(), org_id.clone());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user