Se eliminaron scripts de ayuda
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
from core.database import CoreSessionLocal
|
||||
from api.v1.modules.public.reference_data.invoice_types.models import InvoiceType
|
||||
from api.v1.modules.public.reference_data.invoice_types.seed import seed
|
||||
|
||||
def sync_invoice_types():
|
||||
db = CoreSessionLocal()
|
||||
try:
|
||||
for s in seed:
|
||||
key, description, note, type_, operation = s
|
||||
obj = db.query(InvoiceType).filter(InvoiceType.key == key).first()
|
||||
if obj:
|
||||
print(f"Updating {key}...")
|
||||
obj.description = description
|
||||
obj.note = note
|
||||
obj.type = type_
|
||||
obj.operation = operation
|
||||
else:
|
||||
print(f"Creating {key}...")
|
||||
obj = InvoiceType(
|
||||
key=key,
|
||||
description=description,
|
||||
note=note,
|
||||
type=type_,
|
||||
operation=operation
|
||||
)
|
||||
db.add(obj)
|
||||
db.commit()
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
db.rollback()
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
sync_invoice_types()
|
||||
Reference in New Issue
Block a user