@travetto/model-sql 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 +8 -7
- package/src/dialect/base.ts +2 -3
- package/src/table-manager.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-sql",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "SQL backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"sql",
|
|
@@ -27,14 +28,14 @@
|
|
|
27
28
|
"directory": "module/model-sql"
|
|
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
|
|
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"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"@travetto/test": "^7.0.0
|
|
38
|
+
"@travetto/test": "^7.0.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependenciesMeta": {
|
|
40
41
|
"@travetto/test": {
|
package/src/dialect/base.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface Alias {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export type SQLTableDescription = {
|
|
20
|
-
columns: { name: string, type: string,
|
|
20
|
+
columns: { name: string, type: string, is_not_null: boolean }[];
|
|
21
21
|
foreignKeys: { name: string, from_column: string, to_column: string, to_table: string }[];
|
|
22
22
|
indices: { name: string, columns: { name: string, desc: boolean }[], is_unique: boolean }[];
|
|
23
23
|
};
|
|
@@ -635,7 +635,6 @@ LEFT OUTER JOIN ${from} ON
|
|
|
635
635
|
.map(item => this.resolveName(item.stack))
|
|
636
636
|
.join(', ');
|
|
637
637
|
|
|
638
|
-
// TODO: Really confused on this
|
|
639
638
|
return `GROUP BY ${this.alias(this.idField)}${sortFields ? `, ${sortFields}` : ''}`;
|
|
640
639
|
}
|
|
641
640
|
|
|
@@ -1064,7 +1063,7 @@ ${this.getWhereSQL(cls, where!)}`;
|
|
|
1064
1063
|
isColumnChanged(requested: SchemaFieldConfig, existing: SQLTableDescription['columns'][number],): boolean {
|
|
1065
1064
|
const requestedColumnType = this.getColumnType(requested);
|
|
1066
1065
|
const result =
|
|
1067
|
-
(requested.name !== this.idField.name && !!requested.required?.active !== !!existing.
|
|
1066
|
+
(requested.name !== this.idField.name && !!requested.required?.active !== !!existing.is_not_null)
|
|
1068
1067
|
|| (requestedColumnType.toUpperCase() !== existing.type.toUpperCase());
|
|
1069
1068
|
|
|
1070
1069
|
return result;
|
package/src/table-manager.ts
CHANGED
|
@@ -66,7 +66,6 @@ export class TableManager {
|
|
|
66
66
|
const model = path.length === 1 ? ModelRegistryIndex.getConfig(type) : undefined;
|
|
67
67
|
const requestedIndices = new Map((model?.indices ?? []).map(index => [this.#dialect.getIndexName(type, index), index]) ?? []);
|
|
68
68
|
|
|
69
|
-
|
|
70
69
|
// Manage fields
|
|
71
70
|
if (!existingFields.size) {
|
|
72
71
|
sqlCommands.table.push(this.#dialect.getCreateTableSQL(path));
|