Skip to content

Commit

Permalink
BREAKING! Rename AlterActionSetOptions to AlterActionSetBigqueryOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
nene committed Jan 31, 2024
1 parent 1a95a6f commit b21538f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions src/cst/AlterAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type AlterTableAction =
| AlterActionDropColumn
| AlterActionAlterColumn
| AlterActionSetDefaultCollate
| AlterActionSetOptions
| AlterActionSetBigqueryOptions
| AlterActionAddConstraint
| AlterActionDropConstraint
| AlterActionAlterConstraint
Expand All @@ -46,12 +46,12 @@ export type AlterTableAction =

export type AlterSchemaAction =
| AlterActionSetDefaultCollate
| AlterActionSetOptions
| AlterActionSetBigqueryOptions
| AlterActionRename
| AlterActionOwnerTo;

export type AlterViewAction =
| AlterActionSetOptions
| AlterActionSetBigqueryOptions
| AlterActionRename
| AlterActionRenameColumn
| AlterActionOwnerTo
Expand Down Expand Up @@ -106,8 +106,8 @@ export interface AlterActionSetDefaultCollate extends BaseNode {
collation: StringLiteral;
}

export interface AlterActionSetOptions extends BaseNode {
type: "alter_action_set_options";
export interface AlterActionSetBigqueryOptions extends BaseNode {
type: "alter_action_set_bigquery_options";
setKw: Keyword<"SET">;
options: BigqueryOptions;
}
Expand Down Expand Up @@ -280,7 +280,7 @@ export type AlterColumnAction =
| AlterActionSetNotNull
| AlterActionDropNotNull
| AlterActionSetDataType
| AlterActionSetOptions
| AlterActionSetBigqueryOptions
| AlterActionSetVisible
| AlterActionSetInvisible
| AlterActionSetCompression
Expand Down
12 changes: 6 additions & 6 deletions src/cst/dialects/Bigquery.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlterActionSetOptions } from "../AlterAction";
import { AlterActionSetBigqueryOptions } from "../AlterAction";
import { BaseNode, Keyword } from "../Base";
import { ColumnDefinition, WithPartitionColumnsClause } from "../CreateTable";
import {
Expand Down Expand Up @@ -143,39 +143,39 @@ export interface DropRowAccessPolicyStmt extends BaseNode {
export interface AlterOrganizationStmt extends BaseNode {
type: "alter_organization_stmt";
alterOrganizationKw: [Keyword<"ALTER">, Keyword<"ORGANIZATION">];
actions: AlterActionSetOptions[];
actions: AlterActionSetBigqueryOptions[];
}

// ALTER PROJECT
export interface AlterProjectStmt extends BaseNode {
type: "alter_project_stmt";
alterProjectKw: [Keyword<"ALTER">, Keyword<"PROJECT">];
name: Identifier;
actions: AlterActionSetOptions[];
actions: AlterActionSetBigqueryOptions[];
}

// ALTER BI_CAPACITY
export interface AlterBiCapacityStmt extends BaseNode {
type: "alter_bi_capacity_stmt";
alterBiCapacityKw: [Keyword<"ALTER">, Keyword<"BI_CAPACITY">];
name: EntityName;
actions: AlterActionSetOptions[];
actions: AlterActionSetBigqueryOptions[];
}

// ALTER CAPACITY
export interface AlterCapacityStmt extends BaseNode {
type: "alter_capacity_stmt";
alterCapacityKw: [Keyword<"ALTER">, Keyword<"CAPACITY">];
name: EntityName;
actions: AlterActionSetOptions[];
actions: AlterActionSetBigqueryOptions[];
}

// ALTER RESERVATION
export interface AlterReservationStmt extends BaseNode {
type: "alter_reservation_stmt";
alterReservationKw: [Keyword<"ALTER">, Keyword<"RESERVATION">];
name: EntityName;
actions: AlterActionSetOptions[];
actions: AlterActionSetBigqueryOptions[];
}

// ASSERT
Expand Down
22 changes: 11 additions & 11 deletions src/parser.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@ alter_view_stmt
}

alter_view_action
= &bigquery ac:alter_action_set_options { return ac; }
= &bigquery ac:alter_action_set_bigquery_options { return ac; }
/ &mysql ac:as_clause$compound_select_stmt { return ac; }
/ &postgres ac:alter_view_action_postgres { return ac; }

Expand Down Expand Up @@ -2387,7 +2387,7 @@ alter_action
alter_action_bigquery
= alter_action_alter_column
/ alter_action_set_default_collate
/ alter_action_set_options
/ alter_action_set_bigquery_options

alter_action_mysql
= alter_action_alter_column
Expand Down Expand Up @@ -2495,10 +2495,10 @@ alter_action_set_default_collate
});
}

