Legacy superdb -> SafeOps mapping¶
Scope (phase 1)¶
tipologia_cliente->tipologia_clientecliente->clientecliente_tipologia->cliente_tipologiauser_cliente(legacy) ->user_cliente(SafeOps helper table)dipendente+affiliazioni_clienti_dipendenti->dipendente+cliente_dipendente(SafeOps helper tables)
Tenant mapping¶
- Source:
superdb.tenant (id, slug, name) - Target:
safeops.tenant_registry.tenant_key - Default rule:
tenant.slug(normalized) ->tenant_key - Override: CLI option
--target-tenant-key
Geo mapping rules¶
- Legacy
provincia_id-> legacyprovincia.sigla-> localprovincia.sigla - Legacy
comune_id-> local match by: comune.codice_istat- fallback
comune.nome(case-insensitive) - Legacy
stato_id->stato.codice-> localstato.codice
Customer identity rules¶
- Primary match:
(tenant_key, partita_iva) - Secondary match:
(tenant_key, codice_fiscale) - If no match: create new
cliente
User assignment rules¶
- Legacy mapping read from
user_clientejoined to legacyab_user.username - Local target user resolved by
ab_user.username(case-insensitive) - Insert into local
user_cliente(cliente_id, user_id)
Command¶
flask import_legacy_mysql_core \
--legacy-uri "mysql+pymysql://super231:Zaq12wsx_234@10.200.0.150:3309/superdb" \
--dry-run
Example single-tenant forced import:
flask import_legacy_mysql_core \
--legacy-uri "mysql+pymysql://super231:Zaq12wsx_234@10.200.0.150:3309/superdb" \
--legacy-tenant-id 2 \
--target-tenant-key tenant_besant