pangea-server 3.3.103 → 3.3.105
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.
|
@@ -14,9 +14,10 @@ declare global {
|
|
|
14
14
|
type ColComputed<T> = CreationOptional<T>;
|
|
15
15
|
type ModelInstance<BM extends BaseModel> = InferAttributes<BM> & {
|
|
16
16
|
id: ModelId;
|
|
17
|
+
init?: () => void;
|
|
17
18
|
};
|
|
18
19
|
type Where<BM extends BaseModel> = WhereOptions<BM> & Record<symbol, any>;
|
|
19
|
-
type InsertParams<BM extends BaseModel> = OptionalIfNullish<IncludeHidden<StripRelations<Omit<InferCreationAttributes<BM>, 'id'>>>> & {
|
|
20
|
+
type InsertParams<BM extends BaseModel> = OptionalIfNullish<IncludeHidden<StripRelations<Omit<InferCreationAttributes<BM>, 'id' | 'init'>>>> & {
|
|
20
21
|
id?: ModelId;
|
|
21
22
|
};
|
|
22
23
|
type UpdateParams<BM extends BaseModel> = Partial<InsertParams<BM>>;
|
|
@@ -21,7 +21,7 @@ export declare abstract class BaseModel extends Model {
|
|
|
21
21
|
private static __Relations?;
|
|
22
22
|
id: ModelId;
|
|
23
23
|
version: NonAttribute<number>;
|
|
24
|
-
init?:
|
|
24
|
+
init?: () => void;
|
|
25
25
|
static get HiddenAttributes(): string[];
|
|
26
26
|
static get Columns(): Columns;
|
|
27
27
|
static get ColumnIndexes(): Index[];
|
|
@@ -34,7 +34,7 @@ async function seedTables(models, seeds) {
|
|
|
34
34
|
const db = new db_class_1.Db(tx);
|
|
35
35
|
try {
|
|
36
36
|
await db.disableForeignKeyChecks();
|
|
37
|
-
await Promise.all(modelsWithData.map((modelName) => db.insertMany(models[modelName], [])));
|
|
37
|
+
await Promise.all(modelsWithData.map((modelName) => db.insertMany(models[modelName], seeds[modelName])));
|
|
38
38
|
await db.enableForeignKeyChecks();
|
|
39
39
|
await tx.commit();
|
|
40
40
|
}
|