Database migration #45

Merged
Miroslavsckaya merged 8 commits from database_migration into master 2022-08-21 20:43:36 +00:00
Showing only changes of commit d3d33bb718 - Show all commits

View file

@ -11,7 +11,7 @@ class Database:
"""Implement interaction with the database."""
def __init__(self, dsn: str, log: Logger) -> None:
"""Create a database file if not exists."""
"""Create a database if not exists."""
self.log: Logger = log
self.log.debug('Database.__init__(DSN=\'%s\')', dsn)
self.conn: connection = psycopg2.connect(dsn)
@ -158,6 +158,8 @@ class Database:
self.conn.commit()
def __migrate(self, dsn: str) -> None:
skobkin marked this conversation as resolved
Review

Catch and log some errors maybe? 🙂

Catch and log some errors maybe? 🙂
"""Migrate or initialize database shema"""
self.log.debug(f'Database.__migrate(dsn={dsn})')
backend = get_backend(dsn)
migrations = read_migrations('./migrations')