@travetto/model-postgres 7.0.0-rc.4 → 7.0.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/package.json +9 -8
- package/src/dialect.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-postgres",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "PostgreSQL backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"sql",
|
|
@@ -27,13 +28,13 @@
|
|
|
27
28
|
"directory": "module/model-postgres"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@travetto/cli": "^7.0.0
|
|
31
|
-
"@travetto/config": "^7.0.0
|
|
32
|
-
"@travetto/context": "^7.0.0
|
|
33
|
-
"@travetto/model": "^7.0.0
|
|
34
|
-
"@travetto/model-query": "^7.0.0
|
|
35
|
-
"@travetto/model-sql": "^7.0.0
|
|
36
|
-
"@types/pg": "^8.
|
|
31
|
+
"@travetto/cli": "^7.0.0",
|
|
32
|
+
"@travetto/config": "^7.0.0",
|
|
33
|
+
"@travetto/context": "^7.0.0",
|
|
34
|
+
"@travetto/model": "^7.0.0",
|
|
35
|
+
"@travetto/model-query": "^7.0.0",
|
|
36
|
+
"@travetto/model-sql": "^7.0.0",
|
|
37
|
+
"@types/pg": "^8.16.0",
|
|
37
38
|
"pg": "^8.16.3"
|
|
38
39
|
},
|
|
39
40
|
"travetto": {
|
package/src/dialect.ts
CHANGED
|
@@ -49,11 +49,11 @@ export class PostgreSQLDialect extends SQLDialect {
|
|
|
49
49
|
|
|
50
50
|
const [columns, foreignKeys, indices] = await Promise.all([
|
|
51
51
|
// 1. Columns
|
|
52
|
-
this.executeSQL<{ name: string, type: string,
|
|
52
|
+
this.executeSQL<{ name: string, type: string, is_not_null: boolean }>(`
|
|
53
53
|
SELECT
|
|
54
54
|
a.attname AS name,
|
|
55
55
|
pg_catalog.format_type(a.atttypid, a.atttypmod) AS type,
|
|
56
|
-
a.attnotnull AS
|
|
56
|
+
a.attnotnull AS is_not_null
|
|
57
57
|
FROM pg_catalog.pg_attribute a
|
|
58
58
|
JOIN pg_catalog.pg_class c ON c.oid = a.attrelid
|
|
59
59
|
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
|
|
@@ -114,7 +114,7 @@ export class PostgreSQLDialect extends SQLDialect {
|
|
|
114
114
|
type: col.type.toUpperCase()
|
|
115
115
|
.replace('CHARACTER VARYING', 'VARCHAR')
|
|
116
116
|
.replace('INTEGER', 'INT'),
|
|
117
|
-
|
|
117
|
+
is_not_null: !!col.is_not_null
|
|
118
118
|
})),
|
|
119
119
|
foreignKeys: foreignKeys.records,
|
|
120
120
|
indices: indices.records
|