relq 1.0.24 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/cli/commands/commit.cjs +80 -0
  2. package/dist/cjs/cli/commands/import.cjs +1 -0
  3. package/dist/cjs/cli/commands/pull.cjs +8 -25
  4. package/dist/cjs/cli/commands/push.cjs +48 -8
  5. package/dist/cjs/cli/commands/rollback.cjs +205 -84
  6. package/dist/cjs/cli/commands/schema-ast.cjs +219 -0
  7. package/dist/cjs/cli/index.cjs +6 -0
  8. package/dist/cjs/cli/utils/ast-codegen.cjs +95 -3
  9. package/dist/cjs/cli/utils/ast-transformer.cjs +12 -0
  10. package/dist/cjs/cli/utils/change-tracker.cjs +135 -0
  11. package/dist/cjs/cli/utils/commit-manager.cjs +54 -0
  12. package/dist/cjs/cli/utils/migration-generator.cjs +319 -0
  13. package/dist/cjs/cli/utils/repo-manager.cjs +99 -3
  14. package/dist/cjs/cli/utils/schema-diff.cjs +390 -0
  15. package/dist/cjs/cli/utils/schema-hash.cjs +4 -0
  16. package/dist/cjs/cli/utils/schema-to-ast.cjs +477 -0
  17. package/dist/cjs/cli/utils/schema-validator.cjs +21 -1
  18. package/dist/cjs/schema-definition/column-types.cjs +63 -10
  19. package/dist/cjs/schema-definition/pg-enum.cjs +10 -0
  20. package/dist/cjs/schema-definition/pg-function.cjs +19 -0
  21. package/dist/cjs/schema-definition/pg-sequence.cjs +22 -1
  22. package/dist/cjs/schema-definition/pg-trigger.cjs +39 -0
  23. package/dist/cjs/schema-definition/pg-view.cjs +17 -0
  24. package/dist/cjs/schema-definition/sql-expressions.cjs +3 -0
  25. package/dist/cjs/schema-definition/table-definition.cjs +4 -0
  26. package/dist/config.d.ts +98 -0
  27. package/dist/esm/cli/commands/commit.js +83 -3
  28. package/dist/esm/cli/commands/import.js +1 -0
  29. package/dist/esm/cli/commands/pull.js +9 -26
  30. package/dist/esm/cli/commands/push.js +49 -9
  31. package/dist/esm/cli/commands/rollback.js +206 -85
  32. package/dist/esm/cli/commands/schema-ast.js +183 -0
  33. package/dist/esm/cli/index.js +6 -0
  34. package/dist/esm/cli/utils/ast-codegen.js +93 -3
  35. package/dist/esm/cli/utils/ast-transformer.js +12 -0
  36. package/dist/esm/cli/utils/change-tracker.js +134 -0
  37. package/dist/esm/cli/utils/commit-manager.js +51 -0
  38. package/dist/esm/cli/utils/migration-generator.js +318 -0
  39. package/dist/esm/cli/utils/repo-manager.js +96 -3
  40. package/dist/esm/cli/utils/schema-diff.js +389 -0
  41. package/dist/esm/cli/utils/schema-hash.js +4 -0
  42. package/dist/esm/cli/utils/schema-to-ast.js +447 -0
  43. package/dist/esm/cli/utils/schema-validator.js +21 -1
  44. package/dist/esm/schema-definition/column-types.js +63 -10
  45. package/dist/esm/schema-definition/pg-enum.js +10 -0
  46. package/dist/esm/schema-definition/pg-function.js +19 -0
  47. package/dist/esm/schema-definition/pg-sequence.js +22 -1
  48. package/dist/esm/schema-definition/pg-trigger.js +39 -0
  49. package/dist/esm/schema-definition/pg-view.js +17 -0
  50. package/dist/esm/schema-definition/sql-expressions.js +3 -0
  51. package/dist/esm/schema-definition/table-definition.js +4 -0
  52. package/dist/index.d.ts +98 -0
  53. package/dist/schema-builder.d.ts +223 -24
  54. package/package.json +1 -1
