1234567891011121314151617181920212223242526 |
- from sqlalchemy import create_engine
- from sqlalchemy.orm import sessionmaker
- from time_recoder.time_recoder_config import PATH
- from time_recoder.time_recorder_database.db_models import BASE, Task
- DATABASE_NAME = "time_recorder_database.db"
- ENGINE = create_engine("sqlite+pysqlite:///" + PATH + DATABASE_NAME, echo=False, future=True)
- Session = sessionmaker(bind=ENGINE)
- def main():
- BASE.metadata.create_all(ENGINE)
- def create_root_task():
- session = Session()
- root_task = Task(parent_task_id=-1, name='root')
- session.add(root_task)
- session.commit()
- session.close()
- if __name__ == "__main__":
- main()
|