Add RelationshipChangeLog model and enhance character loading logic
This commit is contained in:
49
backend/models/falukant/log/relationship_change_log.js
Normal file
49
backend/models/falukant/log/relationship_change_log.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../../utils/sequelize.js';
|
||||
|
||||
/**
|
||||
* Log aller Änderungen an relationship und marriage_proposals.
|
||||
* Einträge werden ausschließlich durch DB-Trigger geschrieben und nicht gelöscht.
|
||||
* Hilft zu analysieren, warum z.B. Werbungen um einen Partner verschwinden.
|
||||
*/
|
||||
class RelationshipChangeLog extends Model {}
|
||||
|
||||
RelationshipChangeLog.init(
|
||||
{
|
||||
changedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW
|
||||
},
|
||||
tableName: {
|
||||
type: DataTypes.STRING(64),
|
||||
allowNull: false
|
||||
},
|
||||
operation: {
|
||||
type: DataTypes.STRING(16),
|
||||
allowNull: false
|
||||
},
|
||||
recordId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true
|
||||
},
|
||||
payloadOld: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: true
|
||||
},
|
||||
payloadNew: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: true
|
||||
}
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: 'RelationshipChangeLog',
|
||||
tableName: 'relationship_change_log',
|
||||
schema: 'falukant_log',
|
||||
timestamps: false,
|
||||
underscored: true
|
||||
}
|
||||
);
|
||||
|
||||
export default RelationshipChangeLog;
|
||||
@@ -113,6 +113,7 @@ import Vote from './falukant/data/vote.js';
|
||||
import ElectionResult from './falukant/data/election_result.js';
|
||||
import PoliticalOfficeHistory from './falukant/log/political_office_history.js';
|
||||
import ElectionHistory from './falukant/log/election_history.js';
|
||||
import RelationshipChangeLog from './falukant/log/relationship_change_log.js';
|
||||
|
||||
// — Kirchliche Ämter (Church) —
|
||||
import ChurchOfficeType from './falukant/type/church_office_type.js';
|
||||
@@ -248,6 +249,7 @@ const models = {
|
||||
ElectionResult,
|
||||
PoliticalOfficeHistory,
|
||||
ElectionHistory,
|
||||
RelationshipChangeLog,
|
||||
ChurchOfficeType,
|
||||
ChurchOfficeRequirement,
|
||||
ChurchOffice,
|
||||
|
||||
Reference in New Issue
Block a user