{"version":3,"sources":["../../src/schema/index.ts"],"names":[],"mappings":";AAuRO,IAAM,cAAA,GAAiB;AAUvB,IAAM,wBAAA,GAA2B","file":"index.mjs","sourcesContent":["/**\n * Schema utilities for @nextly/adapter-drizzle\n *\n * @remarks\n * This module re-exports schema-related types from the `/types` subpath\n *\n * ## Current Exports\n *\n * - **Schema Type Definitions:** {@link TableDefinition}, {@link ColumnDefinition}, {@link IndexDefinition}, {@link TableConstraint}\n * - **Schema Operation Types:** {@link CreateTableOptions}, {@link DropTableOptions}, {@link AlterTableOptions}, {@link AlterTableOperation}\n * - **Core Types:** {@link SqlParam}\n *\n * ## Coming in Phase 4\n *\n * - Schema builder utilities\n * - Schema generator functions\n * - Dialect-specific schema mapping\n * - Unified schema definitions\n *\n * ## Usage Examples\n *\n * ### Defining a Table Schema\n *\n * ```typescript\n * import type { TableDefinition } from \"@nextly/adapter-drizzle/schema\";\n *\n * const usersTable: TableDefinition = {\n *   name: \"users\",\n *   columns: [\n *     { name: \"id\", type: \"uuid\", primaryKey: true },\n *     { name: \"email\", type: \"varchar(255)\", unique: true },\n *     { name: \"name\", type: \"varchar(255)\", nullable: true },\n *     {\n *       name: \"created_at\",\n *       type: \"timestamp\",\n *       default: { sql: \"CURRENT_TIMESTAMP\" },\n *     },\n *   ],\n *   indexes: [\n *     { name: \"users_email_idx\", columns: [\"email\"], unique: true },\n *   ],\n * };\n * ```\n *\n * ### Creating a Table with Adapter\n *\n * ```typescript\n * import type { DrizzleAdapter } from \"@nextly/adapter-drizzle\";\n * import type { TableDefinition } from \"@nextly/adapter-drizzle/schema\";\n *\n * async function createUsersTable(adapter: DrizzleAdapter) {\n *   const tableDefinition: TableDefinition = {\n *     // ... table definition\n *   };\n *\n *   await adapter.createTable(tableDefinition, { ifNotExists: true });\n * }\n * ```\n *\n * ### Altering a Table\n *\n * ```typescript\n * import type {\n *   AlterTableOperation,\n *   ColumnDefinition,\n * } from \"@nextly/adapter-drizzle/schema\";\n *\n * const operations: AlterTableOperation[] = [\n *   {\n *     kind: \"add_column\",\n *     column: { name: \"age\", type: \"int\", nullable: true },\n *   },\n *   {\n *     kind: \"rename_column\",\n *     from: \"name\",\n *     to: \"full_name\",\n *   },\n * ];\n *\n * await adapter.alterTable(\"users\", operations);\n * ```\n *\n * @packageDocumentation\n */\n\n// ============================================================\n// Schema Type Re-exports\n// ============================================================\n\n/**\n * Column definition for schema operations.\n *\n * @remarks\n * Defines the structure of a database column in a database-agnostic way.\n * Adapters translate these definitions to dialect-specific DDL.\n *\n * @example\n * ```typescript\n * const idColumn: ColumnDefinition = {\n *   name: \"id\",\n *   type: \"uuid\",\n *   primaryKey: true,\n * };\n *\n * const emailColumn: ColumnDefinition = {\n *   name: \"email\",\n *   type: \"varchar(255)\",\n *   unique: true,\n * };\n * ```\n *\n * @public\n */\nexport type { ColumnDefinition } from \"../types/schema\";\n\n/**\n * Index definition for schema operations.\n *\n * @remarks\n * Defines database indexes for performance optimization.\n *\n * @example\n * ```typescript\n * const emailIndex: IndexDefinition = {\n *   name: \"users_email_idx\",\n *   columns: [\"email\"],\n *   unique: true,\n * };\n * ```\n *\n * @public\n */\nexport type { IndexDefinition } from \"../types/schema\";\n\n/**\n * Table constraint definition.\n *\n * @example\n * ```typescript\n * const checkConstraint: TableConstraint = {\n *   name: \"check_age_positive\",\n *   type: \"check\",\n *   expression: \"age >= 0\",\n * };\n * ```\n *\n * @public\n */\nexport type { TableConstraint } from \"../types/schema\";\n\n/**\n * Complete table definition.\n *\n * @remarks\n * Defines the complete structure of a database table including columns,\n * indexes, and constraints.\n *\n * @example\n * ```typescript\n * const postsTable: TableDefinition = {\n *   name: \"posts\",\n *   columns: [\n *     { name: \"id\", type: \"uuid\", primaryKey: true },\n *     { name: \"title\", type: \"varchar(255)\" },\n *     { name: \"content\", type: \"text\" },\n *     { name: \"published\", type: \"boolean\", default: false },\n *   ],\n *   indexes: [\n *     { name: \"posts_title_idx\", columns: [\"title\"] },\n *   ],\n * };\n * ```\n *\n * @public\n */\nexport type { TableDefinition } from \"../types/schema\";\n\n/**\n * Options for table creation.\n *\n * @example\n * ```typescript\n * const options: CreateTableOptions = {\n *   ifNotExists: true,\n *   temporary: false,\n * };\n *\n * await adapter.createTable(tableDefinition, options);\n * ```\n *\n * @public\n */\nexport type { CreateTableOptions } from \"../types/schema\";\n\n/**\n * Options for table dropping.\n *\n * @example\n * ```typescript\n * const options: DropTableOptions = {\n *   ifExists: true,\n *   cascade: true,\n * };\n *\n * await adapter.dropTable(\"old_table\", options);\n * ```\n *\n * @public\n */\nexport type { DropTableOptions } from \"../types/schema\";\n\n/**\n * Options for table alteration.\n *\n * @public\n */\nexport type { AlterTableOptions } from \"../types/schema\";\n\n/**\n * Table alteration operations.\n *\n * @remarks\n * Defines the types of operations that can be performed when altering a table.\n *\n * @example\n * ```typescript\n * const operations: AlterTableOperation[] = [\n *   {\n *     kind: \"add_column\",\n *     column: { name: \"status\", type: \"varchar(20)\", default: \"draft\" },\n *   },\n *   {\n *     kind: \"drop_column\",\n *     columnName: \"old_field\",\n *   },\n *   {\n *     kind: \"add_constraint\",\n *     constraint: {\n *       name: \"check_status\",\n *       type: \"check\",\n *       expression: \"status IN ('draft', 'published')\",\n *     },\n *   },\n * ];\n *\n * await adapter.alterTable(\"posts\", operations);\n * ```\n *\n * @public\n */\nexport type { AlterTableOperation } from \"../types/schema\";\n\n// ============================================================\n// Core Type Re-exports\n// ============================================================\n\n/**\n * SQL parameter type (for use in column defaults, etc.).\n *\n * @remarks\n * Represents values that can be safely passed as SQL parameters.\n *\n * @public\n */\nexport type { SqlParam } from \"../types/core\";\n\n// ============================================================\n// Module Metadata\n// ============================================================\n\n/**\n * Schema utilities version.\n *\n * @remarks\n * This version tracks the schema utilities module independently\n * from the main adapter package version.\n *\n * @internal\n */\nexport const SCHEMA_VERSION = \"0.1.0\" as const;\n\n/**\n * Indicates whether schema builder utilities are available.\n *\n * @remarks\n * Currently `false` - schema builder utilities will be implemented\n *\n * @internal\n */\nexport const SCHEMA_BUILDER_AVAILABLE = false as const;\n"]}