Refactor user_house model to remove default values for houseTypeId and userId fields, and enhance syncDatabase function to include cleanup for orphaned user_house entries with invalid house_type_id or user_id references, improving data integrity and logging.

This commit is contained in:
Torsten Schulz (local)
2025-12-18 15:57:39 +01:00
parent 346a326bfd
commit e13a711a60
2 changed files with 32 additions and 6 deletions

View File

@@ -26,13 +26,11 @@ UserHouse.init({
},
houseTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
allowNull: false
},
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
allowNull: false
}
}, {
sequelize,