summer_course_2024/db_migration.py

19 lines
574 B
Python
Raw Normal View History

"""
Migration script to create postgresql tables
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Peter Yefi peteryefi@gmail.com
"""
from sqlalchemy import create_engine
from persistence.db_config import BaseConfiguration
from persistence.models import Building
from persistence.models import City
if __name__ == '__main__':
config = BaseConfiguration()
engine = create_engine(config.conn_string())
City.__table__.create(bind=engine, checkfirst=True)
Building.__table__.create(bind=engine, checkfirst=True)