mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-05-21 15:11:22 -05:00
[PR #230] [MERGED] fix: rewrite migration 0009 for SQLite compatibility #2890
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/RayLabsHQ/gitea-mirror/pull/230
Author: @arunavo4
Created: 3/15/2026
Status: ✅ Merged
Merged: 3/15/2026
Merged by: @arunavo4
Base:
main← Head:fix/migration-0009-sqlite-compat📝 Commits (1)
74f0abefix: rewrite migration 0009 for SQLite compatibility and add migration validation📊 Changes
6 files changed (+439 additions, -25 deletions)
View changed files
📝
.github/workflows/astro-build-test.yml(+6 -0)📝
drizzle/0009_nervous_tyger_tiger.sql(+148 -23)📝
package.json(+1 -0)➕
scripts/validate-migrations.ts(+212 -0)📝
src/lib/db/index.ts(+46 -2)➕
src/lib/db/migrations.test.ts(+26 -0)📄 Description
Summary
ALTER TABLE ADD COLUMN ... DEFAULT (unixepoch()), which SQLite rejects for expression defaultsscripts/validate-migrations.ts) with SQLite-specific lint rules and upgrade-path testing with seeded datasrc/lib/db/index.tsfor users who may have a stale migration record from the broken releaseContext
v3.13.0 shipped with a Drizzle-kit auto-generated migration that used
ALTER TABLE repositories ADD imported_at integer DEFAULT (unixepoch()) NOT NULL. SQLite rejects this because expression defaults are not allowed inALTER TABLE ADD COLUMN. This caused all upgrades from v3.12.x to fail at startup (#228, #229).Prevention layers
Test plan
bun test:migrationspasses (lint + from-scratch + upgrade path)bun test src/lib/db/migrations.test.tspassesDEFAULT (expr)andDEFAULT CURRENT_TIMESTAMPin ALTER TABLEFixes #228
Fixes #229
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.