/** * defineTable — table definition wrapper for UnifiedCommerce plugins. * * Wraps Drizzle's pgTable with auto-injected fields: * - id (UUID primary key) * - organizationId (text, NOT NULL) — on top-level tables only * - createdAt, updatedAt (timestamps) * - Org index + composite unique constraints * * Child tables (FK to org-scoped parent) get id + createdAt only. * * Usage: * import { defineTable, column } from "@porulle/db"; * * export const giftCards = defineTable("gift_cards", { * // Per-org unique (default): UNIQUE (organization_id, code) * code: column.text({ unique: true }), * // Globally unique: UNIQUE (public_code) * publicCode: column.text({ unique: "global" }), * balance: column.integer(), * }); * * Child tables (FK to org-scoped parent) have no organizationId; unique: true * creates UNIQUE (col) on the child column. */ import type { ColumnDef } from "./column.js"; /** * Define a database table with auto-injected UC fields. */ export declare function defineTable(name: string, columnDefs: Record, extraConfig?: (table: Record) => Record): import("drizzle-orm/pg-core").PgTableWithColumns<{ name: string; schema: undefined; columns: { [x: string]: import("drizzle-orm/pg-core").PgColumn<{ name: any; tableName: string; dataType: any; columnType: any; data: any; driverParam: any; notNull: false; hasDefault: false; isPrimaryKey: false; isAutoincrement: false; hasRuntimeDefault: false; enumValues: any; baseColumn: never; identity: undefined; generated: undefined; }, {}, { [x: string]: any; [x: number]: any; [x: symbol]: any; }>; }; dialect: "pg"; }>; //# sourceMappingURL=define-table.d.ts.map