fix(habits): preserve task state and original occurrence expiry

This commit is contained in:
syntaxbullet
2026-09-04 09:46:22 +02:00
parent 724b1423eb
commit 18a1af9dfc
7 changed files with 783 additions and 6 deletions

View File

@@ -37,7 +37,7 @@ export const habitDays = sqliteTable('habit_days', {
}, t => [index('habit_days_lookup_idx').on(t.habitId, t.date, t.revisionId)]);
export const taskOccurrences = sqliteTable('task_occurrences', {
id: text('id').primaryKey(), dayId: integer('day_id').notNull().references(() => habitDays.id), taskId: text('task_id').notNull(), name: text('name').notNull(),
done: integer('done', { mode: 'boolean' }).notNull().default(false), expiredAt: integer('expired_at'), updatedAt: integer('updated_at').notNull(),
done: integer('done', { mode: 'boolean' }).notNull().default(false), expiredAt: integer('expired_at'), closedAt: integer('closed_at'), updatedAt: integer('updated_at').notNull(),
}, t => [index('task_occurrences_day_idx').on(t.dayId)]);
export const progressEvents = sqliteTable('progress_events', {
id: integer('id').primaryKey({ autoIncrement: true }), dayId: integer('day_id').notNull().references(() => habitDays.id), occurrenceId: text('occurrence_id'),