Back: reworked the media/entry relation
This commit is contained in:
1 parent
d06a21097f
commit
b42e055691
5 files changed
+41
-30
No files matched your search
+12
-9
@@ -1,18 +1,21 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { DataTypes, Sequelize } = require('sequelize');
|
||||
const sequelize = require('../db/database');
|
||||
|
||||
const Media = sequelize.define("media",
|
||||
{
|
||||
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
||||
|
||||
entryId: {
|
||||
type: DataTypes.INTEGER,
|
||||
references: {
|
||||
model: 'Entries',
|
||||
key: 'id'
|
||||
},
|
||||
field: 'entry_id'
|
||||
},
|
||||
// entryId: {
|
||||
// type: DataTypes.INTEGER,
|
||||
// references: {
|
||||
// model: 'Entries',
|
||||
// key: 'id'
|
||||
// },
|
||||
// field: 'entry_id'
|
||||
// },
|
||||
|
||||
mediaable: { type: Sequelize.STRING },
|
||||
mediaableId: { type: Sequelize.INTEGER, field: 'mediaable_id' },
|
||||
|
||||
type: { type: DataTypes.STRING(50) },
|
||||
path: { type: DataTypes.STRING(200) },
|
||||
|
||||
Reference in new issue
Block a user