Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/db/generated/kysely.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export interface Component {
description: string;
extra: string | null;
flag: Generated<number>;
is_extended_promotional: number | null;
joints: number;
last_on_stock: Generated<number>;
last_update: number;
Expand Down
18 changes: 18 additions & 0 deletions lib/db/optimizations/component-is-extended-promotional-column.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { DbOptimizationSpec } from "./types"
import { sql } from "kysely"

export const componentIsExtendedPromotionalColumnSpec: DbOptimizationSpec = {
name: "component-is-extended-promotional-column",
description: "add is_extended_promotional column to components table",
async checkIfAdded(db) {
const result = await sql<{
name: string
}>`PRAGMA table_info(components)`.execute(db)
return result.rows.some((col) => col.name === "is_extended_promotional")
},
async execute(db) {
await sql`ALTER TABLE components ADD COLUMN is_extended_promotional INTEGER`.execute(
db,
)
},
}
Loading