fix(database): constraints default to false (#550)
* fix(database): constraints default to false * test(plugin-workflow): skip schedule cases Co-authored-by: mytharcher <mytharcher@gmail.com>
This commit is contained in:
parent
017c6f232d
commit
d3b157075e
@ -28,6 +28,7 @@ export class BelongsToField extends RelationField {
|
||||
// define relation on sequelize model
|
||||
const association = collection.model.belongsTo(Target, {
|
||||
as: this.name,
|
||||
constraints: false,
|
||||
...omit(this.options, ['name', 'type', 'target']),
|
||||
});
|
||||
|
||||
|
@ -37,6 +37,7 @@ export class BelongsToManyField extends RelationField {
|
||||
}
|
||||
|
||||
const association = collection.model.belongsToMany(Target, {
|
||||
constraints: false,
|
||||
...omit(this.options, ['name', 'type', 'target']),
|
||||
as: this.name,
|
||||
through: Through.model,
|
||||
|
@ -5,10 +5,10 @@ import {
|
||||
ForeignKeyOptions,
|
||||
HasManyOptions,
|
||||
HasManyOptions as SequelizeHasManyOptions,
|
||||
Utils,
|
||||
Utils
|
||||
} from 'sequelize';
|
||||
|
||||
import { BaseRelationFieldOptions, MultipleRelationFieldOptions, RelationField } from './relation-field';
|
||||
import { MultipleRelationFieldOptions, RelationField } from './relation-field';
|
||||
|
||||
export interface HasManyFieldOptions extends HasManyOptions {
|
||||
/**
|
||||
@ -93,9 +93,10 @@ export class HasManyField extends RelationField {
|
||||
}
|
||||
|
||||
const association = collection.model.hasMany(Target, {
|
||||
constraints: false,
|
||||
...omit(this.options, ['name', 'type', 'target']),
|
||||
as: this.name,
|
||||
foreignKey: this.foreignKey,
|
||||
...omit(this.options, ['name', 'type', 'target']),
|
||||
});
|
||||
|
||||
// inverse relation
|
||||
|
@ -92,9 +92,10 @@ export class HasOneField extends RelationField {
|
||||
return false;
|
||||
}
|
||||
const association = collection.model.hasOne(Target, {
|
||||
constraints: false,
|
||||
...omit(this.options, ['name', 'type', 'target']),
|
||||
as: this.name,
|
||||
foreignKey: this.foreignKey,
|
||||
...omit(this.options, ['name', 'type', 'target']),
|
||||
});
|
||||
// 建立关系之后从 pending 列表中删除
|
||||
database.removePendingField(this);
|
||||
|
Loading…
Reference in New Issue
Block a user