⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(migration): update invitation table to add created_at column with default value handling
Andrej Acevski527ae8a21f68
diff --git a/apps/api/src/utils/migrate-session-column.ts b/apps/api/src/utils/migrate-session-column.tsindex 1d36ca89d..c5eef8ff5 100644--- a/apps/api/src/utils/migrate-session-column.ts+++ b/apps/api/src/utils/migrate-session-column.ts@@ -93,9 +93,24 @@ export async function migrateSessionColumn() {if (hasCreatedAt.rows.length === 0) {console.log("📝 Adding created_at column to invitation table...");+ // Add column as nullable firstawait db.execute(sql`ALTER TABLE "invitation"- ADD COLUMN "created_at" timestamp DEFAULT NOW() NOT NULL;+ ADD COLUMN "created_at" timestamp;+ `);++ // Set default value for existing rows (use expires_at - 1 month as a reasonable default)+ await db.execute(sql`+ UPDATE "invitation"+ SET "created_at" = COALESCE("expires_at" - INTERVAL '1 month', NOW())+ WHERE "created_at" IS NULL;+ `);++ // Now make it NOT NULL with default+ await db.execute(sql`+ ALTER TABLE "invitation"+ ALTER COLUMN "created_at" SET DEFAULT NOW(),+ ALTER COLUMN "created_at" SET NOT NULL;`);console.log("✅ Successfully added created_at column to invitation table",