Skip to content

Commit d7d983d

Browse files
committed
fixing migrations
1 parent 1f52caf commit d7d983d

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

aragorm/engine/postgres.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def __init__(self, engine):
1818
self.engine = engine
1919
self.queries = []
2020

21-
def add(self, query):
22-
self.queries.append(query)
21+
def add(self, *query: str):
22+
self.queries += list(query)
2323

2424
async def run(self):
2525
connection = await asyncpg.connect(**self.engine.config)

aragorm/migration.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,6 @@ def _get_config() -> dict:
116116
return db
117117

118118

119-
async def run_in_transaction(coroutine):
120-
# TODO .... wrap in transaction ...
121-
await coroutine()
122-
123-
124119
@click.command()
125120
def forwards():
126121
"""
@@ -144,9 +139,7 @@ def forwards():
144139

145140
for _id in (set(ids) - set(already_ran)):
146141
asyncio.run(
147-
run_in_transaction(
148-
MIGRATION_MODULES[_id].forwards()
149-
)
142+
MIGRATION_MODULES[_id].forwards()
150143
)
151144

152145
print(f'Ran {_id}')
@@ -198,7 +191,9 @@ def backwards(migration_name: str):
198191
sys.exit(1)
199192

200193
print(migration_name)
201-
MIGRATION_MODULES[s].backwards() # type: ignore
194+
asyncio.run(
195+
MIGRATION_MODULES[s].backwards() # type: ignore
196+
)
202197

203198
Migration.delete().where(
204199
Migration.name == s

0 commit comments

Comments
 (0)