Skip to content

Commit db9a3d3

Browse files
committed
Support all CREATE/ALTER/DROP statements
1 parent 007b123 commit db9a3d3

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/languages/duckdb/duckdb.formatter.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ const standardOnelineClauses = expandPhrases([
3636
]);
3737

3838
const tabularOnelineClauses = expandPhrases([
39-
// - create:
40-
'CREATE [OR REPLACE] [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]',
39+
// TABLE
4140
// - update:
4241
'UPDATE',
4342
// - insert:
@@ -59,6 +58,30 @@ const tabularOnelineClauses = expandPhrases([
5958
'SET [DATA] TYPE', // for alter column
6059
'{SET | DROP} DEFAULT', // for alter column
6160
'{SET | DROP} NOT NULL', // for alter column
61+
62+
// MACRO / FUNCTION
63+
'CREATE [OR REPLACE] [TEMPORARY | TEMP] {MACRO | FUNCTION}',
64+
'DROP MACRO [TABLE] [IF EXISTS]',
65+
'DROP FUNCTION [IF EXISTS]',
66+
// INDEX
67+
'CREATE [UNIQUE] INDEX [IF NOT EXISTS]',
68+
'DROP INDEX [IF EXISTS]',
69+
// SCHEMA
70+
'CREATE [OR REPLACE] SCHEMA [IF NOT EXISTS]',
71+
'DROP SCHEMA [IF EXISTS]',
72+
// SECRET
73+
'CREATE [OR REPLACE] [PERSISTENT | TEMPORARY] SECRET [IF NOT EXISTS]',
74+
'DROP [PERSISTENT | TEMPORARY] SECRET [IF EXISTS]',
75+
// SEQUENCE
76+
'CREATE [OR REPLACE] [TEMPORARY | TEMP] SEQUENCE',
77+
'DROP SEQUENCE [IF EXISTS]',
78+
// VIEW
79+
'CREATE [OR REPLACE] [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]',
80+
'DROP VIEW [IF EXISTS]',
81+
'ALTER VIEW',
82+
// TYPE
83+
'CREATE TYPE',
84+
'DROP TYPE [IF EXISTS]',
6285
]);
6386

6487
const reservedSetOperations = expandPhrases([

0 commit comments

Comments
 (0)