audit: drop the audit_links table (#416)

This commit is contained in:
Ben Senescu 2026-07-30 20:51:32 -04:00 committed by GitHub
parent 1e8a924c4c
commit 8d6e99385f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 6915 additions and 57 deletions

View File

@ -0,0 +1 @@
DROP TABLE "audit_links" CASCADE;

File diff suppressed because it is too large Load Diff

View File

@ -106,6 +106,13 @@
"when": 1784588248793, "when": 1784588248793,
"tag": "0014_solid_centennial", "tag": "0014_solid_centennial",
"breakpoints": true "breakpoints": true
},
{
"idx": 15,
"version": "7",
"when": 1784610564142,
"tag": "0015_sticky_dagger",
"breakpoints": true
} }
] ]
} }

View File

@ -0,0 +1 @@
DROP TABLE `audit_links`;

File diff suppressed because it is too large Load Diff

View File

@ -267,6 +267,13 @@
"when": 1784588247803, "when": 1784588247803,
"tag": "0037_small_caretaker", "tag": "0037_small_caretaker",
"breakpoints": true "breakpoints": true
},
{
"idx": 38,
"version": "6",
"when": 1784610563184,
"tag": "0038_happy_steel_serpent",
"breakpoints": true
} }
] ]
} }

View File

@ -123,36 +123,8 @@ export const auditPages = sqliteTable(
(table) => [index("audit_pages_audit_url_idx").on(table.auditId, table.url)], (table) => [index("audit_pages_audit_url_idx").on(table.auditId, table.url)],
); );
// One row per unique (source page, target URL) link edge. Currently only // Link edges live in the per-audit AuditScratchpad Durable Object for the
// internal edges are stored (see AuditRepository); isInternal stays so // duration of the crawl; they are never persisted to the app DB.
// external-link checks can start writing rows without a migration.
export const auditLinks = sqliteTable(
"audit_links",
{
id: text("id").primaryKey(),
auditId: text("audit_id")
.notNull()
.references(() => audits.id, { onDelete: "cascade" }),
sourcePageId: text("source_page_id")
.notNull()
.references(() => auditPages.id, { onDelete: "cascade" }),
sourceUrl: text("source_url").notNull(),
targetUrl: text("target_url").notNull(),
anchor: text("anchor"),
isInternal: integer("is_internal", { mode: "boolean" })
.notNull()
.default(true),
isNofollow: integer("is_nofollow", { mode: "boolean" })
.notNull()
.default(false),
},
(table) => [
index("audit_links_audit_target_idx").on(table.auditId, table.targetUrl),
// Cascade path from audit_pages deletes; without this every page delete
// seq-scans the (large) links table.
index("audit_links_source_page_id_idx").on(table.sourcePageId),
],
);
// One row per (issue type, affected page) // One row per (issue type, affected page)
export const auditIssues = sqliteTable( export const auditIssues = sqliteTable(

View File

@ -122,32 +122,8 @@ export const auditPages = pgTable(
(table) => [index("audit_pages_audit_url_idx").on(table.auditId, table.url)], (table) => [index("audit_pages_audit_url_idx").on(table.auditId, table.url)],
); );
// One row per unique (source page, target URL) link edge. Currently only // Link edges live in the per-audit AuditScratchpad Durable Object for the
// internal edges are stored (see AuditRepository); isInternal stays so // duration of the crawl; they are never persisted to the app DB.
// external-link checks can start writing rows without a migration.
export const auditLinks = pgTable(
"audit_links",
{
id: text("id").primaryKey(),
auditId: text("audit_id")
.notNull()
.references(() => audits.id, { onDelete: "cascade" }),
sourcePageId: text("source_page_id")
.notNull()
.references(() => auditPages.id, { onDelete: "cascade" }),
sourceUrl: text("source_url").notNull(),
targetUrl: text("target_url").notNull(),
anchor: text("anchor"),
isInternal: boolean("is_internal").notNull().default(true),
isNofollow: boolean("is_nofollow").notNull().default(false),
},
(table) => [
index("audit_links_audit_target_idx").on(table.auditId, table.targetUrl),
// Cascade path from audit_pages deletes; without this every page delete
// seq-scans the (large) links table.
index("audit_links_source_page_id_idx").on(table.sourcePageId),
],
);
// One row per (issue type, affected page) // One row per (issue type, affected page)
export const auditIssues = pgTable( export const auditIssues = pgTable(

View File

@ -77,7 +77,6 @@ export const {
backlinkSnapshots, backlinkSnapshots,
audits, audits,
auditPages, auditPages,
auditLinks,
auditIssues, auditIssues,
auditLighthouseResults, auditLighthouseResults,
samSessions, samSessions,