imodel 0.2.0 → 0.3.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/index.d.mts +74 -48
- package/index.mjs +169 -216
- package/migrate.d.mts +2 -39
- package/migrate.mjs +9 -57
- package/package.json +1 -1
package/migrate.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* imodel v0.
|
|
2
|
+
* imodel v0.3.0
|
|
3
3
|
* (c) 2019-2025 undefined
|
|
4
4
|
* @license undefined
|
|
5
5
|
*/
|
|
@@ -223,12 +223,6 @@ declare class TableAdder {
|
|
|
223
223
|
* @returns {this}
|
|
224
224
|
*/
|
|
225
225
|
text(name: string, options?: ColumnOptions<string>): this;
|
|
226
|
-
/**
|
|
227
|
-
* @param {string} name
|
|
228
|
-
* @param {ColumnOptions<never>} [options]
|
|
229
|
-
* @returns {this}
|
|
230
|
-
*/
|
|
231
|
-
id(name: string, options?: ColumnOptions<never>): this;
|
|
232
226
|
/**
|
|
233
227
|
* @param {string} name
|
|
234
228
|
* @param {ColumnOptions<number | bigint>} [options]
|
|
@@ -247,24 +241,6 @@ declare class TableAdder {
|
|
|
247
241
|
* @returns {this}
|
|
248
242
|
*/
|
|
249
243
|
i64(name: string, options?: ColumnOptions<number | bigint>): this;
|
|
250
|
-
/**
|
|
251
|
-
* @param {string} name
|
|
252
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
253
|
-
* @returns {this}
|
|
254
|
-
*/
|
|
255
|
-
u16(name: string, options?: ColumnOptions<number | bigint>): this;
|
|
256
|
-
/**
|
|
257
|
-
* @param {string} name
|
|
258
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
259
|
-
* @returns {this}
|
|
260
|
-
*/
|
|
261
|
-
u32(name: string, options?: ColumnOptions<number | bigint>): this;
|
|
262
|
-
/**
|
|
263
|
-
* @param {string} name
|
|
264
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
265
|
-
* @returns {this}
|
|
266
|
-
*/
|
|
267
|
-
u64(name: string, options?: ColumnOptions<number | bigint>): this;
|
|
268
244
|
/**
|
|
269
245
|
* @param {string} name
|
|
270
246
|
* @param {ColumnOptions<number | bigint>} [options]
|
|
@@ -295,12 +271,6 @@ declare class TableAdder {
|
|
|
295
271
|
* @returns {this}
|
|
296
272
|
*/
|
|
297
273
|
money(name: string, options?: ColumnOptions<number | bigint>): this;
|
|
298
|
-
/**
|
|
299
|
-
* @param {string} name
|
|
300
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
301
|
-
* @returns {this}
|
|
302
|
-
*/
|
|
303
|
-
bin(name: string, options?: ColumnOptions<number | bigint>): this;
|
|
304
274
|
/**
|
|
305
275
|
* @param {string} name
|
|
306
276
|
* @param {ColumnOptions<never>} [options]
|
|
@@ -645,13 +615,6 @@ declare function sqlite3(...list: (Migrator | Migrator[])[]): MigrationType;
|
|
|
645
615
|
* @returns
|
|
646
616
|
*/
|
|
647
617
|
declare function table(table: string | TableDefine): TableCreator;
|
|
648
|
-
/**
|
|
649
|
-
*
|
|
650
|
-
* @param {string} ta
|
|
651
|
-
* @param {string} tb
|
|
652
|
-
* @returns
|
|
653
|
-
*/
|
|
654
|
-
declare function joinTable(ta: string, tb: string): TableCreator;
|
|
655
618
|
|
|
656
619
|
type Migrator = {
|
|
657
620
|
tables: (revert?: boolean | undefined) => Iterable<string>;
|
|
@@ -659,4 +622,4 @@ type Migrator = {
|
|
|
659
622
|
down: (connection: Connection, echoDescription: Echo) => PromiseLike<void> | void;
|
|
660
623
|
};
|
|
661
624
|
|
|
662
|
-
export { Echo, type MigrationDef, type MigrationDefine, type MigrationPromise, type MigrationValue, type Migrator, _default as auto, _default$1 as createEcho, customize, down, create as exec,
|
|
625
|
+
export { Echo, type MigrationDef, type MigrationDefine, type MigrationPromise, type MigrationValue, type Migrator, _default as auto, _default$1 as createEcho, customize, down, create as exec, mysql, postgres, revert, sqlite, sqlite3, table, type, up };
|
package/migrate.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* imodel v0.
|
|
2
|
+
* imodel v0.3.0
|
|
3
3
|
* (c) 2019-2025 undefined
|
|
4
4
|
* @license undefined
|
|
5
5
|
*/
|
|
@@ -103,14 +103,6 @@ class TableAdder {
|
|
|
103
103
|
text(name, options) {
|
|
104
104
|
return this.field(name, 'text', options);
|
|
105
105
|
}
|
|
106
|
-
/**
|
|
107
|
-
* @param {string} name
|
|
108
|
-
* @param {ColumnOptions<never>} [options]
|
|
109
|
-
* @returns {this}
|
|
110
|
-
*/
|
|
111
|
-
id(name, options) {
|
|
112
|
-
return this.field(name, 'id', options);
|
|
113
|
-
}
|
|
114
106
|
/**
|
|
115
107
|
* @param {string} name
|
|
116
108
|
* @param {ColumnOptions<number | bigint>} [options]
|
|
@@ -135,30 +127,6 @@ class TableAdder {
|
|
|
135
127
|
i64(name, options) {
|
|
136
128
|
return this.field(name, 'i64', options);
|
|
137
129
|
}
|
|
138
|
-
/**
|
|
139
|
-
* @param {string} name
|
|
140
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
141
|
-
* @returns {this}
|
|
142
|
-
*/
|
|
143
|
-
u16(name, options) {
|
|
144
|
-
return this.field(name, 'u16', options);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* @param {string} name
|
|
148
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
149
|
-
* @returns {this}
|
|
150
|
-
*/
|
|
151
|
-
u32(name, options) {
|
|
152
|
-
return this.field(name, 'u32', options);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* @param {string} name
|
|
156
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
157
|
-
* @returns {this}
|
|
158
|
-
*/
|
|
159
|
-
u64(name, options) {
|
|
160
|
-
return this.field(name, 'u64', options);
|
|
161
|
-
}
|
|
162
130
|
/**
|
|
163
131
|
* @param {string} name
|
|
164
132
|
* @param {ColumnOptions<number | bigint>} [options]
|
|
@@ -199,14 +167,6 @@ class TableAdder {
|
|
|
199
167
|
money(name, options) {
|
|
200
168
|
return this.field(name, 'money', options);
|
|
201
169
|
}
|
|
202
|
-
/**
|
|
203
|
-
* @param {string} name
|
|
204
|
-
* @param {ColumnOptions<number | bigint>} [options]
|
|
205
|
-
* @returns {this}
|
|
206
|
-
*/
|
|
207
|
-
bin(name, options) {
|
|
208
|
-
return this.field(name, 'binary', options);
|
|
209
|
-
}
|
|
210
170
|
/**
|
|
211
171
|
* @param {string} name
|
|
212
172
|
* @param {ColumnOptions<never>} [options]
|
|
@@ -344,7 +304,8 @@ class TableAdder {
|
|
|
344
304
|
*/
|
|
345
305
|
deleteTime() {
|
|
346
306
|
return this.field('deleteOn', 'timestamp', {
|
|
347
|
-
nullable: true
|
|
307
|
+
nullable: true,
|
|
308
|
+
deleting: now
|
|
348
309
|
});
|
|
349
310
|
}
|
|
350
311
|
}
|
|
@@ -895,7 +856,7 @@ class TableCreator extends TableAdder {
|
|
|
895
856
|
if (!type.table) {
|
|
896
857
|
this.field(name, 'object', {
|
|
897
858
|
...field,
|
|
898
|
-
primary:
|
|
859
|
+
primary: 0
|
|
899
860
|
});
|
|
900
861
|
continue;
|
|
901
862
|
}
|
|
@@ -1211,13 +1172,13 @@ async function create(connection, migrations, log, revert) {
|
|
|
1211
1172
|
/** @typedef {MigrationDef | PromiseLike<MigrationDef>} MigrationPromise */
|
|
1212
1173
|
/** @typedef {MigrationPromise | (() => MigrationPromise)} MigrationDefine */
|
|
1213
1174
|
const TableMigration = Query.table('__table_migrations', {
|
|
1214
|
-
|
|
1175
|
+
group: define('string', {
|
|
1215
1176
|
nullable: false,
|
|
1216
|
-
primary:
|
|
1177
|
+
primary: 1
|
|
1217
1178
|
}),
|
|
1218
|
-
|
|
1179
|
+
no: define('i64', {
|
|
1219
1180
|
nullable: false,
|
|
1220
|
-
primary:
|
|
1181
|
+
primary: 2
|
|
1221
1182
|
})
|
|
1222
1183
|
});
|
|
1223
1184
|
const tableMigrationsMigrator = new TableCreator(TableMigration);
|
|
@@ -1522,14 +1483,5 @@ function sqlite3(...list) {
|
|
|
1522
1483
|
function table(table) {
|
|
1523
1484
|
return new TableCreator(table);
|
|
1524
1485
|
}
|
|
1525
|
-
/**
|
|
1526
|
-
*
|
|
1527
|
-
* @param {string} ta
|
|
1528
|
-
* @param {string} tb
|
|
1529
|
-
* @returns
|
|
1530
|
-
*/
|
|
1531
|
-
function joinTable(ta, tb) {
|
|
1532
|
-
return new TableCreator(`${ta}_${tb}`).id(`${ta}_id`).id(`${tb}_id`);
|
|
1533
|
-
}
|
|
1534
1486
|
|
|
1535
|
-
export { auto, createEcho, customize, down, create as exec,
|
|
1487
|
+
export { auto, createEcho, customize, down, create as exec, mysql, postgres, revert, sqlite, sqlite3, table, type, up };
|