f'Cannot migrate {from_version} to {EXPECTED_DB_VERSION}')
migrations = cls._available_migrations()
migrations_todo = migrations[from_version+1:]
- with sql_connect(path) as conn:
+ with sql_connect(path, autocommit=False) as conn:
for j, filename in enumerate(migrations_todo):
with open(f'{MIGRATIONS_DIR}/{filename}', 'r',
encoding='utf-8') as f:
conn.executescript(f.read())
conn.execute(f'PRAGMA user_version = {from_version + j + 1}')
+ conn.commit()
return cls(path)
def _check(self) -> None: