Skip to content

Commit 48633ea

Browse files
committed
add multiple changelogs test
1 parent 6efbd73 commit 48633ea

19 files changed

+58
-17042
lines changed

pum/schema_migrations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def baseline(self, conn: Connection) -> str:
193193
WHERE id = (
194194
SELECT id
195195
FROM {schema_migrations_table}
196-
ORDER BY date_installed DESC
196+
ORDER BY version DESC, date_installed DESC
197197
LIMIT 1
198198
)
199199
"""
@@ -225,7 +225,7 @@ def migration_details(self, conn: Connection, version: str = None) -> dict:
225225
WHERE id = (
226226
SELECT id
227227
FROM {schema_migrations_table}
228-
ORDER BY date_installed DESC
228+
ORDER BY version DESC, date_installed DESC
229229
LIMIT 1
230230
)
231231
ORDER BY date_installed DESC

pum/upgrader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ def __apply_changelog(
235235
"""
236236
files = self.changelog_files(changelog)
237237
for file in files:
238-
execute_sql(conn=conn, sql=file, commit=commit, parameters=parameters)
238+
try:
239+
execute_sql(conn=conn, sql=file, commit=commit, parameters=parameters)
240+
except Exception as e:
241+
raise PumException(f"Error applying changelog {file}: {e}") from e
239242
return files
240243

241244
def __run_delta_sql(self, delta):

test/data/create_northwind_1.0.1.sql

Lines changed: 0 additions & 3878 deletions
This file was deleted.

test/data/create_northwind_1.0.2.sql

Lines changed: 0 additions & 3878 deletions
This file was deleted.

test/data/create_northwind_1.1.0.sql

Lines changed: 0 additions & 3878 deletions
This file was deleted.

0 commit comments

Comments
 (0)