diff --git a/services/mana-core-auth/src/db/migrations/0002_fix_session_columns.sql b/services/mana-core-auth/src/db/migrations/0002_fix_session_columns.sql new file mode 100644 index 000000000..4a4b5209a --- /dev/null +++ b/services/mana-core-auth/src/db/migrations/0002_fix_session_columns.sql @@ -0,0 +1,16 @@ +-- Fix missing session columns using native PostgreSQL syntax +-- This is more reliable than DO blocks for Drizzle migrations + +ALTER TABLE "auth"."sessions" ADD COLUMN IF NOT EXISTS "refresh_token" text; +--> statement-breakpoint +ALTER TABLE "auth"."sessions" ADD COLUMN IF NOT EXISTS "refresh_token_expires_at" timestamp with time zone; +--> statement-breakpoint +ALTER TABLE "auth"."sessions" ADD COLUMN IF NOT EXISTS "device_id" text; +--> statement-breakpoint +ALTER TABLE "auth"."sessions" ADD COLUMN IF NOT EXISTS "device_name" text; +--> statement-breakpoint +ALTER TABLE "auth"."sessions" ADD COLUMN IF NOT EXISTS "last_activity_at" timestamp with time zone DEFAULT now(); +--> statement-breakpoint +ALTER TABLE "auth"."sessions" ADD COLUMN IF NOT EXISTS "revoked_at" timestamp with time zone; +--> statement-breakpoint +ALTER TABLE "auth"."sessions" ADD COLUMN IF NOT EXISTS "remember_me" boolean DEFAULT false; diff --git a/services/mana-core-auth/src/db/migrations/meta/0002_snapshot.json b/services/mana-core-auth/src/db/migrations/meta/0002_snapshot.json new file mode 100644 index 000000000..cc14b3a6b --- /dev/null +++ b/services/mana-core-auth/src/db/migrations/meta/0002_snapshot.json @@ -0,0 +1,15 @@ +{ + "id": "0002_fix_session_columns", + "prevId": "0001_add_missing_session_columns", + "version": "7", + "dialect": "postgresql", + "tables": {}, + "enums": {}, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/services/mana-core-auth/src/db/migrations/meta/_journal.json b/services/mana-core-auth/src/db/migrations/meta/_journal.json index 9899c63dd..03344b8be 100644 --- a/services/mana-core-auth/src/db/migrations/meta/_journal.json +++ b/services/mana-core-auth/src/db/migrations/meta/_journal.json @@ -5,16 +5,23 @@ { "idx": 0, "version": "7", - "when": 1766081368788, + "when": 1734500000000, "tag": "0000_naive_scorpion", "breakpoints": true }, { "idx": 1, "version": "7", - "when": 1734555600000, + "when": 1734550000000, "tag": "0001_add_missing_session_columns", "breakpoints": true + }, + { + "idx": 2, + "version": "7", + "when": 1734560000000, + "tag": "0002_fix_session_columns", + "breakpoints": true } ] }