@ghom/orm 1.7.0 → 1.7.1
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/dist/cjs/app/table.js +6 -2
- package/dist/esm/app/table.js +6 -2
- package/dist/typings/app/orm.d.ts +1 -0
- package/dist/typings/app/table.d.ts +1 -0
- package/package.json +1 -1
- package/src/app/orm.ts +1 -0
- package/src/app/table.ts +15 -2
package/dist/cjs/app/table.js
CHANGED
|
@@ -43,7 +43,9 @@ class Table {
|
|
|
43
43
|
throw new Error("missing ORM");
|
|
44
44
|
try {
|
|
45
45
|
await this.db.schema.createTable(this.options.name, this.options.setup);
|
|
46
|
-
this.orm.config.logger?.log(`created table ${chalk_1.default[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}
|
|
46
|
+
this.orm.config.logger?.log(`created table ${chalk_1.default[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}${this.options.description
|
|
47
|
+
? ` ${chalk_1.default[this.orm.config.loggerColors?.description ?? "grey"](this.options.description)}`
|
|
48
|
+
: ""}`);
|
|
47
49
|
}
|
|
48
50
|
catch (error) {
|
|
49
51
|
if (error.toString().includes("syntax error")) {
|
|
@@ -51,7 +53,9 @@ class Table {
|
|
|
51
53
|
throw error;
|
|
52
54
|
}
|
|
53
55
|
else {
|
|
54
|
-
this.orm.config.logger?.log(`loaded table ${chalk_1.default[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}
|
|
56
|
+
this.orm.config.logger?.log(`loaded table ${chalk_1.default[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}${this.options.description
|
|
57
|
+
? ` ${chalk_1.default[this.orm.config.loggerColors?.description ?? "grey"](this.options.description)}`
|
|
58
|
+
: ""}`);
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
try {
|
package/dist/esm/app/table.js
CHANGED
|
@@ -39,7 +39,9 @@ export class Table {
|
|
|
39
39
|
throw new Error("missing ORM");
|
|
40
40
|
try {
|
|
41
41
|
await this.db.schema.createTable(this.options.name, this.options.setup);
|
|
42
|
-
this.orm.config.logger?.log(`created table ${chalk[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}
|
|
42
|
+
this.orm.config.logger?.log(`created table ${chalk[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}${this.options.description
|
|
43
|
+
? ` ${chalk[this.orm.config.loggerColors?.description ?? "grey"](this.options.description)}`
|
|
44
|
+
: ""}`);
|
|
43
45
|
}
|
|
44
46
|
catch (error) {
|
|
45
47
|
if (error.toString().includes("syntax error")) {
|
|
@@ -47,7 +49,9 @@ export class Table {
|
|
|
47
49
|
throw error;
|
|
48
50
|
}
|
|
49
51
|
else {
|
|
50
|
-
this.orm.config.logger?.log(`loaded table ${chalk[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}
|
|
52
|
+
this.orm.config.logger?.log(`loaded table ${chalk[this.orm.config.loggerColors?.highlight ?? "blueBright"](this.options.name)}${this.options.description
|
|
53
|
+
? ` ${chalk[this.orm.config.loggerColors?.description ?? "grey"](this.options.description)}`
|
|
54
|
+
: ""}`);
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
try {
|
package/package.json
CHANGED
package/src/app/orm.ts
CHANGED
package/src/app/table.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface MigrationData {
|
|
|
9
9
|
|
|
10
10
|
export interface TableOptions<Type extends object = object> {
|
|
11
11
|
name: string
|
|
12
|
+
description?: string
|
|
12
13
|
priority?: number
|
|
13
14
|
migrations?: { [version: number]: (table: Knex.CreateTableBuilder) => void }
|
|
14
15
|
then?: (this: Table<Type>, table: Table<Type>) => unknown
|
|
@@ -67,7 +68,13 @@ export class Table<Type extends object = object> {
|
|
|
67
68
|
this.orm.config.logger?.log(
|
|
68
69
|
`created table ${chalk[
|
|
69
70
|
this.orm.config.loggerColors?.highlight ?? "blueBright"
|
|
70
|
-
](this.options.name)}
|
|
71
|
+
](this.options.name)}${
|
|
72
|
+
this.options.description
|
|
73
|
+
? ` ${chalk[this.orm.config.loggerColors?.description ?? "grey"](
|
|
74
|
+
this.options.description,
|
|
75
|
+
)}`
|
|
76
|
+
: ""
|
|
77
|
+
}`,
|
|
71
78
|
)
|
|
72
79
|
} catch (error: any) {
|
|
73
80
|
if (error.toString().includes("syntax error")) {
|
|
@@ -82,7 +89,13 @@ export class Table<Type extends object = object> {
|
|
|
82
89
|
this.orm.config.logger?.log(
|
|
83
90
|
`loaded table ${chalk[
|
|
84
91
|
this.orm.config.loggerColors?.highlight ?? "blueBright"
|
|
85
|
-
](this.options.name)}
|
|
92
|
+
](this.options.name)}${
|
|
93
|
+
this.options.description
|
|
94
|
+
? ` ${chalk[this.orm.config.loggerColors?.description ?? "grey"](
|
|
95
|
+
this.options.description,
|
|
96
|
+
)}`
|
|
97
|
+
: ""
|
|
98
|
+
}`,
|
|
86
99
|
)
|
|
87
100
|
}
|
|
88
101
|
}
|