Hello @arnaud,
These are the models:
Process_outlines
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
// This section contains the fields of your model, mapped to your table's columns.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const ProcessOutlines = sequelize.define('processOutlines', {
createdAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
deletedAt: {
type: DataTypes.DATE,
},
name: {
type: DataTypes.STRING,
},
status: {
type: DataTypes.STRING,
},
description: {
type: DataTypes.STRING,
},
}, {
tableName: 'process_outlines',
underscored: true,
schema: process.env.DATABASE_SCHEMA,
});
// This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
ProcessOutlines.associate = (models) => {
ProcessOutlines.belongsTo(models.initiativeOutlines, {
foreignKey: {
name: 'initiativeOutlineIdKey',
field: 'initiative_outline_id',
},
as: 'initiativeOutline',
});
// NB:BK, Being someone's PreRequisite doesn't make this process a PostRequisite,
// but we'll use this term for lack of a better word.
ProcessOutlines.belongsToMany(models.processOutlines, {
through: 'preRequisiteProcessOutlines',
foreignKey: 'pre_requisite_process_outline_id',
otherKey: 'process_outline_id',
as: 'PostRequisiteProcessOutlines',
});
ProcessOutlines.belongsToMany(models.processOutlines, {
through: 'preRequisiteProcessOutlines',
foreignKey: 'process_outline_id',
otherKey: 'pre_requisite_process_outline_id',
as: 'PreRequisiteProcessOutlines',
});
ProcessOutlines.belongsToMany(models.taskOutlines, {
through: 'processOutlinesChildTaskOutlines',
foreignKey: 'process_outline_id',
otherKey: 'child_task_outline_id',
});
ProcessOutlines.belongsToMany(models.taskOutlines, {
through: 'processOutlinesParentTaskOutlines',
foreignKey: 'process_outline_id',
otherKey: 'parent_task_outline_id',
});
ProcessOutlines.hasMany(models.processData, {
foreignKey: {
name: 'processOutlineIdKey',
field: 'process_outline_id',
},
as: 'processOutlineProcessData',
});
};
return ProcessOutlines;
};
Task_outlines
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
// This section contains the fields of your model, mapped to your table's columns.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const TaskOutlines = sequelize.define('taskOutlines', {
createdAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
},
deletedAt: {
type: DataTypes.DATE,
},
name: {
type: DataTypes.STRING,
},
description: {
type: DataTypes.STRING,
},
status: {
type: DataTypes.STRING,
},
type: {
type: DataTypes.STRING,
},
ownerType: {
type: DataTypes.STRING,
},
timing: {
type: DataTypes.STRING,
},
parameterDisplayNames: {
type: DataTypes.STRING,
},
}, {
tableName: 'task_outlines',
underscored: true,
schema: process.env.DATABASE_SCHEMA,
});
// This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
TaskOutlines.associate = (models) => {
TaskOutlines.belongsTo(models.initiativeOutlines, {
foreignKey: {
name: 'initiativeOutlineIdKey',
field: 'initiative_outline_id',
},
as: 'initiativeOutline',
});
TaskOutlines.belongsToMany(models.processOutlines, {
through: 'processOutlinesChildTaskOutlines',
foreignKey: 'child_task_outline_id',
otherKey: 'process_outline_id',
});
TaskOutlines.belongsToMany(models.processOutlines, {
through: 'processOutlinesParentTaskOutlines',
foreignKey: 'parent_task_outline_id',
otherKey: 'process_outline_id',
});
TaskOutlines.belongsToMany(models.parameterOutlines, {
through: 'taskOutlinesParameterOutlines',
foreignKey: 'task_outline_id',
otherKey: 'parameter_outline_id',
});
TaskOutlines.belongsToMany(models.documentOutlines, {
through: 'taskOutlinesDocumentOutlines',
foreignKey: 'task_outline_id',
otherKey: 'document_outline_id',
});
// NB:BK, Being someone's PreRequisite doesn't make this task a PostRequisite,
// but we'll use this term for lack of a better word.
TaskOutlines.belongsToMany(models.taskOutlines, {
through: 'preRequisiteTaskOutlines',
foreignKey: 'pre_requisite_task_outline_id',
otherKey: 'task_outline_id',
as: 'PostRequisiteTaskOutlines',
});
TaskOutlines.belongsToMany(models.taskOutlines, {
through: 'preRequisiteTaskOutlines',
foreignKey: 'task_outline_id',
otherKey: 'pre_requisite_task_outline_id',
as: 'PreRequisiteTaskOutlines',
});
TaskOutlines.hasMany(models.taskData, {
foreignKey: {
name: 'taskOutlineIdKey',
field: 'task_outline_id',
},
as: 'taskOutlineTaskData',
});
};
return TaskOutlines;
};
Process_outlines_Child_task_outlines
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
// This section contains the fields of your model, mapped to your table's columns.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const ProcessOutlinesChildTaskOutlines = sequelize.define('processOutlinesChildTaskOutlines', {
processOutlineId: {
type: DataTypes.INTEGER,
primaryKey: true,
},
childTaskOutlineId: {
type: DataTypes.INTEGER,
primaryKey: true,
},
}, {
tableName: 'process_outlines_child_task_outlines',
underscored: true,
timestamps: false,
schema: process.env.DATABASE_SCHEMA,
});
// This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
ProcessOutlinesChildTaskOutlines.associate = (models) => {
ProcessOutlinesChildTaskOutlines.belongsTo(models.taskOutlines, {
foreignKey: {
name: 'childTaskOutlineIdKey',
field: 'child_task_outline_id',
},
as: 'childTaskOutline',
});
ProcessOutlinesChildTaskOutlines.belongsTo(models.processOutlines, {
foreignKey: {
name: 'processOutlineIdKey',
field: 'process_outline_id',
},
as: 'processOutline',
});
};
return ProcessOutlinesChildTaskOutlines;
};
Process_outlines_Parent_task_outlines
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
// This section contains the fields of your model, mapped to your table's columns.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const ProcessOutlinesParentTaskOutlines = sequelize.define('processOutlinesParentTaskOutlines', {
processOutlineId: {
type: DataTypes.INTEGER,
primaryKey: true,
},
parentTaskOutlineId: {
type: DataTypes.INTEGER,
primaryKey: true,
},
}, {
tableName: 'process_outlines_parent_task_outlines',
underscored: true,
timestamps: false,
schema: process.env.DATABASE_SCHEMA,
});
// This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
ProcessOutlinesParentTaskOutlines.associate = (models) => {
ProcessOutlinesParentTaskOutlines.belongsTo(models.taskOutlines, {
foreignKey: {
name: 'parentTaskOutlineIdKey',
field: 'parent_task_outline_id',
},
as: 'parentTaskOutline',
});
ProcessOutlinesParentTaskOutlines.belongsTo(models.processOutlines, {
foreignKey: {
name: 'processOutlineIdKey',
field: 'process_outline_id',
},
as: 'processOutline',
});
};
return ProcessOutlinesParentTaskOutlines;
};
I hope this helps.
thanks