-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { BaseNode, Keyword } from "./Base"; | ||
import { EntityName } from "./Expr"; | ||
|
||
export type AllSequenceNodes = AllSequenceStatements; | ||
|
||
export type AllSequenceStatements = CreateSequenceStmt; | ||
|
||
// CREATE VIEW | ||
export interface CreateSequenceStmt extends BaseNode { | ||
type: "create_sequence_stmt"; | ||
createKw: Keyword<"CREATE">; | ||
sequenceKw: Keyword<"SEQUENCE">; | ||
ifNotExistsKw?: [Keyword<"IF">, Keyword<"NOT">, Keyword<"EXISTS">]; | ||
name: EntityName; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { show } from "../show"; | ||
import { FullTransformMap } from "../cstTransformer"; | ||
import { AllSequenceNodes } from "../cst/Node"; | ||
|
||
export const sequenceMap: FullTransformMap<string, AllSequenceNodes> = { | ||
create_sequence_stmt: (node) => | ||
show([node.createKw, node.sequenceKw, node.ifNotExistsKw, node.name]), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { dialect, notDialect, test, testWc } from "../test_utils"; | ||
|
||
describe("sequence", () => { | ||
dialect("postgresql", () => { | ||
describe("CREATE SEQUENCE", () => { | ||
it("supports basic CREATE SEQUENCE statement", () => { | ||
testWc("CREATE SEQUENCE my_seq"); | ||
testWc("CREATE SEQUENCE my_schema.seq"); | ||
}); | ||
|
||
it("supports IF NOT EXISTS", () => { | ||
testWc("CREATE SEQUENCE IF NOT EXISTS my_seq"); | ||
}); | ||
}); | ||
}); | ||
|
||
notDialect("postgresql", () => { | ||
it("does not support CREATE/DROP SEQUENCE", () => { | ||
expect(() => test("CREATE SEQUENCE my_schema")).toThrowError(); | ||
expect(() => test("DROP SEQUENCE my_schema")).toThrowError(); | ||
}); | ||
}); | ||
}); |