@dbml/core 5.3.0 → 5.4.0
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.
- package/LICENSE +0 -0
- package/README.md +201 -1
- package/lib/export/DbmlExporter.js +5 -1
- package/lib/export/JsonExporter.js +0 -0
- package/lib/export/ModelExporter.js +0 -0
- package/lib/export/MysqlExporter.js +0 -0
- package/lib/export/OracleExporter.js +0 -0
- package/lib/export/PostgresExporter.js +0 -0
- package/lib/export/README.md +0 -0
- package/lib/export/SqlServerExporter.js +0 -0
- package/lib/export/index.js +0 -0
- package/lib/export/utils.js +0 -0
- package/lib/import/index.js +0 -0
- package/lib/index.js +7 -0
- package/lib/model_structure/check.js +0 -0
- package/lib/model_structure/config.js +0 -0
- package/lib/model_structure/database.js +0 -0
- package/lib/model_structure/dbState.js +0 -0
- package/lib/model_structure/element.js +0 -0
- package/lib/model_structure/endpoint.js +0 -0
- package/lib/model_structure/enum.js +0 -0
- package/lib/model_structure/enumValue.js +0 -0
- package/lib/model_structure/field.js +0 -0
- package/lib/model_structure/indexColumn.js +0 -0
- package/lib/model_structure/indexes.js +0 -0
- package/lib/model_structure/ref.js +0 -0
- package/lib/model_structure/schema.js +0 -0
- package/lib/model_structure/stickyNote.js +0 -0
- package/lib/model_structure/table.js +0 -0
- package/lib/model_structure/tableGroup.js +0 -0
- package/lib/model_structure/tablePartial.js +0 -0
- package/lib/model_structure/utils.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/AST.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/ParserErrorListener.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/SyntaxError.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/constants.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/helpers.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/index.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/README.md +263 -157
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mysql/README.md +262 -157
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/README.md +261 -157
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLLexerBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLParserBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/README.md +252 -157
- package/lib/parse/ANTLR/ASTGeneration/snowflake/README.md +236 -157
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +0 -0
- package/lib/parse/ANTLR/README.md +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexerBase.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexerBase.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserBase.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/README.md +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParserVisitor.js +0 -0
- package/lib/parse/Parser.js +0 -0
- package/lib/parse/buildParser.js +0 -0
- package/lib/parse/databaseGenerator.js +0 -0
- package/lib/parse/dbml/parser.pegjs +0 -0
- package/lib/parse/dbmlParser.js +0 -0
- package/lib/parse/error.js +0 -0
- package/lib/parse/mssql/base_parsers.js +0 -0
- package/lib/parse/mssql/column_definition/actions.js +0 -0
- package/lib/parse/mssql/column_definition/index.js +0 -0
- package/lib/parse/mssql/constraint_definition/actions.js +0 -0
- package/lib/parse/mssql/constraint_definition/index.js +0 -0
- package/lib/parse/mssql/expression.js +0 -0
- package/lib/parse/mssql/fk_definition/actions.js +0 -0
- package/lib/parse/mssql/fk_definition/index.js +0 -0
- package/lib/parse/mssql/index.js +0 -0
- package/lib/parse/mssql/index_definition/actions.js +0 -0
- package/lib/parse/mssql/index_definition/index.js +0 -0
- package/lib/parse/mssql/keyword_parsers.js +0 -0
- package/lib/parse/mssql/keyword_utils.js +0 -0
- package/lib/parse/mssql/statements/actions.js +0 -0
- package/lib/parse/mssql/statements/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/index.js +0 -0
- package/lib/parse/mssql/utils.js +0 -0
- package/lib/parse/mssql/whitespaces.js +0 -0
- package/lib/parse/mssqlParser.js +0 -0
- package/lib/parse/mysql/parser.pegjs +0 -0
- package/lib/parse/mysqlParser.js +0 -0
- package/lib/parse/postgresParser.js +0 -0
- package/lib/parse/postgresql/Base_rules.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Alter_table/Alter_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Commands.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Comment.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_index.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_normal.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_partition_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_enum.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_range.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Ignore_syntax.pegjs +0 -0
- package/lib/parse/postgresql/Expression.pegjs +0 -0
- package/lib/parse/postgresql/InitializerUtils.pegjs +0 -0
- package/lib/parse/postgresql/Keywords.pegjs +0 -0
- package/lib/parse/postgresql/get_parser.js +0 -0
- package/lib/parse/postgresql/parser.pegjs +0 -0
- package/lib/parse/schemarb/parser.pegjs +0 -0
- package/lib/parse/schemarbParser.js +0 -0
- package/lib/transform/index.js +30 -0
- package/lib/utils/version.js +0 -0
- package/package.json +3 -3
- package/types/export/ModelExporter.d.ts +0 -0
- package/types/export/index.d.ts +0 -0
- package/types/import/index.d.ts +0 -0
- package/types/index.d.ts +2 -1
- package/types/model_structure/check.d.ts +0 -0
- package/types/model_structure/database.d.ts +0 -0
- package/types/model_structure/dbState.d.ts +0 -0
- package/types/model_structure/element.d.ts +0 -0
- package/types/model_structure/endpoint.d.ts +0 -0
- package/types/model_structure/enum.d.ts +0 -0
- package/types/model_structure/enumValue.d.ts +0 -0
- package/types/model_structure/field.d.ts +0 -0
- package/types/model_structure/indexColumn.d.ts +0 -0
- package/types/model_structure/indexes.d.ts +0 -0
- package/types/model_structure/ref.d.ts +0 -0
- package/types/model_structure/schema.d.ts +0 -0
- package/types/model_structure/stickyNote.d.ts +0 -0
- package/types/model_structure/table.d.ts +0 -0
- package/types/model_structure/tableGroup.d.ts +0 -0
- package/types/model_structure/tablePartial.d.ts +0 -0
- package/types/parse/Parser.d.ts +0 -0
- package/types/parse/error.d.ts +0 -0
- package/types/transform/index.d.ts +7 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @dbml/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Refer to [@dbml/core](https://dbml.dbdiagram.io/js-module/core) for the complete API reference.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,3 +10,203 @@ npm install @dbml/core
|
|
|
10
10
|
# or if you're using yarn
|
|
11
11
|
yarn add @dbml/core
|
|
12
12
|
```
|
|
13
|
+
|
|
14
|
+
## SQL Parser Feature Support
|
|
15
|
+
|
|
16
|
+
This section documents the SQL parsing capabilities for each supported database when importing SQL to DBML.
|
|
17
|
+
|
|
18
|
+
For more detailed documentation on each SQL parser, see the individual parser READMEs:
|
|
19
|
+
- [PostgreSQL Parser](./src/parse/ANTLR/ASTGeneration/postgres/README.md)
|
|
20
|
+
- [MySQL Parser](./src/parse/ANTLR/ASTGeneration/mysql/README.md)
|
|
21
|
+
- [MSSQL Parser](./src/parse/ANTLR/ASTGeneration/mssql/README.md)
|
|
22
|
+
- [Oracle Parser](./src/parse/ANTLR/ASTGeneration/oraclesql/README.md)
|
|
23
|
+
- [Snowflake Parser](./src/parse/ANTLR/ASTGeneration/snowflake/README.md)
|
|
24
|
+
|
|
25
|
+
### Support Legend
|
|
26
|
+
|
|
27
|
+
| Symbol | Meaning |
|
|
28
|
+
|--------|---------|
|
|
29
|
+
| ✓ | Fully supported and correctly parsed |
|
|
30
|
+
| ◐ | Valid SQL that is parsed, but some options/clauses are ignored |
|
|
31
|
+
| ✗ | Valid SQL syntax, but the parser fails to generate output |
|
|
32
|
+
| — | Syntax not valid for this database |
|
|
33
|
+
|
|
34
|
+
### `CREATE TABLE`
|
|
35
|
+
|
|
36
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
37
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
38
|
+
| Basic syntax | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
39
|
+
| Parameterized types (e.g., `VARCHAR(255)`) | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
40
|
+
| Array types (e.g., `INTEGER[]`) | ✓ | — | — | — | — |
|
|
41
|
+
| Enumerated types (`ENUM`) | ✓ | ✓ | — | — | — |
|
|
42
|
+
| Temporary tables | ◐ | ✗ | ✓ | ◐ | ◐ |
|
|
43
|
+
| `CREATE TABLE` AS SELECT | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
44
|
+
| Table options (`ENGINE`, `TABLESPACE`, etc.) | ◐ | ◐ | ◐ | ◐ | ◐ |
|
|
45
|
+
| Other column properties (`COLLATE`, etc.) | ◐ | ✗ | ◐ | ◐ | ◐ |
|
|
46
|
+
| Generated/Computed columns | ◐ | ◐ | ◐ | ◐ | ◐ |
|
|
47
|
+
|
|
48
|
+
**Notes:**
|
|
49
|
+
- **MSSQL**:
|
|
50
|
+
- Temporary tables use `#` prefix (local) and `##` prefix (global)
|
|
51
|
+
- Square bracket identifiers (`[identifier]`) are supported
|
|
52
|
+
|
|
53
|
+
#### `PRIMARY KEY`
|
|
54
|
+
|
|
55
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
56
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
57
|
+
| Column-level | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
58
|
+
| Table-level | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
59
|
+
| Multi-column | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
60
|
+
| Explicitly named (`CONSTRAINT name`) | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
61
|
+
| CLUSTERED/NONCLUSTERED | — | — | ◐ | — | — |
|
|
62
|
+
|
|
63
|
+
#### `FOREIGN KEY`
|
|
64
|
+
|
|
65
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
66
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
67
|
+
| Column-level (`REFERENCES`) | ✓ | ✓ | ✗ | ✓ | ✗ |
|
|
68
|
+
| Table-level | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
69
|
+
| Multi-column | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
70
|
+
| Explicitly named (`CONSTRAINT name`) | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
71
|
+
| `ON UPDATE` action | ✓ | ✓ | ✓ | — | ✗ |
|
|
72
|
+
| `ON DELETE` action | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
73
|
+
|
|
74
|
+
**Notes:**
|
|
75
|
+
- **MSSQL**: Column-level `FOREIGN KEY` has a known bug - use table-level syntax instead
|
|
76
|
+
- **Snowflake**: All `FOREIGN KEY` definitions have a known bug producing undefined errors
|
|
77
|
+
|
|
78
|
+
#### `UNIQUE`
|
|
79
|
+
|
|
80
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
81
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
82
|
+
| Column-level | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
83
|
+
| Table-level | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
84
|
+
| Multi-column | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
85
|
+
| Explicitly named (`CONSTRAINT name`) | ✓ | ✓ | ◐ | ✓ | ◐ |
|
|
86
|
+
| `UNIQUE KEY`/`UNIQUE INDEX` syntax | — | ✓ | — | — | — |
|
|
87
|
+
|
|
88
|
+
#### `CHECK`
|
|
89
|
+
|
|
90
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
91
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
92
|
+
| Column-level | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
93
|
+
| Table-level | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
94
|
+
| Explicitly named (`CONSTRAINT name`) | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
95
|
+
|
|
96
|
+
#### `DEFAULT`
|
|
97
|
+
|
|
98
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
99
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
100
|
+
| Column-level | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
101
|
+
| Function as default | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
102
|
+
| Explicitly named (`CONSTRAINT name`) | — | — | ◐ | — | ◐ |
|
|
103
|
+
|
|
104
|
+
#### `NOT NULL`
|
|
105
|
+
|
|
106
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
107
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
108
|
+
| Column-level `NOT NULL` | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
109
|
+
| Explicit column-level `NULL` | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
110
|
+
|
|
111
|
+
#### Auto-Increment Columns
|
|
112
|
+
|
|
113
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
114
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
115
|
+
| `SERIAL` (pseudo-type) | ✓ | — | — | — | — |
|
|
116
|
+
| `BIGSERIAL` (pseudo-type) | ✓ | — | — | — | — |
|
|
117
|
+
| `AUTO_INCREMENT` (column attribute) | — | ✓ | — | — | — |
|
|
118
|
+
| `IDENTITY(seed, increment)` (column property) | — | — | ✓ | — | ✓ |
|
|
119
|
+
| `GENERATED AS IDENTITY` (column property) | ✓ | — | ✗ | ✓ | ✗ |
|
|
120
|
+
| `GENERATED ALWAYS AS IDENTITY` | ✓ | — | — | ✓ | — |
|
|
121
|
+
| `GENERATED BY DEFAULT AS IDENTITY` | ✓ | — | — | ✓ | — |
|
|
122
|
+
|
|
123
|
+
#### Inline Indexes
|
|
124
|
+
|
|
125
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
126
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
127
|
+
| Column-level indexes | — | ✗ | — | — | — |
|
|
128
|
+
| Table-level `INDEX`/`KEY` | — | ✓ | — | ✓ | — |
|
|
129
|
+
| Named indexes | — | ✓ | — | ✓ | — |
|
|
130
|
+
| Multi-column indexes | — | ✓ | — | ✓ | — |
|
|
131
|
+
| USING BTREE/HASH | — | ✓ | — | — | — |
|
|
132
|
+
| FULLTEXT/SPATIAL | — | ◐ | — | — | — |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### `CREATE INDEX`
|
|
137
|
+
|
|
138
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
139
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
140
|
+
| Basic `CREATE INDEX` | ✓ | ✓ | ✓ | ✓ | — |
|
|
141
|
+
| Multi-column index | ✓ | ✓ | ✓ | ✓ | — |
|
|
142
|
+
| `UNIQUE` index | ✓ | ✓ | ✓ | ✓ | — |
|
|
143
|
+
| Function-based index | ✓ | ✓ | — | ✓ | — |
|
|
144
|
+
| BTREE | ✓ | ✓ | ✗ | — | — |
|
|
145
|
+
| HASH | ✓ | ✓ | — | — | — |
|
|
146
|
+
| GIST | ✓ | — | — | — | — |
|
|
147
|
+
| BRIN | ✓ | — | — | — | — |
|
|
148
|
+
| GIN | ✓ | — | — | — | — |
|
|
149
|
+
| Partial/Filtered index (`WHERE`) | ◐ | ✗ | ◐ | ◐ | — |
|
|
150
|
+
| FULLTEXT | — | ◐ | ✗ | — | — |
|
|
151
|
+
| SPATIAL | — | ◐ | ✗ | — | — |
|
|
152
|
+
|
|
153
|
+
**Notes:**
|
|
154
|
+
- **MSSQL**: Function-based indexes use computed columns instead
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### `INSERT` Statements
|
|
159
|
+
|
|
160
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
161
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
162
|
+
| Basic `INSERT` ... VALUES | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
163
|
+
| Multi-row `INSERT` | ✓ | ✓ | ✓ | — | ✓ |
|
|
164
|
+
| `INSERT` ... SELECT | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
165
|
+
| `INSERT` ... with returned rows (`RETURNING`, `OUTPUT`) | ◐ | — | ◐ | ◐ | — |
|
|
166
|
+
| `INSERT` ... ON CONFLICT/DUPLICATE KEY | ◐ | ◐ | — | — | — |
|
|
167
|
+
|
|
168
|
+
**Notes:**
|
|
169
|
+
- **Oracle**: Uses `INSERT ALL` syntax for multi-row inserts (not supported)
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
### `ALTER TABLE`
|
|
174
|
+
|
|
175
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
176
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
177
|
+
| **ADD COLUMN** | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
178
|
+
| **DROP COLUMN** | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
179
|
+
| **ALTER/MODIFY COLUMN** | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
180
|
+
| **RENAME COLUMN** | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
181
|
+
| **ADD CONSTRAINT** | | | | | |
|
|
182
|
+
| - `DEFAULT` | ✗ | ✗ | ✓ | ✓ | ✗ |
|
|
183
|
+
| - `NOT NULL` | ✗ | ✗ | ✗ | ✓ | ✗ |
|
|
184
|
+
| - `CHECK` | ✓ | ✓ | ✓ | ✓ | — |
|
|
185
|
+
| - `UNIQUE` | ✓ | ✗ | ✓ | ✓ | ✓ |
|
|
186
|
+
| - `PRIMARY KEY` | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
187
|
+
| - `FOREIGN KEY` | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
188
|
+
| **DROP CONSTRAINT** | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### Comments
|
|
193
|
+
|
|
194
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
195
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
196
|
+
| Table comments | ✓ | ✓ | ◐ | ✓ | ✓ |
|
|
197
|
+
| Column comments | ✓ | ✓ | ◐ | ✓ | ✗ |
|
|
198
|
+
| Comment syntax | `COMMENT ON` | Inline `COMMENT` | `sp_addextendedproperty` | `COMMENT ON` | Inline `COMMENT` |
|
|
199
|
+
|
|
200
|
+
**Notes:**
|
|
201
|
+
- **MSSQL**: Comments via `sp_addextendedproperty` have unreliable parsing
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
### Other DDL Statements
|
|
206
|
+
|
|
207
|
+
| Feature | PostgreSQL | MySQL | MSSQL | Oracle | Snowflake |
|
|
208
|
+
|---------|------------|-------|-------|--------|-----------|
|
|
209
|
+
| `DROP TABLE` | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
210
|
+
| `DROP INDEX` | ✗ | ✗ | ✗ | ✗ | — |
|
|
211
|
+
| `ALTER INDEX` | ✗ | — | ✗ | ✗ | — |
|
|
212
|
+
| `CREATE VIEW` | ✗ | ✗ | ✗ | ✗ | ✗ |
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
+
var _parse = require("@dbml/parse");
|
|
8
9
|
var _utils = require("./utils");
|
|
9
10
|
var _config = require("../model_structure/config");
|
|
10
11
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -224,6 +225,9 @@ var DbmlExporter = /*#__PURE__*/function () {
|
|
|
224
225
|
// Include schema name if needed
|
|
225
226
|
var tableName = "\"".concat(table.name, "\"");
|
|
226
227
|
if ((0, _utils.shouldPrintSchema)(schema, model)) tableName = "\"".concat(schema.name, "\".\"").concat(table.name, "\"");
|
|
228
|
+
|
|
229
|
+
// Include alias if present
|
|
230
|
+
var aliasStr = table.alias ? " as ".concat((0, _parse.addQuoteIfNeeded)(table.alias)) : '';
|
|
227
231
|
var fieldStr = tableContent.fieldContents.map(function (field) {
|
|
228
232
|
return " ".concat(field, "\n");
|
|
229
233
|
}).join('');
|
|
@@ -242,7 +246,7 @@ var DbmlExporter = /*#__PURE__*/function () {
|
|
|
242
246
|
indexStr = "\n Indexes {\n".concat(indexBody, " }\n");
|
|
243
247
|
}
|
|
244
248
|
var noteStr = table.note ? " Note: ".concat(DbmlExporter.escapeNote(table.note), "\n") : '';
|
|
245
|
-
return "Table ".concat(tableName).concat(tableSettingStr, " {\n").concat(fieldStr).concat(checkStr).concat(indexStr).concat(noteStr, "}\n");
|
|
249
|
+
return "Table ".concat(tableName).concat(aliasStr).concat(tableSettingStr, " {\n").concat(fieldStr).concat(checkStr).concat(indexStr).concat(noteStr, "}\n");
|
|
246
250
|
});
|
|
247
251
|
return tableStrs.length ? tableStrs.join('\n') : '';
|
|
248
252
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/export/README.md
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/export/index.js
CHANGED
|
File without changes
|
package/lib/export/utils.js
CHANGED
|
File without changes
|
package/lib/import/index.js
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
@@ -39,10 +39,17 @@ Object.defineProperty(exports, "importer", {
|
|
|
39
39
|
return _import["default"];
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "renameTable", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _transform.renameTable;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
42
48
|
var _ModelExporter = _interopRequireDefault(require("./export/ModelExporter"));
|
|
43
49
|
var _Parser = _interopRequireDefault(require("./parse/Parser"));
|
|
44
50
|
var _error = require("./parse/error");
|
|
45
51
|
var _import = _interopRequireDefault(require("./import"));
|
|
46
52
|
var _export = _interopRequireDefault(require("./export"));
|
|
53
|
+
var _transform = require("./transform");
|
|
47
54
|
var _version = require("./utils/version");
|
|
48
55
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|