- Backend: add accuracy field (ENUM: EXACT, ESTIMATED, UNKNOWN) to EntrySeen and EpisodeSeen models - Backend: add migration in dataInitializer to add accuracy column, set existing to EXACT, set 2021-01-01 entry seens and 2020-01-01 episode seens to UNKNOWN
34 lines
723 B
JavaScript
34 lines
723 B
JavaScript
const { DataTypes } = require('sequelize');
|
|
const sequelize = require('../config/database');
|
|
|
|
|
|
const EpisodeSeen = sequelize.define("episodeSeen",
|
|
{
|
|
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
|
|
entry_id: {
|
|
type: DataTypes.INTEGER,
|
|
references: {
|
|
model: 'Entries',
|
|
key: 'id'
|
|
}
|
|
},
|
|
episode_id: {
|
|
type: DataTypes.INTEGER,
|
|
references: {
|
|
model: 'Episodes',
|
|
key: 'id'
|
|
}
|
|
},
|
|
|
|
date_seen: { type: DataTypes.DATE },
|
|
seen_with: { type: DataTypes.STRING(50) },
|
|
accuracy: {
|
|
type: DataTypes.ENUM('EXACT', 'ESTIMATED', 'UNKNOWN'),
|
|
defaultValue: 'EXACT',
|
|
},
|
|
|
|
}
|
|
);
|
|
|
|
module.exports = EpisodeSeen; |