@@ -92,6 +92,45 @@ export function pgTrigger(name, options) {
92
92
  $triggerName: name,
93
93
  $options: options,
94
94
  $type: 'trigger',
95
+ $trackingId: undefined,
96
+ toAST() {
97
+ const opts = this.$options;
98
+ let timing;
99
+ let events;
100
+ if (opts.before) {
101
+ timing = 'BEFORE';
102
+ events = Array.isArray(opts.before) ? opts.before : [opts.before];
103
+ }
104
+ else if (opts.after) {
105
+ timing = 'AFTER';
106
+ events = Array.isArray(opts.after) ? opts.after : [opts.after];
107
+ }
108
+ else if (opts.insteadOf) {
109
+ timing = 'INSTEAD OF';
110
+ events = Array.isArray(opts.insteadOf) ? opts.insteadOf : [opts.insteadOf];
111
+ }
112
+ else {
113
+ timing = 'BEFORE';
114
+ events = ['INSERT'];
115
+ }
116
+ const forEach = opts.forEachStatement ? 'STATEMENT' : 'ROW';
117
+ const functionName = typeof opts.execute === 'string'
118
+ ? opts.execute
119
+ : opts.execute.$functionName;
120
+ return {
121
+ name: this.$triggerName,
122
+ table: getTableName(opts.on),
123
+ timing,
124
+ events,
125
+ forEach,
126
+ functionName,
127
+ whenClause: opts.when,
128
+ isConstraint: opts.constraint ?? false,
129
+ deferrable: opts.deferrable,
130
+ initiallyDeferred: opts.initially === 'DEFERRED',
131
+ trackingId: this.$trackingId,
132
+ };
133
+ },
95
134
  };
96
135
  }
97
136
  export function isTriggerConfig(value) {
@@ -4,6 +4,14 @@ export function pgView(name, definition) {
4
4
  name,
5
5
  definition: definition.trim(),
6
6
  isMaterialized: false,
7
+ toAST() {
8
+ return {
9
+ name: this.name,
10
+ definition: this.definition,
11
+ isMaterialized: false,
12
+ trackingId: this.$trackingId,
13
+ };
14
+ },
7
15
  };
8
16
  }
9
17
  export function pgMaterializedView(name, definition, options) {
@@ -13,6 +21,15 @@ export function pgMaterializedView(name, definition, options) {
13
21
  definition: definition.trim(),
14
22
  isMaterialized: true,
15
23
  withData: options?.withData,
24
+ toAST() {
25
+ return {
26
+ name: this.name,
27
+ definition: this.definition,
28
+ isMaterialized: true,
29
+ withData: this.withData,
30
+ trackingId: this.$trackingId,
31
+ };
32
+ },
16
33
  };
17
34
  }
18
35
  export function viewToSQL(view) {
@@ -179,6 +179,9 @@ export function pgExtensions(...extensions) {
179
179
  toSQL() {
180
180
  return extensions.map(ext => `CREATE EXTENSION IF NOT EXISTS "${ext}";`);
181
181
  },
182
+ toAST() {
183
+ return [...extensions];
184
+ },
182
185
  };
183
186
  }
