forked from Genaker/nodejento
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCatalogProductRelation.js
More file actions
47 lines (47 loc) · 1.04 KB
/
CatalogProductRelation.js
File metadata and controls
47 lines (47 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
return sequelize.define('CatalogProductRelation', {
parent_id: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
primaryKey: true,
comment: "Parent ID",
references: {
model: 'catalog_product_entity',
key: 'entity_id'
}
},
child_id: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
primaryKey: true,
comment: "Child ID",
references: {
model: 'catalog_product_entity',
key: 'entity_id'
}
}
}, {
sequelize,
tableName: 'catalog_product_relation',
timestamps: false,
indexes: [
{
name: "PRIMARY",
unique: true,
using: "BTREE",
fields: [
{ name: "parent_id" },
{ name: "child_id" },
]
},
{
name: "CATALOG_PRODUCT_RELATION_CHILD_ID",
using: "BTREE",
fields: [
{ name: "child_id" },
]
},
]
});
};