kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(migration): update invitation table to add created_at column with default value handling

+16 -1
+16 -1
apps/api/src/utils/migrate-session-column.ts
··· 93 93 94 94 if (hasCreatedAt.rows.length === 0) { 95 95 console.log("📝 Adding created_at column to invitation table..."); 96 + // Add column as nullable first 96 97 await db.execute(sql` 97 98 ALTER TABLE "invitation" 98 - ADD COLUMN "created_at" timestamp DEFAULT NOW() NOT NULL; 99 + ADD COLUMN "created_at" timestamp; 100 + `); 101 + 102 + // Set default value for existing rows (use expires_at - 1 month as a reasonable default) 103 + await db.execute(sql` 104 + UPDATE "invitation" 105 + SET "created_at" = COALESCE("expires_at" - INTERVAL '1 month', NOW()) 106 + WHERE "created_at" IS NULL; 107 + `); 108 + 109 + // Now make it NOT NULL with default 110 + await db.execute(sql` 111 + ALTER TABLE "invitation" 112 + ALTER COLUMN "created_at" SET DEFAULT NOW(), 113 + ALTER COLUMN "created_at" SET NOT NULL; 99 114 `); 100 115 console.log( 101 116 "✅ Successfully added created_at column to invitation table",