fix(core): soft-delete source connections with deleted_at
Migration 0003 adds source_connections.deleted_at. deleteConnection sets it; listing, lookups, updates, the scheduler and the sync handler ignore deleted connections, so a paused credential-less connection stays visible and can be resumed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0a540208e1
commit
e3a759d768
@@ -0,0 +1,13 @@
|
||||
import type { Kysely } from "kysely";
|
||||
import type { Migration } from "kysely/migration";
|
||||
|
||||
/** Soft delete for source connections: a deleted connection is distinct from one the user merely paused. */
|
||||
export const sourceConnectionsDeletedAt: Migration = {
|
||||
async up(db: Kysely<any>) {
|
||||
await db.schema.alterTable("source_connections").addColumn("deleted_at", "text").execute();
|
||||
},
|
||||
|
||||
async down(db: Kysely<any>) {
|
||||
await db.schema.alterTable("source_connections").dropColumn("deleted_at").execute();
|
||||
},
|
||||
};
|
||||
@@ -1,9 +1,11 @@
|
||||
import type { Migration } from "kysely/migration";
|
||||
import { initial } from "./0001_initial.ts";
|
||||
import { worksPositionUnique } from "./0002_works_position_unique.ts";
|
||||
import { sourceConnectionsDeletedAt } from "./0003_source_connections_deleted_at.ts";
|
||||
|
||||
/** All migrations, keyed by sortable name. Imported statically so bundles need no filesystem. */
|
||||
export const migrations: Record<string, Migration> = {
|
||||
"0001_initial": initial,
|
||||
"0002_works_position_unique": worksPositionUnique,
|
||||
"0003_source_connections_deleted_at": sourceConnectionsDeletedAt,
|
||||
};
|
||||
|
||||
@@ -269,6 +269,8 @@ export interface SourceConnectionsTable {
|
||||
status: ConnectionStatus;
|
||||
last_run_at: string | null;
|
||||
created_at: string;
|
||||
/** Set by `deleteConnection`; deleted connections are hidden, never scheduled and never synced. */
|
||||
deleted_at: string | null;
|
||||
}
|
||||
|
||||
export interface SourceRunsTable {
|
||||
|
||||
Reference in New Issue
Block a user