Skip to content

Commit d379242

Browse files
committed
Finish adding the CreateTable statement
1 parent b71ac7e commit d379242

1 file changed

Lines changed: 41 additions & 16 deletions

File tree

lib/statement.ts

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ export interface CreateTable {
173173
primary_key?: Expr,
174174
order_by?: OneOrManyWithParens<Expr>,
175175
partition_by?: Expr,
176-
cluster_by?: WrappedCollection<Expr>,
177-
clustered_by?: ClusteredBy,
178-
inherits?: ObjectName,
176+
cluster_by?: WrappedCollection<Expr[]>,
177+
clustered_by?: unknown,
178+
inherits?: ObjectName[],
179179
strict: boolean,
180180
copy_grants: boolean,
181181
enable_schema_evolution?: boolean,
@@ -184,20 +184,45 @@ export interface CreateTable {
184184
max_data_extension_time_in_days?: number,
185185
default_ddl_collation?: String,
186186
with_aggregation_policy?: ObjectName,
187-
with_row_access_policy?: RowAccessPolicy,
188-
with_tags?: Tag,
187+
with_row_access_policy?: unknown,
188+
with_tags?: unknown[],
189189
external_volume?: String,
190190
base_location?: String,
191191
catalog?: String,
192192
catalog_sync?: String,
193-
storage_serialization_policy?: StorageSerializationPolicy,
193+
storage_serialization_policy?: unknown,
194194
target_lag?: String,
195195
warehouse?: Ident,
196-
refresh_mode?: RefreshModeKind,
197-
initialize?: InitializeKind,
196+
refresh_mode?: unknown,
197+
initialize?: unknown,
198198
require_user: boolean,
199199
}
200200

201+
/**
202+
* Helper to indicate if a collection should be wrapped by a symbol in the display form.
203+
*
204+
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.WrappedCollection.html
205+
*/
206+
export type WrappedCollection<T> = {
207+
/**
208+
* Print the collection without wrapping symbols, as `item, item, item`.
209+
*/
210+
NoWrapping?: T;
211+
212+
/**
213+
* Wraps the collection in Parentheses, as `(item, item, item)`.
214+
*/
215+
Parenthesis?: T;
216+
}
217+
218+
/**
219+
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.OnCommit.html
220+
*/
221+
export type OnCommit =
222+
| 'DeleteRows'
223+
| 'PreserveRows'
224+
| 'Drop';
225+
201226
/**
202227
* Specifies how to create a new table based on an existing table’s schema.
203228
* ```sql
@@ -323,7 +348,7 @@ export interface TableConstraint {
323348
*
324349
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.FileFormat.html
325350
*/
326-
export type FileFormat =
351+
export type FileFormat =
327352
| 'TEXTFILE'
328353
| 'SEQUENCEFILE'
329354
| 'ORC'
@@ -382,7 +407,7 @@ export type ReferentialAction =
382407
*
383408
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.KeyOrIndexDisplay.html
384409
*/
385-
export type KeyOrIndexDisplay =
410+
export type KeyOrIndexDisplay =
386411
| 'None'
387412
| 'Key'
388413
| 'Index';
@@ -392,7 +417,7 @@ export type KeyOrIndexDisplay =
392417
*
393418
* This structure isn’t present on ANSI, but is found at least in MySQL `CREATE TABLE`, MySQL `CREATE INDEX`, and Postgresql `CREATE INDEX` statements.
394419
*/
395-
export type IndexType =
420+
export type IndexType =
396421
| 'BTree'
397422
| 'Hash'
398423
| 'GIN'
@@ -597,7 +622,7 @@ export interface Insert {
597622
* table_name as foo (for PostgreSQL)
598623
*/
599624
table_alias?: Ident,
600-
625+
601626
/**
602627
* COLUMNS
603628
*/
@@ -687,7 +712,7 @@ export interface Insert {
687712
*
688713
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.SqliteOnConflict.html
689714
*/
690-
export type SqliteOnConflict =
715+
export type SqliteOnConflict =
691716
| 'Rollback'
692717
| 'Abort'
693718
| 'Fail'
@@ -938,7 +963,7 @@ export interface Offset {
938963
*
939964
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.OffsetRows.html
940965
*/
941-
export type OffsetRows =
966+
export type OffsetRows =
942967
| 'None'
943968
| 'Row'
944969
| 'Rows';
@@ -994,7 +1019,7 @@ export interface Cte {
9941019
/**
9951020
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.CteAsMaterialized.html
9961021
*/
997-
export type CteAsMaterialized =
1022+
export type CteAsMaterialized =
9981023
| 'Materialized'
9991024
| 'NotMaterialized';
10001025

@@ -1040,7 +1065,7 @@ export interface SetExpr {
10401065
/**
10411066
* @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.SetOperator.html
10421067
*/
1043-
export type SetOperator =
1068+
export type SetOperator =
10441069
| 'Union'
10451070
| 'Except'
10461071
| 'Intersect'

0 commit comments

Comments
 (0)