fix: recupera trabalho perdido no squash merge e corrige schema/dataload contra o banco real - #13
Merged
Merged
Conversation
…lign schema with production pr #12 was squash-merged keeping only its first commit (schema.sql username/banner) -- the six commits after it (dataload split into auth/core connections, column-name fixes, csv-driven text/images, connection.py and makefile fixes, databases.py removal) never made it into main. This restores all of that from the feat/user-profile-fields branch, plus new fixes found by actually running dataload against the real qa databases: - company.fk_address/fk_business_contact, local_unit.fk_address, technician_affiliation.fk_company, technical_project.fk_requester/ fk_local_unit/status/start_date are NOT NULL in the real schema -- dataload was treating them as optional. - certification has a completely different real structure (fk_technician, type and information required; name/issuer/ description/validity optional) -- rewritten to match, and moved after seed_technician in the seed order since it now depends on it. - technical_company is a real table this schema never had (added, no seed yet -- not part of the current ask). - federated_identity and inventory have composite UNIQUE constraints that random picks with replacement could violate at higher row counts -- both now sample without replacement/dedupe. - db/core/seed.sql's second company insert was missing fk_address/ fk_business_contact for the same reason. Verified end to end against the real coredbqa/authdbqa (qa environment, credentials via infra-platform/scripts/extract-env.ps1): both databases seed cleanly with no errors.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Objetivo
Duas coisas, descobertas ao rodar o
dataloadde verdade contra oqa:com
username/banner). Os outros 6 commits depois dele — areestruturação do
dataload.py(conexões separadas auth/core), ascorreções de coluna, os CSVs de imagem/texto em português,
connection.py/Makefile, remoção descripts/databases.py— nuncaentraram no
main. Esta PR recupera tudo isso a partir da branchfeat/user-profile-fields.db/core/schema.sqle o bancocoredbqade verdade, achados só rodando odataloadcontra ele (aauditoria anterior, feita comparando
schema.sqlcom as entidades Java,não pegou tudo).
Alterações
Recuperado da PR #12 (perdido no squash merge):
dataload.pycom conexões separadas paraauthdb/coredb.connection.py/Makefilecorrigidos (nome de bancolocalvsqa,migrate/resetcom bug de path).scripts/data/catalog/) e banners curados do Unsplash(
scripts/data/cloudinary/banner.csv).scripts/databases.py(substituído por lógica mais simplesem
connection.py).Novo, achado rodando contra
coredbqa/authdbqareais:company.fk_address/fk_business_contact,local_unit.fk_address,technician_affiliation.fk_company,technical_project.fk_requester/fk_local_unit/status/start_datesão
NOT NULLno banco real — odataload.pytratava como opcionais(
maybe()). Corrigido.certificationtem estrutura bem diferente na realidade(
fk_technician,type,informationobrigatórios;name/issuer/description/validityopcionais) — reescreviseed_certificationemovi pra rodar depois de
seed_technician(agora depende dele).technical_companyexiste no banco real e eu não sabia —adicionada ao
schema.sql/migration (sem seed próprio ainda, fora dopedido original).
federated_identity(UNIQUE(user_id, issuer)) einventory(
UNIQUE(fk_supplier, fk_model)) têm constraints compostas que o sorteioaleatório com reposição violava em volumes maiores — corrigido pra
sortear sem reposição/deduplicar.
db/core/seed.sql: o segundoINSERT INTO companytambém não tinhafk_address/fk_business_contact— mesmo problema, corrigido.Endpoints afetados
Nenhum (mudanças de schema/seed/dataload, sem tocar em API)
Banco de Dados
Como validar
Já validei isso de verdade, duas vezes: uma vez contra um Postgres
descartável local, e uma vez contra o
coredbqa/authdbqareais (comALTER TABLEaplicado manualmente por você pra adicionarusername/banner, já que a PR #12 nunca migrou o banco de verdade — sóa entidade Java). As duas rodaram de ponta a ponta sem erro.
Evidências
Sem evidências visuais (mudança de schema/dados, não de UI)
Closes #