@travetto/model-sqlite 6.0.1 → 7.0.0-rc.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 +7 -7
- package/src/dialect.ts +3 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-sqlite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-rc.0",
|
|
4
4
|
"description": "SQLite backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sql",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"directory": "module/model-sqlite"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^
|
|
30
|
-
"@travetto/context": "^
|
|
31
|
-
"@travetto/model": "^
|
|
32
|
-
"@travetto/model-query": "^
|
|
33
|
-
"@travetto/model-sql": "^
|
|
29
|
+
"@travetto/config": "^7.0.0-rc.0",
|
|
30
|
+
"@travetto/context": "^7.0.0-rc.0",
|
|
31
|
+
"@travetto/model": "^7.0.0-rc.0",
|
|
32
|
+
"@travetto/model-query": "^7.0.0-rc.0",
|
|
33
|
+
"@travetto/model-sql": "^7.0.0-rc.0",
|
|
34
34
|
"@types/better-sqlite3": "^7.6.13",
|
|
35
|
-
"better-sqlite3": "^12.4.
|
|
35
|
+
"better-sqlite3": "^12.4.6"
|
|
36
36
|
},
|
|
37
37
|
"travetto": {
|
|
38
38
|
"displayName": "SQLite Model Service",
|
package/src/dialect.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SchemaFieldConfig } from '@travetto/schema';
|
|
2
2
|
import { Injectable } from '@travetto/di';
|
|
3
3
|
import { AsyncContext } from '@travetto/context';
|
|
4
4
|
import { WhereClause } from '@travetto/model-query';
|
|
@@ -46,20 +46,13 @@ export class SqliteDialect extends SQLDialect {
|
|
|
46
46
|
return `hex('${value}')`;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Build identifier
|
|
51
|
-
*/
|
|
52
|
-
ident(field: FieldConfig | string): string {
|
|
53
|
-
return `\`${typeof field === 'string' ? field : field.name}\``;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
49
|
/**
|
|
57
50
|
* Define column modification
|
|
58
51
|
*/
|
|
59
52
|
getModifyColumnSQL(stack: VisitStack[]): string {
|
|
60
|
-
const field:
|
|
53
|
+
const field: SchemaFieldConfig = castTo(stack.at(-1));
|
|
61
54
|
const type = this.getColumnType(field);
|
|
62
|
-
const ident = this.ident(field.name);
|
|
55
|
+
const ident = this.ident(field.name.toString());
|
|
63
56
|
return `ALTER TABLE ${this.parentTable(stack)} ALTER COLUMN ${ident} TYPE ${type} USING (${ident}::${type});`;
|
|
64
57
|
}
|
|
65
58
|
|