@dbml/core 2.4.3 → 2.4.4
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/lib/export/PostgresExporter.js +6 -3
- package/lib/parse/mysql/parser.pegjs +4 -4
- package/lib/parse/mysqlParser.js +89 -18
- package/lib/parse/postgresParser.js +5 -5
- package/lib/parse/postgresql/Base_rules.pegjs +1 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_normal.pegjs +8 -6
- package/package.json +2 -2
|
@@ -101,6 +101,7 @@ data_type "VALID TYPE" = c1:"CHARACTER"i _ c2:"VARYING"i _ args:("("expression")
|
|
|
101
101
|
args: null
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
|
|
104
105
|
type_name = pathName:path_name? c:(character)+ _ args:("(" expression ")")? {
|
|
105
106
|
let type_name = c.join("");
|
|
106
107
|
args = args ? args[1] : null;
|
|
@@ -94,13 +94,12 @@ table_property =
|
|
|
94
94
|
}
|
|
95
95
|
/ column_name:column_name __ data_type:data_type (__ COLLATE __ collation:identifier)? column_constraints:(_ column_constraint)* {
|
|
96
96
|
const column = { name: column_name , type: data_type};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const columnTypeName = column.type.type_name.toLowerCase();
|
|
98
|
+
const serialIncrementType = new Set(['serial', 'smallserial', 'bigserial']);
|
|
99
|
+
// process type for increment
|
|
100
|
+
if (serialIncrementType.has(columnTypeName)) {
|
|
101
101
|
column.increment = true;
|
|
102
102
|
}
|
|
103
|
-
|
|
104
103
|
// map from grammar to right object
|
|
105
104
|
column_constraints = column_constraints.map(c => c[1]);
|
|
106
105
|
// process column_constraints
|
|
@@ -109,6 +108,9 @@ table_property =
|
|
|
109
108
|
case "not_null":
|
|
110
109
|
column.not_null = value;
|
|
111
110
|
break;
|
|
111
|
+
case "increment":
|
|
112
|
+
column.increment = true;
|
|
113
|
+
break;
|
|
112
114
|
case "dbdefault":
|
|
113
115
|
column.dbdefault = value;
|
|
114
116
|
break;
|
|
@@ -138,7 +140,7 @@ column_constraint = constraint_name:(CONSTRAINT __ constraint_name:identifier __
|
|
|
138
140
|
/ NULL { return { type: "not_null" , value: false } }
|
|
139
141
|
/ CHECK _ "("_ expression _")" (__ NO __ INHERIT)? { return { type: "not_supported" } }
|
|
140
142
|
/ DEFAULT __ default_expr:default_expr { return { type: "dbdefault", value: default_expr } }
|
|
141
|
-
/ GENERATED __ (ALWAYS/ BY __ DEFAULT) __ AS __ IDENTITY { return { type: "
|
|
143
|
+
/ GENERATED __ (ALWAYS/ BY __ DEFAULT) __ AS __ IDENTITY { return { type: "increment" } } // (_ "("_ sequence_options _ ")")? { return { type: "not_supported" } }
|
|
142
144
|
/ UNIQUE (__ index_parameters)? { return { type: "unique" } }
|
|
143
145
|
/ PRIMARY_KEY (__ index_parameters)? { return { type: "pk" } }
|
|
144
146
|
/ REFERENCES __ reftable:table_name refcolumn:(_ "(" _ refcolumn:column_name _ ")" {return refcolumn})? (__ MATCH __ FULL/__ MATCH __ PARTIAL/__ MATCH __ SIMPLE)?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/core",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Holistics <dev@holistics.io>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"\\.(?!json$)[^.]*$": "jest-raw-loader"
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "39107aef57e41d29378ba15abe0c7057f7c5be00"
|
|
60
60
|
}
|