From 704738777a7bcbec4caf6fabf89698fb3360fb4c Mon Sep 17 00:00:00 2001 From: mARTin Date: Tue, 10 Mar 2026 15:59:37 +0100 Subject: [PATCH] fix: add missing migrations and fix deploy script failures - Fix setval(0) error in accountNumber migration (use GREATEST(..., 1)) - Add migration for dateVerticalAlign, dayHeaderGap, weekday settings, quoteLanguages - Deploy scripts now fall back to db push if migrate deploy fails v1.22.3 --- package.json | 2 +- .../migration.sql | 2 +- .../migration.sql | 13 +++++++++++++ scripts/boot-update.sh | 5 ++++- scripts/update-server.sh | 5 ++++- 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 prisma/migrations/20260310_add_weekday_date_quote_settings/migration.sql diff --git a/package.json b/package.json index 21f7658..b47c954 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.22.2", + "version": "1.22.3", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "main": "index.js", "scripts": { diff --git a/prisma/migrations/20260301_add_account_projects_cache_settings/migration.sql b/prisma/migrations/20260301_add_account_projects_cache_settings/migration.sql index b8208f1..9a3276d 100644 --- a/prisma/migrations/20260301_add_account_projects_cache_settings/migration.sql +++ b/prisma/migrations/20260301_add_account_projects_cache_settings/migration.sql @@ -13,7 +13,7 @@ BEGIN counter := counter + 1; END LOOP; -- Set sequence to continue after the highest assigned number - PERFORM setval('"User_accountNumber_seq"', COALESCE((SELECT MAX("accountNumber") FROM "User"), 0)); + PERFORM setval('"User_accountNumber_seq"', GREATEST(COALESCE((SELECT MAX("accountNumber") FROM "User"), 1), 1)); END $$; CREATE UNIQUE INDEX IF NOT EXISTS "User_accountNumber_key" ON "User"("accountNumber"); diff --git a/prisma/migrations/20260310_add_weekday_date_quote_settings/migration.sql b/prisma/migrations/20260310_add_weekday_date_quote_settings/migration.sql new file mode 100644 index 0000000..7c55458 --- /dev/null +++ b/prisma/migrations/20260310_add_weekday_date_quote_settings/migration.sql @@ -0,0 +1,13 @@ +-- User: add dateVerticalAlign +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "dateVerticalAlign" TEXT DEFAULT 'middle'; + +-- User: add dayHeaderGap +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "dayHeaderGap" TEXT DEFAULT '0.75em'; + +-- User: add weekday display settings +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "weekdayFormat" TEXT DEFAULT 'long'; +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "weekdayCase" TEXT DEFAULT 'capitalize'; +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "customWeekdayNames" TEXT DEFAULT ''; + +-- User: add quoteLanguages +ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "quoteLanguages" TEXT[] DEFAULT ARRAY['en','de']::TEXT[]; diff --git a/scripts/boot-update.sh b/scripts/boot-update.sh index 710d868..1d067bd 100755 --- a/scripts/boot-update.sh +++ b/scripts/boot-update.sh @@ -45,7 +45,10 @@ fi if [ ! -d "$NEXT_DIR" ] || [ "$LOCAL" != "$REMOTE" ]; then log "Updating database schema (Safe Migrate)..." - npx prisma migrate deploy 2>&1 | tee -a "$LOG_FILE" + npx prisma migrate deploy 2>&1 | tee -a "$LOG_FILE" || { + log "migrate deploy failed, falling back to db push..." + npx prisma db push --accept-data-loss 2>&1 | tee -a "$LOG_FILE" + } log "Regenerating Prisma client..." npx prisma generate 2>&1 | tee -a "$LOG_FILE" diff --git a/scripts/update-server.sh b/scripts/update-server.sh index f31751c..0db40c0 100755 --- a/scripts/update-server.sh +++ b/scripts/update-server.sh @@ -22,7 +22,10 @@ echo -e "${YELLOW}[2/6] Installing dependencies...${NC}" npm install echo -e "${YELLOW}[3/6] Running database migrations...${NC}" -npx prisma migrate deploy +npx prisma migrate deploy || { + echo -e "${YELLOW} migrate deploy failed, falling back to db push...${NC}" + npx prisma db push --accept-data-loss +} npx prisma generate echo -e "${YELLOW}[4/6] Building application...${NC}"