184
187
  export function getSql(expr) {
@@ -1,6 +1,7 @@
1
1
  import format from "../addon/pg-format/index.js";
2
2
  import { partitionStrategyFactory } from "./partitions.js";
3
3
  import { sqlFunctions, expressionBuilder } from "./sql-expressions.js";
4
+ import { tableToAST } from "../cli/utils/schema-to-ast.js";
4
5
  function formatWhereValue(val) {
5
6
  if (val === null)
6
7
  return 'NULL';
@@ -475,6 +476,9 @@ export function defineTable(name, columns, options) {
475
476
  },
476
477
  toCreateIndexSQL() {
477
478
  return generateIndexSQL(this);
479
+ },
480
+ toAST() {
481
+ return tableToAST(this);
478
482
  }
479
483
  };
480
484
  return definition;
package/dist/index.d.ts CHANGED
@@ -199,6 +199,102 @@ export interface DefaultValue {
199
199
  readonly $sql: string;
200
200
  readonly $isDefault: true;
201
201
  }
202
+ /**
203
+ * AST Type Definitions
204
+ *
205
+ * Type definitions for parsed PostgreSQL schema objects.
206
+ * These are intermediate representations between pgsql-parser AST and TypeScript code generation.
207
+ */
208
+ export interface ParsedColumn {
209
+ name: string;
210
+ type: string;
211
+ typeParams?: {
212
+ precision?: number;
213
+ scale?: number;
214
+ length?: number;
215
+ };
216
+ isNullable: boolean;
217
+ isPrimaryKey: boolean;
218
+ isUnique: boolean;
219
+ hasDefault: boolean;
220
+ defaultValue?: string;
221
+ isGenerated: boolean;
222
+ generatedExpression?: string;
223
+ generatedExpressionAst?: any;
224
+ checkConstraint?: {
225
+ name: string;
226
+ expression: string;
227
+ expressionAst?: any;
228
+ };
229
+ references?: {
230
+ table: string;
231
+ column: string;
232
+ onDelete?: string;
233
+ onUpdate?: string;
234
+ match?: "SIMPLE" | "FULL";
235
+ deferrable?: boolean;
236
+ initiallyDeferred?: boolean;
237
+ };
238
+ isArray: boolean;
239
+ arrayDimensions?: number;
240
+ comment?: string;
241
+ /** Tracking ID for rename detection in versioning */
242
+ trackingId?: string;
243
+ }
244
+ export interface ParsedConstraint {
245
+ name: string;
246
+ type: "PRIMARY KEY" | "UNIQUE" | "FOREIGN KEY" | "CHECK" | "EXCLUDE";
247
+ columns: string[];
248
+ expression?: string;
249
+ expressionAst?: any;
250
+ comment?: string;
251
+ references?: {
252
+ table: string;
253
+ columns: string[];
254
+ onDelete?: string;
255
+ onUpdate?: string;
256
+ match?: "SIMPLE" | "FULL";
257
+ deferrable?: boolean;
258
+ initiallyDeferred?: boolean;
259
+ };
260
+ /** Tracking ID for rename detection in versioning */
261
+ trackingId?: string;
262
+ }
263
+ export interface ParsedIndex {
264
+ name: string;
265
+ columns: string[];
266
+ isUnique: boolean;
267
+ method?: string;
268
+ whereClause?: string;
269
+ whereClauseAst?: any;
270
+ includeColumns?: string[];
271
+ opclass?: string;
272
+ isExpression?: boolean;
273
+ expressions?: string[];
274
+ comment?: string;
275
+ /** Tracking ID for rename detection in versioning */
276
+ trackingId?: string;
277
+ }
278
+ export interface ParsedTable {
279
+ name: string;
280
+ schema?: string;
281
+ columns: ParsedColumn[];
282
+ constraints: ParsedConstraint[];
283
+ indexes: ParsedIndex[];
284
+ isPartitioned: boolean;
285
+ partitionType?: "RANGE" | "LIST" | "HASH";
286
+ partitionKey?: string[];
287
+ partitionOf?: string;
288
+ partitionBound?: string;
289
+ inherits?: string[];
290
+ comment?: string;
291
+ childPartitions?: {
292
+ name: string;
293
+ partitionBound: string;
294
+ }[];
295
+ /** Tracking ID for rename detection in versioning */
296
+ trackingId?: string;
297
+ }
202
298
  declare const EMPTY_OBJECT: unique symbol;
203
299
  declare const EMPTY_ARRAY: unique symbol;
204
300
  export interface ColumnConfig<T = unknown> {
@@ -443,6 +539,8 @@ export interface TableDefinition<T extends Record<string, ColumnConfig>> {
443
539
  $inferInsert: BuildInsertType<T>;
444
540
  toSQL(): string;
445
541
  toCreateIndexSQL(): string[];
542
+ /** Returns AST for schema diffing and migration generation */
543
+ toAST(): ParsedTable;
446
544
  }
447
545
  /**
448
546
  * Infer TypeScript type from a ColumnConfig
@@ -72,6 +72,192 @@ export declare const DEFAULT: {
72
72
  readonly money: (value: number | string) => DefaultValue;
73
73
  readonly zeroMoney: () => DefaultValue;
74
74
  };
75
+ /**
76
+ * AST Type Definitions
77
+ *
78
+ * Type definitions for parsed PostgreSQL schema objects.
79
+ * These are intermediate representations between pgsql-parser AST and TypeScript code generation.
80
+ */
81
+ export interface ParsedColumn {
82
+ name: string;
83
+ type: string;
84
+ typeParams?: {
85
+ precision?: number;
86
+ scale?: number;
87
+ length?: number;
88
+ };
89
+ isNullable: boolean;
90
+ isPrimaryKey: boolean;
91
+ isUnique: boolean;
92
+ hasDefault: boolean;
93
+ defaultValue?: string;
94
+ isGenerated: boolean;
95
+ generatedExpression?: string;
96
+ generatedExpressionAst?: any;
97
+ checkConstraint?: {
98
+ name: string;
99
+ expression: string;
100
+ expressionAst?: any;
101
+ };
102
+ references?: {
103
+ table: string;
104
+ column: string;
105
+ onDelete?: string;
106
+ onUpdate?: string;
107
+ match?: "SIMPLE" | "FULL";
108
+ deferrable?: boolean;
109
+ initiallyDeferred?: boolean;
110
+ };
111
+ isArray: boolean;
112
+ arrayDimensions?: number;
113
+ comment?: string;
114
+ /** Tracking ID for rename detection in versioning */
115
+ trackingId?: string;
116
+ }
117
+ export interface ParsedConstraint {
118
+ name: string;
119
+ type: "PRIMARY KEY" | "UNIQUE" | "FOREIGN KEY" | "CHECK" | "EXCLUDE";
120
+ columns: string[];
121
+ expression?: string;
122
+ expressionAst?: any;
123
+ comment?: string;
124
+ references?: {
125
+ table: string;
126
+ columns: string[];
127
+ onDelete?: string;
128
+ onUpdate?: string;
129
+ match?: "SIMPLE" | "FULL";
130
+ deferrable?: boolean;
131
+ initiallyDeferred?: boolean;
132
+ };
133
+ /** Tracking ID for rename detection in versioning */
134
+ trackingId?: string;
135
+ }
136
+ export interface ParsedIndex {
137
+ name: string;
138
+ columns: string[];
139
+ isUnique: boolean;
140
+ method?: string;
141
+ whereClause?: string;
142
+ whereClauseAst?: any;
143
+ includeColumns?: string[];
144
+ opclass?: string;
145
+ isExpression?: boolean;
146
+ expressions?: string[];
147
+ comment?: string;
148
+ /** Tracking ID for rename detection in versioning */
149
+ trackingId?: string;
150
+ }
151
+ export interface ParsedTable {
152
+ name: string;
153
+ schema?: string;
154
+ columns: ParsedColumn[];
155
+ constraints: ParsedConstraint[];
156
+ indexes: ParsedIndex[];
157
+ isPartitioned: boolean;
158
+ partitionType?: "RANGE" | "LIST" | "HASH";
159
+ partitionKey?: string[];
160
+ partitionOf?: string;
161
+ partitionBound?: string;
162
+ inherits?: string[];
163
+ comment?: string;
164
+ childPartitions?: {
165
+ name: string;
166
+ partitionBound: string;
167
+ }[];
168
+ /** Tracking ID for rename detection in versioning */
169
+ trackingId?: string;
170
+ }
171
+ export interface ParsedEnum {
172
+ name: string;
173
+ schema?: string;
174
+ values: string[];
175
+ /** Tracking ID for rename detection in versioning */
176
+ trackingId?: string;
177
+ }
178
+ export interface ParsedDomain {
179
+ name: string;
180
+ schema?: string;
181
+ baseType: string;
182
+ notNull: boolean;
183
+ defaultValue?: string;
184
+ checkExpression?: string;
185
+ checkName?: string;
186
+ /** Tracking ID for rename detection in versioning */
187
+ trackingId?: string;
188
+ }
189
+ export interface ParsedView {
190
+ name: string;
191
+ schema?: string;
192
+ definition: string;
193
+ isMaterialized: boolean;
194
+ /** For materialized views: WITH DATA or WITH NO DATA */
195
+ withData?: boolean;
196
+ /** Tracking ID for rename detection in versioning */
197
+ trackingId?: string;
198
+ }
199
+ export interface ParsedFunction {
200
+ name: string;
201
+ schema?: string;
202
+ args: {
203
+ name?: string;
204
+ type: string;
205
+ mode?: string;
206
+ default?: string;
207
+ }[];
208
+ returnType: string;
209
+ language: string;
210
+ body: string;
211
+ volatility?: "VOLATILE" | "STABLE" | "IMMUTABLE";
212
+ isStrict: boolean;
213
+ securityDefiner: boolean;
214
+ /** Tracking ID for rename detection in versioning */
215
+ trackingId?: string;
216
+ }
217
+ export interface ParsedTrigger {
218
+ name: string;
219
+ table: string;
220
+ timing: "BEFORE" | "AFTER" | "INSTEAD OF";
221
+ events: ("INSERT" | "UPDATE" | "DELETE" | "TRUNCATE")[];
222
+ forEach: "ROW" | "STATEMENT";
223
+ functionName: string;
224
+ whenClause?: string;
225
+ isConstraint: boolean;
226
+ deferrable?: boolean;
227
+ initiallyDeferred?: boolean;
228
+ /** Tracking ID for rename detection in versioning */
229
+ trackingId?: string;
230
+ }
231
+ export interface ParsedSequence {
232
+ name: string;
233
+ schema?: string;
234
+ startValue?: number;
235
+ increment?: number;
236
+ minValue?: number;
237
+ maxValue?: number;
238
+ cache?: number;
239
+ cycle: boolean;
240
+ ownedBy?: {
241
+ table: string;
242
+ column: string;
243
+ };
244
+ /** Tracking ID for rename detection in versioning */
245
+ trackingId?: string;
246
+ }
247
+ /**
248
+ * Composite type (CREATE TYPE ... AS)
249
+ */
250
+ export interface ParsedCompositeType {
251
+ name: string;
252
+ schema?: string;
253
+ attributes: Array<{
254
+ name: string;
255
+ type: string;
256
+ collation?: string;
257
+ }>;
258
+ /** Tracking ID for rename detection in versioning */
259
+ trackingId?: string;
260
+ }
75
261
  export declare const EMPTY_OBJECT: unique symbol;
76
262
  export declare const EMPTY_ARRAY: unique symbol;
77
263
  export interface ColumnConfig<T = unknown> {
@@ -830,6 +1016,9 @@ export interface DomainConfig<T> {
830
1016
  $collation?: string;
831
1017
  /** Base ColumnBuilder for type inference */
832
1018
  $columnBuilder?: ColumnBuilder<T>;
1019
+ $trackingId?: string;
1020
+ /** Returns AST for schema diffing and migration generation */
1021
+ toAST(): ParsedDomain;
833
1022
  }
834
1023
  /**
835
1024
  * Domain check condition - represents a CHECK constraint expression
@@ -1005,6 +1194,9 @@ export interface CompositeTypeConfig<T extends Record<string, ColumnConfig>> {
1005
1194
  $inferType: {
1006
1195
  [K in keyof T]: T[K] extends ColumnConfig<infer U> ? U : unknown;
1007
1196
  };
1197
+ $trackingId?: string;
1198
+ /** Returns AST for schema diffing and migration generation */
1199
+ toAST(): ParsedCompositeType;
1008
1200
  }
1009
1201
  /**
1010
1202
  * Define a PostgreSQL composite type
@@ -1536,6 +1728,8 @@ export interface PgExtensionsConfig {
1536
1728
  extensions: readonly PgExtension[];
1537
1729
  /** Generate CREATE EXTENSION SQL */
1538
1730
  toSQL(): string[];
1731
+ /** Returns extension names for schema diffing */
1732
+ toAST(): string[];
1539
1733
  }
1540
1734
  /**
1541
1735
  * Define PostgreSQL extensions for your database
@@ -2385,9 +2579,11 @@ export interface TableDefinition<T extends Record<string, ColumnConfig>> {
2385
2579
  $inferInsert: BuildInsertType<T>;
2386
2580
  toSQL(): string;
2387
2581
  toCreateIndexSQL(): string[];
2582
+ /** Returns AST for schema diffing and migration generation */
2583
+ toAST(): ParsedTable;
2388
2584
  }
