@travetto/model-mysql 3.0.2-rc.1 → 3.0.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/README.md +7 -13
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<!-- This file was generated by @travetto/doc and should not be modified directly -->
|
|
2
|
-
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/model-mysql/DOC.
|
|
2
|
+
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/model-mysql/DOC.tsx and execute "npx trv doc" to rebuild -->
|
|
3
3
|
# MySQL Model Service
|
|
4
|
+
|
|
4
5
|
## MySQL backing for the travetto model module, with real-time modeling support for SQL schemas.
|
|
5
6
|
|
|
6
7
|
**Install: @travetto/model-mysql**
|
|
@@ -12,24 +13,19 @@ npm install @travetto/model-mysql
|
|
|
12
13
|
yarn add @travetto/model-mysql
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
This module provides a [MySQL](https://www.mysql.com/)-based implementation for the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module. This source allows the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module to read, write and query against [SQL](https://en.wikipedia.org/wiki/SQL) databases. In development mode, the [SQLModelService](https://github.com/travetto/travetto/tree/main/module/model-sql/src/service.ts#L38) will also modify the database schema in real time to minimize impact to development.
|
|
16
|
+
This module provides a [MySQL](https://www.mysql.com/)-based implementation for the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module. This source allows the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module to read, write and query against [SQL](https://en.wikipedia.org/wiki/SQL) databases. In development mode, the [SQLModelService](https://github.com/travetto/travetto/tree/main/module/model-sql/src/service.ts#L38) will also modify the database schema in real time to minimize impact to development.
|
|
16
17
|
|
|
17
|
-
The schema generated will not generally map to existing tables as it is attempting to produce a document store like experience on top of
|
|
18
|
-
a [SQL](https://en.wikipedia.org/wiki/SQL) database. Every table generated will have a `path_id` which determines it's location in the document hierarchy as well as sub tables will have a `parent_path_id` to associate records with the parent values.
|
|
18
|
+
The schema generated will not generally map to existing tables as it is attempting to produce a document store like experience on top of a [SQL](https://en.wikipedia.org/wiki/SQL) database. Every table generated will have a `path_id` which determines it's location in the document hierarchy as well as sub tables will have a `parent_path_id` to associate records with the parent values.
|
|
19
19
|
|
|
20
20
|
Supported features:
|
|
21
|
-
|
|
22
21
|
* [CRUD](https://github.com/travetto/travetto/tree/main/module/model/src/service/crud.ts#L11)
|
|
23
22
|
* [Bulk](https://github.com/travetto/travetto/tree/main/module/model/src/service/bulk.ts#L19)
|
|
24
23
|
* [Query Crud](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/crud.ts#L11)
|
|
25
24
|
* [Facet](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/facet.ts#L12)
|
|
26
25
|
* [Query](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/query.ts#L10)
|
|
27
26
|
* [Suggest](https://github.com/travetto/travetto/tree/main/module/model-query/src/service/suggest.ts#L12)
|
|
27
|
+
Out of the box, by installing the module, everything should be wired up by default.If you need to customize any aspect of the source or config, you can override and register it with the [Dependency Injection](https://github.com/travetto/travetto/tree/main/module/di#readme "Dependency registration/management and injection support.") module.
|
|
28
28
|
|
|
29
|
-
Out of the box, by installing the module, everything should be wired up by default.If you need to customize any aspect of the source
|
|
30
|
-
or config, you can override and register it with the [Dependency Injection](https://github.com/travetto/travetto/tree/main/module/di#readme "Dependency registration/management and injection support.") module.
|
|
31
|
-
|
|
32
|
-
|
|
33
29
|
**Code: Wiring up a custom Model Source**
|
|
34
30
|
```typescript
|
|
35
31
|
import { AsyncContext } from '@travetto/context';
|
|
@@ -46,9 +42,8 @@ export class Init {
|
|
|
46
42
|
}
|
|
47
43
|
```
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
where the [SQLModelConfig](https://github.com/travetto/travetto/tree/main/module/model-sql/src/config.ts#L7) is defined by:
|
|
50
46
|
|
|
51
|
-
|
|
52
47
|
**Code: Structure of SQLModelConfig**
|
|
53
48
|
```typescript
|
|
54
49
|
import { Config } from '@travetto/config';
|
|
@@ -98,5 +93,4 @@ export class SQLModelConfig<T extends {} = {}> {
|
|
|
98
93
|
}
|
|
99
94
|
```
|
|
100
95
|
|
|
101
|
-
|
|
102
|
-
standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Configuration support")resolution paths.
|
|
96
|
+
Additionally, you can see that the class is registered with the [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) annotation, and so these values can be overridden using the standard [Configuration](https://github.com/travetto/travetto/tree/main/module/config#readme "Configuration support") resolution paths.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-mysql",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "MySQL backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sql",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"directory": "module/model-mysql"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@travetto/config": "^3.0.
|
|
31
|
-
"@travetto/context": "^3.0.
|
|
32
|
-
"@travetto/model": "^3.0.
|
|
33
|
-
"@travetto/model-query": "^3.0.
|
|
34
|
-
"@travetto/model-sql": "^3.0.
|
|
30
|
+
"@travetto/config": "^3.0.3",
|
|
31
|
+
"@travetto/context": "^3.0.3",
|
|
32
|
+
"@travetto/model": "^3.0.3",
|
|
33
|
+
"@travetto/model-query": "^3.0.3",
|
|
34
|
+
"@travetto/model-sql": "^3.0.3",
|
|
35
35
|
"@types/mysql": "^2.15.21",
|
|
36
36
|
"mysql2": "^3.1.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@travetto/command": "^3.0.
|
|
39
|
+
"@travetto/command": "^3.0.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@travetto/command": {
|