import { SQL } from 'drizzle-orm/sql'; import { AnyPgColumn } from './columns'; import { AnyPgTable } from './table'; interface IndexConfig { name?: string; columns: IndexColumn[]; /** * If true, the index will be created as `create unique index` instead of `create index`. */ unique: boolean; /** * If true, the index will be created as `create index concurrently` instead of `create index`. */ concurrently?: boolean; /** * If true, the index will be created as `create index ... on only ` instead of `create index ... on
`. */ only: boolean; /** * If set, the index will be created as `create index ... using `. */ using?: SQL; /** * If set, the index will be created as `create index ... asc | desc`. */ order?: 'asc' | 'desc'; /** * If set, adds `nulls first` or `nulls last` to the index. */ nulls?: 'first' | 'last'; /** * Condition for partial index. */ where?: SQL; } export declare type IndexColumn = AnyPgColumn; export declare class IndexBuilderOn { private unique; private name?; constructor(unique: boolean, name?: string | undefined); on(...columns: [IndexColumn, ...IndexColumn[]]): IndexBuilder; onOnly(...columns: [IndexColumn, ...IndexColumn[]]): IndexBuilder; } export interface AnyIndexBuilder { build(table: AnyPgTable): Index; } export interface IndexBuilder extends AnyIndexBuilder { } export declare class IndexBuilder implements AnyIndexBuilder { protected $brand: 'PgIndexBuilder'; constructor(columns: IndexColumn[], unique: boolean, only: boolean, name?: string); concurrently(): Omit; using(method: SQL): Omit; asc(): Omit; desc(): Omit; nullsFirst(): Omit; nullsLast(): Omit; where(condition: SQL): Omit; } export declare class Index { protected $brand: 'PgIndex'; readonly config: IndexConfig & { table: AnyPgTable; }; constructor(config: IndexConfig, table: AnyPgTable); } export declare type GetColumnsTableName = TColumns extends AnyPgColumn<{ tableName: infer TTableName extends string; }> | AnyPgColumn<{ tableName: infer TTableName extends string; }>[] ? TTableName : never; export declare function index(name?: string): IndexBuilderOn; export declare function uniqueIndex(name?: string): IndexBuilderOn; export {}; //# sourceMappingURL=indexes.d.ts.map