mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-16 06:08:33 -05:00
[PR #2769] [CLOSED] Refactor migration scripts for safe column removals and roleId handling #7952
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/pangolin/pull/2769
Author: @marcschaeferger
Created: 4/2/2026
Status: ❌ Closed
Base:
main← Head:rc-fixes📝 Commits (3)
fef9bd6fix(migration/postgres): Update migration script to handle column removals safely453876bfix(migration/sqlite): Refactor roleId handling in userOrg and userInvite migrations38d24d4Fix catch blocks in 1.17.0 migration to only swallow missing-column errors📊 Changes
2 files changed (+94 additions, -30 deletions)
View changed files
📝
server/setup/scriptsPg/1.17.0.ts(+51 -16)📝
server/setup/scriptsSqlite/1.17.0.ts(+43 -14)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description (generated by Copilot)
This pull request improves the robustness and idempotency of the 1.17.0 database migration scripts for both PostgreSQL and SQLite backends. The changes ensure that migrations can be safely run on databases that may already have some schema changes applied (such as from release candidate upgrades), preventing crashes and errors due to missing columns or constraints.
PostgreSQL migration script improvements (
server/setup/scriptsPg/1.17.0.ts):roleIdcolumns fromuserOrgsanduserInvitesto handle cases where the columns may have already been removed, preventing migration failures on partially-upgraded schemas.DROP CONSTRAINTandDROP COLUMNstatements to useIF EXISTS, making the migration idempotent and preventing errors if the constraints or columns are already absent. [1] [2] [3]SQLite migration script improvements (
server/setup/scriptsSqlite/1.17.0.ts):roleIdcolumns inuserOrgsanduserInvitestables before querying, ensuring migrations work even if those columns were already dropped in previous upgrades.CREATE TABLE IF NOT EXISTSandCREATE UNIQUE INDEX IF NOT EXISTSfor new tables and indexes to avoid errors if the migration is re-run. [1] [2] [3]DROP TABLE IF EXISTSstatements before creating temporary tables to ensure a clean migration state. [1] [2]How to test?
Run Migration
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.