2389
2585
  export declare function defineTable<T extends Record<string, ColumnConfig>>(name: string, columns: T, options?: Partial<Omit<TableConfig<T>, "columns">>): TableDefinition<T>;
2390
- export interface ParsedColumn {
2586
+ interface ParsedColumn$1 {
2391
2587
  name: string;
2392
2588
  type: string;
2393
2589
  nullable: boolean;
@@ -2408,10 +2604,10 @@ export interface ParsedColumn {
2408
2604
  array: boolean;
2409
2605
  arrayDimensions: number;
2410
2606
  }
2411
- export interface ParsedTable {
2607
+ interface ParsedTable$1 {
2412
2608
  name: string;
2413
2609
  schema?: string;
2414
- columns: ParsedColumn[];
2610
+ columns: ParsedColumn$1[];
2415
2611
  primaryKey?: string[];
2416
2612
  uniqueConstraints: Array<{
2417
2613
  columns: string[];
@@ -2432,16 +2628,16 @@ export interface ParsedTable {
2432
2628
  name?: string;
2433
2629
  }>;
2434
2630
  }
2435
- export declare function parseCreateTable(sql: string): ParsedTable;
2436
- export declare function generateSchemaCode(table: ParsedTable, options?: {
2631
+ export declare function parseCreateTable(sql: string): ParsedTable$1;
2632
+ export declare function generateSchemaCode(table: ParsedTable$1, options?: {
2437
2633
  exportName?: string;
2438
2634
  }): string;
2439
2635
  export declare function introspectSQL(sql: string): {
2440
- parsed: ParsedTable;
2636
+ parsed: ParsedTable$1;
2441
2637
  code: string;
2442
2638
  };
2443
2639
  export declare function introspectMultiple(sql: string): Array<{
2444
- parsed: ParsedTable;
2640
+ parsed: ParsedTable$1;
2445
2641
  code: string;
2446
2642
  }>;
2447
2643
  export interface RelationConfig {
@@ -3009,6 +3205,7 @@ export interface PgEnumConfig<T extends readonly string[]> {
3009
3205
  $enumName: string;
3010
3206
  /** Allowed values */
3011
3207
  $enumValues: T;
3208
+ $trackingId?: string;
3012
3209
  /** Creates a column using this enum type */
3013
3210
  (columnName?: string): ColumnBuilder<T[number]> & {
3014
3211
  $enumName: string;
@@ -3021,6 +3218,8 @@ export interface PgEnumConfig<T extends readonly string[]> {
3021
3218
  name: string;
3022
3219
  /** Check if value is valid enum member (type guard) */
3023
3220
  includes(value: unknown): value is T[number];
3221
+ /** Returns AST for schema diffing and migration generation */
3222
+ toAST(): ParsedEnum;
3024
3223
  }
3025
3224
  /**
3026
3225
  * Create a PostgreSQL ENUM type
@@ -3056,12 +3255,6 @@ export declare function addEnumValueSQL(enumName: string, newValue: string, posi
3056
3255
  before?: string;
3057
3256
  after?: string;
3058
3257
  }): string;
3059
- /**
3060
- * PostgreSQL Function Definition for Schema Builder
3061
- *
3062
- * Provides type-safe function definitions that can be used in schema.ts
3063
- * and referenced by triggers.
3064
- */
3065
3258
  export type FunctionVolatility = "VOLATILE" | "STABLE" | "IMMUTABLE";
3066
3259
  export type FunctionParallel = "UNSAFE" | "RESTRICTED" | "SAFE";
3067
3260
  export type FunctionSecurity = "INVOKER" | "DEFINER";
@@ -3117,6 +3310,9 @@ export interface FunctionConfig {
3117
3310
  $options: FunctionOptions;
3118
3311
  /** Marker for function type */
3119
3312
  $type: "function";
3313
+ $trackingId?: string;
3314
+ /** Returns AST for schema diffing and migration generation */
3315
+ toAST(): ParsedFunction;
3120
3316
  }
3121
3317
  /**
3122
3318
  * Generate SQL for a function definition
@@ -3260,6 +3456,9 @@ export interface TriggerConfig<TTable = unknown> {
3260
3456
  $options: TriggerOptions<TTable>;
3261
3457
  /** Marker for trigger type */
3262
3458
  $type: "trigger";
3459
+ $trackingId?: string;
3460
+ /** Returns AST for schema diffing and migration generation */
3461
+ toAST(): ParsedTrigger;
3263
3462
  }
3264
3463
  /**
3265
3464
  * Generate SQL for a trigger definition
@@ -3337,12 +3536,6 @@ export declare function pgTrigger<TTable = unknown>(name: string, options: Trigg
3337
3536
  * Check if a value is a TriggerConfig
3338
3537
  */
3339
3538
  export declare function isTriggerConfig(value: unknown): value is TriggerConfig;
3340
- /**
3341
- * PostgreSQL Sequence Definition for Schema Builder
3342
- *
3343
- * Provides type-safe sequence definitions that can be used in schema.ts
3344
- * and referenced by column defaults.
3345
- */
3346
3539
  export interface SequenceOptions {
3347
3540
  /** Data type: smallint, integer (default), or bigint */
3348
3541
  as?: "smallint" | "integer" | "bigint";
@@ -3365,6 +3558,9 @@ export interface SequenceConfig {
3365
3558
  readonly _type: "sequence";
3366
3559
  readonly name: string;
3367
3560
  readonly options: SequenceOptions;
3561
+ $trackingId?: string;
3562
+ /** Returns AST for schema diffing and migration generation */
3563
+ toAST(): ParsedSequence;
3368
3564
  }
3369
3565
  /**
3370
3566
  * Define a PostgreSQL sequence
@@ -3407,16 +3603,14 @@ export declare function dropSequenceSQL(seq: SequenceConfig): string;
3407
3603
  * Type guard to check if a value is a SequenceConfig
3408
3604
  */
3409
3605
  export declare function isSequenceConfig(value: unknown): value is SequenceConfig;
3410
- /**
3411
- * PostgreSQL View Definitions
3412
- *
3413
- * Provides typed helpers for defining views and materialized views.
3414
- */
3415
3606
  export interface ViewConfig {
3416
3607
  _type: "view";
3417
3608
  name: string;
3418
3609
  definition: string;
3419
3610
  isMaterialized: false;
3611
+ $trackingId?: string;
3612
+ /** Returns AST for schema diffing and migration generation */
3613
+ toAST(): ParsedView;
3420
3614
  }
3421
3615
  export interface MaterializedViewConfig {
3422
3616
  _type: "materialized_view";
@@ -3424,6 +3618,9 @@ export interface MaterializedViewConfig {
3424
3618
  definition: string;
3425
3619
  isMaterialized: true;
3426
3620
  withData?: boolean;
3621
+ $trackingId?: string;
3622
+ /** Returns AST for schema diffing and migration generation */
3623
+ toAST(): ParsedView;
3427
3624
  }
3428
3625
  /**
3429
3626
  * Define a PostgreSQL view
@@ -3560,6 +3757,8 @@ export {
3560
3757
  FunctionOptions$1 as FunctionOptions,
3561
3758
  FunctionSecurity$1 as FunctionSecurity,
3562
3759
  FunctionVolatility$1 as FunctionVolatility,
3760
+ ParsedColumn$1 as ParsedColumn,
3761
+ ParsedTable$1 as ParsedTable,
3563
3762
  };
3564
3763
 
3565
3764
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relq",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "The Fully-Typed PostgreSQL ORM for TypeScript",
5
5
  "author": "Olajide Mathew O. <olajide.mathew@yuniq.solutions>",
6
6
  "license": "MIT",