happy-sql 1.5.2 → 1.5.3
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/ChangeLog +5 -0
- package/lib/parser/visitors/clause/column-definition/column-definition.js +12 -0
- package/lib/parser/visitors/clause/create-table/fixture/create-table-identity-always-fix.js +5 -0
- package/lib/parser/visitors/clause/create-table/fixture/create-table-identity-always.sql +1 -0
- package/lib/parser/visitors/clause/create-table/fixture/create-table-identity-by-default-fix.js +5 -0
- package/lib/parser/visitors/clause/create-table/fixture/create-table-identity-by-default.sql +1 -0
- package/lib/parser/visitors/clause/from/from.js +1 -0
- package/lib/parser/visitors/clause/where/where.js +1 -0
- package/lib/printer/visitors/call-expression/clauses/clauses.js +6 -0
- package/lib/printer/visitors/call-expression/clauses/create-table/fixture/createTableIdentity-fix.sql +1 -0
- package/lib/printer/visitors/call-expression/clauses/create-table/fixture/createTableIdentity.js +5 -0
- package/lib/printer/visitors/call-expression/clauses/create-table/fixture/createTableIdentityByDefault-fix.sql +1 -0
- package/lib/printer/visitors/call-expression/clauses/create-table/fixture/createTableIdentityByDefault.js +5 -0
- package/lib/printer/visitors/call-expression/clauses/identity/identity.js +3 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -15,6 +15,18 @@ const convertConstraint = (constraint) => {
|
|
|
15
15
|
if (constraint.type === 'constraint_primary_key')
|
|
16
16
|
return callExpression(identifier('primaryKey'), []);
|
|
17
17
|
|
|
18
|
+
if (constraint.type === 'constraint_generated') {
|
|
19
|
+
const kws = [];
|
|
20
|
+
|
|
21
|
+
for (const kw of constraint.generatedKw)
|
|
22
|
+
kws.push(kw.name);
|
|
23
|
+
|
|
24
|
+
if (kws.includes('DEFAULT'))
|
|
25
|
+
return callExpression(identifier('identityByDefault'), []);
|
|
26
|
+
|
|
27
|
+
return callExpression(identifier('identity'), []);
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
return callExpression(identifier('autoIncrement'), []);
|
|
19
31
|
};
|
|
20
32
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE TABLE t (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE TABLE t (id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY)
|
|
@@ -25,6 +25,10 @@ import {lastval} from './lastval/lastval.js';
|
|
|
25
25
|
import {like} from './like/like.js';
|
|
26
26
|
import {isNull, isNotNull} from './is-null/is-null.js';
|
|
27
27
|
import {inList} from './in-list/in-list.js';
|
|
28
|
+
import {
|
|
29
|
+
identity,
|
|
30
|
+
identityByDefault,
|
|
31
|
+
} from './identity/identity.js';
|
|
28
32
|
|
|
29
33
|
export const clauses = {
|
|
30
34
|
join,
|
|
@@ -55,4 +59,6 @@ export const clauses = {
|
|
|
55
59
|
isNull,
|
|
56
60
|
isNotNull,
|
|
57
61
|
inList,
|
|
62
|
+
identity,
|
|
63
|
+
identityByDefault,
|
|
58
64
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE TABLE t (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE TABLE t (id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY)
|