alter_action_set_options
alter_action_set_bigquery_options
= kw:(SET __ ) options:bigquery_options {
return loc({
type: "alter_action_set_options",
type: "alter_action_set_bigquery_options",
setKw: read(kw),
options,
});
Expand Down Expand Up @@ -2714,7 +2714,7 @@ alter_column_action
alter_column_action_bigquery
= alter_action_drop_not_null
/ alter_action_set_data_type
/ alter_action_set_options
/ alter_action_set_bigquery_options

alter_column_action_mysql
= alter_action_set_visible
Expand Down Expand Up @@ -2983,7 +2983,7 @@ alter_schema_stmt
}

alter_schema_action
= &bigquery ac:alter_action_set_options { return ac; }
= &bigquery ac:alter_action_set_bigquery_options { return ac; }
/ &bigquery ac:alter_action_set_default_collate { return ac; }
/ &postgres ac:alter_action_rename { return ac; }
/ &postgres ac:alter_action_owner_to { return ac; }
Expand Down Expand Up @@ -4117,7 +4117,7 @@ drop_row_access_policy_stmt
}

alter_organization_stmt
= kw:(ALTER __ ORGANIZATION __) action:alter_action_set_options {
= kw:(ALTER __ ORGANIZATION __) action:alter_action_set_bigquery_options {
return loc({
type: "alter_organization_stmt",
alterOrganizationKw: read(kw),
Expand All @@ -4126,7 +4126,7 @@ alter_organization_stmt
}

alter_project_stmt
= kw:(ALTER __ PROJECT __) name:(ident __) action:alter_action_set_options {
= kw:(ALTER __ PROJECT __) name:(ident __) action:alter_action_set_bigquery_options {
return loc({
type: "alter_project_stmt",
alterProjectKw: read(kw),
Expand All @@ -4136,7 +4136,7 @@ alter_project_stmt
}

alter_bi_capacity_stmt
= kw:(ALTER __ BI_CAPACITY __) name:(entity_name __) action:alter_action_set_options {
= kw:(ALTER __ BI_CAPACITY __) name:(entity_name __) action:alter_action_set_bigquery_options {
return loc({
type: "alter_bi_capacity_stmt",
alterBiCapacityKw: read(kw),
Expand All @@ -4146,7 +4146,7 @@ alter_bi_capacity_stmt
}

alter_capacity_stmt
= kw:(ALTER __ CAPACITY __) name:(entity_name __) action:alter_action_set_options {
= kw:(ALTER __ CAPACITY __) name:(entity_name __) action:alter_action_set_bigquery_options {
return loc({
type: "alter_capacity_stmt",
alterCapacityKw: read(kw),
Expand All @@ -4156,7 +4156,7 @@ alter_capacity_stmt
}

alter_reservation_stmt
= kw:(ALTER __ RESERVATION __) name:(entity_name __) action:alter_action_set_options {
= kw:(ALTER __ RESERVATION __) name:(entity_name __) action:alter_action_set_bigquery_options {
return loc({
type: "alter_reservation_stmt",
alterReservationKw: read(kw),
Expand Down
2 changes: 1 addition & 1 deletion src/showNode/alter_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const alterActionMap: FullTransformMap<string, AllAlterActionNodes> = {
show([node.dropKw, node.ifExistsKw, node.column, node.behaviorKw]),
alter_action_set_default_collate: (node) =>
show([node.setDefaultCollateKw, node.collation]),
alter_action_set_options: (node) => show([node.setKw, node.options]),
alter_action_set_bigquery_options: (node) => show([node.setKw, node.options]),
alter_action_add_constraint: (node) => show([node.addKw, node.constraint]),
alter_action_drop_constraint: (node) =>
show([
Expand Down

0 comments on commit b21538f

Please sign in to comment.