File size: 545 Bytes
0f0ef8d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from banco import SessionLocal
from models import FPSO
FPSO_PADRAO = [
"CDA", "CDP", "CDM", "ADG",
"ESS", "SEP", "CDI", "ATD", "CDS"
]
def main():
db = SessionLocal()
try:
existentes = {f.nome for f in db.query(FPSO).all()}
for nome in FPSO_PADRAO:
if nome not in existentes:
db.add(FPSO(nome=nome))
db.commit()
print("✅ FPSOs padrão inseridos com sucesso!")
finally:
db.close()
if __name__ == "__main__":
main()
|