feat: Anpassung der Datenbankmodelle zur Unterstützung von snake_case und Einführung von freezeTableName

- Aktualisierung der Modelle in verschiedenen Bereichen, um die Feldnamen im snake_case-Format zu verwenden.
- Hinzufügen der Option freezeTableName zu den Modellen, um die Tabellennamen in der Datenbank unverändert zu lassen.
- Verbesserung der Konsistenz und Lesbarkeit des Codes durch einheitliche Namenskonventionen.
This commit is contained in:
Torsten Schulz (local)
2025-08-23 06:04:23 +02:00
parent e168adeb51
commit 66818cc728
114 changed files with 548 additions and 380 deletions

View File

@@ -4,15 +4,15 @@ import { sequelize } from '../../../utils/sequelize.js';
class Branch extends Model { }
Branch.init({
branchTypeId: {
branch_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
falukantUserId: {
falukant_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -27,7 +27,8 @@ Branch.init({
{
unique: true,
fields: ['region_id', 'falukant_user_id']
}
,
freezeTableName: true}
],
});

View File

@@ -4,27 +4,27 @@ import { sequelize } from '../../../utils/sequelize.js';
class BuyableHouse extends Model { }
BuyableHouse.init({
roofCondition: {
roof_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
floorCondition: {
floor_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
wallCondition: {
wall_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
windowCondition: {
window_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
houseTypeId: {
house_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
}
@@ -35,6 +35,7 @@ BuyableHouse.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default BuyableHouse;

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class BuyableStock extends Model { }
BuyableStock.init({
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
stockTypeId: {
stock_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -23,6 +23,7 @@ BuyableStock.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default BuyableStock;

View File

@@ -25,6 +25,7 @@ Candidate.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Candidate;

View File

@@ -5,19 +5,19 @@ class FalukantCharacter extends Model {}
FalukantCharacter.init(
{
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: true,
},
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
firstName: {
first_name: {
type: DataTypes.INTEGER,
allowNull: false,
},
lastName: {
last_name: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -34,11 +34,11 @@ FalukantCharacter.init(
allowNull: false,
defaultValue: 100,
},
titleOfNobility: {
title_of_nobility: {
type: DataTypes.INTEGER,
allowNull: false,
},
moodId: {
mood_id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
@@ -51,7 +51,8 @@ FalukantCharacter.init(
schema: 'falukant_data',
timestamps: true,
underscored: true,
}
,
freezeTableName: true}
);
export default FalukantCharacter;

View File

@@ -5,32 +5,32 @@ class ChildRelation extends Model {}
ChildRelation.init(
{
fatherCharacterId: {
father_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
motherCharacterId: {
mother_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
childCharacterId: {
child_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
fatherName: {
father_name: {
type: DataTypes.STRING,
allowNull: false,
},
motherName: {
mother_name: {
type: DataTypes.STRING,
allowNull: false,
},
nameSet: {
name_set: {
type: DataTypes.BOOLEAN,
allowNull: false,
default: false,
},
isHeir: {
is_heir: {
type: DataTypes.BOOLEAN,
allowNull: true,
default: false,

View File

@@ -11,17 +11,17 @@ Credit.init({
allowNull: false,
},
// noch offener Kreditbetrag
remainingAmount: {
remaining_amount: {
type: DataTypes.DECIMAL(14,2),
allowNull: false,
},
// Zinssatz als Prozentsatz (z.B. 3.5 für 3.5%)
interestRate: {
interest_rate: {
type: DataTypes.DECIMAL(5,2),
allowNull: false,
},
// Verknüpfung auf FalukantUser
falukantUserId: {
falukant_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -32,6 +32,7 @@ Credit.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Credit;

View File

@@ -5,7 +5,7 @@ class DebtorsPrism extends Model {}
DebtorsPrism.init({
// Verknüpfung auf FalukantCharacter
characterId: {
character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -16,6 +16,7 @@ DebtorsPrism.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default DebtorsPrism;

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class Director extends Model { }
Director.init({
directorCharacterId: {
director_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
employerUserId: {
employer_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -21,22 +21,22 @@ Director.init({
allowNull: false,
defaultValue: 100,
},
mayProduce: {
may_produce: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
maySell: {
may_sell: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
mayStartTransport: {
may_start_transport: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
lastSalaryPayout: {
last_salary_payout: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: new Date(0)
@@ -48,6 +48,7 @@ Director.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default Director;

View File

@@ -4,15 +4,15 @@ import { sequelize } from '../../../utils/sequelize.js';
class DirectorProposal extends Model { }
DirectorProposal.init({
directorCharacterId: {
director_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
employerUserId: {
employer_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
proposedIncome: {
proposed_income: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -23,6 +23,7 @@ DirectorProposal.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default DirectorProposal;

View File

@@ -10,11 +10,11 @@ Election.init({
primaryKey: true,
autoIncrement: true,
},
officeTypeId: {
office_type_id: {
type: DataTypes.INTEGER,
allowNull: true,
},
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false
},
@@ -22,7 +22,7 @@ Election.init({
type: DataTypes.DATE,
allowNull: false,
},
postsToFill: {
posts_to_fill: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -33,6 +33,7 @@ Election.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Election;

View File

@@ -29,6 +29,7 @@ ElectionResult.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default ElectionResult;

View File

@@ -21,7 +21,8 @@ FalukantCharacterTrait.init(
schema: 'falukant_data',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default FalukantCharacterTrait;

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class Inventory extends Model { }
Inventory.init({
stockId: {
stock_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
product_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -20,7 +20,7 @@ Inventory.init({
type: DataTypes.INTEGER,
allowNull: false,
},
producedAt: {
produced_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
@@ -32,6 +32,7 @@ Inventory.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default Inventory;

View File

@@ -5,31 +5,31 @@ class Learning extends Model {}
Learning.init(
{
learningRecipientId: {
learning_recipient_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
product_id: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learnAllProducts: {
learn_all_products: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
associatedFalukantUserId: {
associated_falukant_user_id: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
associatedLearningCharacterId: {
associated_learning_character_id: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learningIsExecuted: {
learning_is_executed: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
@@ -42,7 +42,8 @@ Learning.init(
schema: 'falukant_data',
timestamps: true,
underscored: true,
}
,
freezeTableName: true}
);
export default Learning;

View File

@@ -5,12 +5,12 @@ class MarriageProposal extends Model {}
MarriageProposal.init(
{
requesterCharacterId: {
requester_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
proposedCharacterId: {
proposed_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
@@ -28,7 +28,8 @@ MarriageProposal.init(
schema: 'falukant_data',
timestamps: true,
underscored: true,
}
,
freezeTableName: true}
);
export default MarriageProposal;

View File

@@ -25,6 +25,7 @@ OccupiedPoliticalOffice.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default OccupiedPoliticalOffice;

View File

@@ -4,27 +4,27 @@ import { sequelize } from '../../../utils/sequelize.js';
class Party extends Model {}
Party.init({
partyTypeId: {
party_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'party_type_id'
},
falukantUserId: {
falukant_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'falukant_user_id'
},
musicTypeId: {
music_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'music_type'
},
banquetteTypeId: {
banquette_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'banquette_type'
},
servantRatio: {
servant_ratio: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'servant_ratio'
@@ -41,6 +41,7 @@ Party.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Party;

View File

@@ -4,12 +4,12 @@ import { sequelize } from '../../../utils/sequelize.js'
class PartyInvitedNobility extends Model {}
PartyInvitedNobility.init({
partyId: {
party_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'party_id'
},
titleOfNobilityId: {
title_of_nobility_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'title_of_nobility_id'
@@ -21,6 +21,7 @@ PartyInvitedNobility.init({
schema: 'falukant_data',
timestamps: false,
underscored: true
})
,
freezeTableName: true})
export default PartyInvitedNobility

View File

@@ -10,15 +10,15 @@ PoliticalOffice.init({
primaryKey: true,
autoIncrement: true,
},
officeTypeId: {
office_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
characterId: {
character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -29,6 +29,7 @@ PoliticalOffice.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default PoliticalOffice;

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class Knowledge extends Model { }
Knowledge.init({
productId: {
product_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
characterId: {
character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -27,7 +27,8 @@ Knowledge.init({
hooks: {
beforeCreate: (knowledge) => {
knowledge.knowledge = Math.floor(Math.random() * 61) + 20;
}
,
freezeTableName: true}
}
});

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class Production extends Model { }
Production.init({
branchId: {
branch_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
product_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -16,7 +16,7 @@ Production.init({
type: DataTypes.INTEGER,
allowNull: false,
},
startTimestamp: {
start_timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
@@ -28,6 +28,7 @@ Production.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default Production;

View File

@@ -9,7 +9,7 @@ RegionData.init({
type: DataTypes.STRING,
allowNull: false,
},
regionTypeId: {
region_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -18,7 +18,7 @@ RegionData.init({
schema: 'falukant_type'
}
},
parentId: {
parent_id: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -39,6 +39,7 @@ RegionData.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default RegionData;

View File

@@ -24,7 +24,7 @@ Relationship.init(
},
onDelete: 'CASCADE',
},
relationshipTypeId: {
relationship_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
@@ -37,7 +37,7 @@ Relationship.init(
type: DataTypes.STRING,
allowNull: true,
},
nextStepProgress: {
next_step_progress: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0,
@@ -50,7 +50,8 @@ Relationship.init(
schema: 'falukant_data',
timestamps: true,
underscored: true,
}
,
freezeTableName: true}
);
export default Relationship;

View File

@@ -4,12 +4,12 @@ import { sequelize } from '../../../utils/sequelize.js';
class FalukantStock extends Model { }
FalukantStock.init({
branchId: {
branch_id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
stockTypeId: {
stock_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -24,6 +24,7 @@ FalukantStock.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default FalukantStock;

View File

@@ -4,15 +4,15 @@ import { sequelize } from '../../../utils/sequelize.js';
class TownProductWorth extends Model { }
TownProductWorth.init({
productId: {
product_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
worthPercent: {
worth_percent: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
@@ -27,7 +27,8 @@ TownProductWorth.init({
hooks: {
beforeCreate: (worthPercent) => {
worthPercent.worthPercent = Math.floor(Math.random() * 20) + 40;
}
,
freezeTableName: true}
}
});

View File

@@ -4,15 +4,15 @@ import { sequelize } from '../../../utils/sequelize.js';
class Underground extends Model { }
Underground.init({
undergroundTypeId: {
underground_type_id: {
type: DataTypes.STRING,
allowNull: false,
},
performerId: {
performer_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
victimId: {
victim_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -31,6 +31,7 @@ Underground.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Underground;

View File

@@ -5,7 +5,7 @@ import RegionData from './region.js';
class FalukantUser extends Model { }
FalukantUser.init({
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -22,17 +22,17 @@ FalukantUser.init({
allowNull: false,
defaultValue: 0.00,
},
creditAmount: {
credit_amount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
todayCreditTaken: {
today_credit_taken: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
creditInterestRate: {
credit_interest_rate: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false,
defaultValue: 0.00,
@@ -42,7 +42,7 @@ FalukantUser.init({
allowNull: false,
defaultValue: 1,
},
mainBranchRegionId: {
main_branch_region_id: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -58,6 +58,7 @@ FalukantUser.init({
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default FalukantUser;

View File

@@ -4,32 +4,32 @@ import { sequelize } from '../../../utils/sequelize.js';
class UserHouse extends Model { }
UserHouse.init({
roofCondition: {
roof_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
floorCondition: {
floor_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
wallCondition: {
wall_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
windowCondition: {
window_condition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
houseTypeId: {
house_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
},
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
@@ -41,6 +41,7 @@ UserHouse.init({
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default UserHouse;

View File

@@ -11,11 +11,11 @@ Vote.init(
primaryKey: true,
autoIncrement: true,
},
electionId: {
election_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidateId: {
candidate_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -24,7 +24,7 @@ Vote.init(
allowNull: false,
defaultValue: DataTypes.NOW,
},
falukantUserId: {
falukant_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -40,7 +40,8 @@ Vote.init(
{
unique: true,
fields: ['election_id', 'candidate_id'],
},
,
freezeTableName: true},
],
}
);

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class DayProduction extends Model { }
DayProduction.init({
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
product_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -16,16 +16,16 @@ DayProduction.init({
type: DataTypes.INTEGER,
allowNull: false,
},
producerId: {
producer_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
productionTimestamp: {
production_timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
},
productionDate: {
production_date: {
type: DataTypes.DATEONLY,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_DATE'),
@@ -41,7 +41,8 @@ DayProduction.init({
{
unique: true,
fields: ['producer_id', 'product_id', 'region_id', 'production_date']
}
,
freezeTableName: true}
]
});

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class DaySell extends Model { }
DaySell.init({
regionId: {
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
product_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -16,11 +16,11 @@ DaySell.init({
type: DataTypes.INTEGER,
allowNull: false,
},
sellerId: {
seller_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
sellTimestamp: {
sell_timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
@@ -36,7 +36,8 @@ DaySell.init({
{
unique: true,
fields: ['seller_id', 'product_id', 'region_id']
}
,
freezeTableName: true}
]
});

View File

@@ -4,19 +4,19 @@ import { sequelize } from '../../../utils/sequelize.js';
class ElectionHistory extends Model { }
ElectionHistory.init({
electionId: {
election_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
politicalOfficeTypeId: {
political_office_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
electionDate: {
election_date: {
type: DataTypes.DATE,
allowNull: false,
},
electionResult: {
election_result: {
type: DataTypes.JSON,
allowNull: false,
}
@@ -27,6 +27,7 @@ ElectionHistory.init({
schema: 'falukant_log',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default ElectionHistory;

View File

@@ -9,11 +9,11 @@ HealthActivity.init({
primaryKey: true,
autoIncrement: true,
},
characterId: {
character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
activityTr: {
activity_tr: {
type: DataTypes.STRING,
allowNull: false,
},
@@ -21,7 +21,7 @@ HealthActivity.init({
type: DataTypes.FLOAT,
allowNull: false,
},
successPercentage: {
success_percentage: {
type: DataTypes.INTEGER,
allowNull: false
}
@@ -32,6 +32,7 @@ HealthActivity.init({
schema: 'falukant_log',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default HealthActivity;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../../utils/sequelize.js';
class MoneyFlow extends Model { }
MoneyFlow.init({
falukantUserId: {
falukant_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -12,11 +12,11 @@ MoneyFlow.init({
type: DataTypes.STRING,
allowNull: false,
},
moneyBefore: {
money_before: {
type: DataTypes.DOUBLE,
allowNull: false,
},
moneyAfter: {
money_after: {
type: DataTypes.DOUBLE,
allowNull: true,
},
@@ -25,11 +25,11 @@ MoneyFlow.init({
allowNull: false,
defaultValue: DataTypes.NOW
},
changeValue: {
change_value: {
type: DataTypes.DOUBLE,
allowNull: false,
},
changedBy: {
changed_by: {
type: DataTypes.INTEGER,
allowNull: true,
},
@@ -40,6 +40,7 @@ MoneyFlow.init({
schema: 'falukant_log',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default MoneyFlow;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../../utils/sequelize.js';
class Notification extends Model { }
Notification.init({
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -24,6 +24,7 @@ Notification.init({
schema: 'falukant_log',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Notification;

View File

@@ -5,19 +5,19 @@ class PoliticalOfficeHistory extends Model { }
PoliticalOfficeHistory.init(
{
characterId: {
character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
officeTypeId: {
office_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
startDate: {
start_date: {
type: DataTypes.DATE,
allowNull: false,
},
endDate: {
end_date: {
type: DataTypes.DATE,
allowNull: false,
}
@@ -29,7 +29,8 @@ PoliticalOfficeHistory.init(
schema: 'falukant_log',
timestamps: true,
underscored: true,
}
,
freezeTableName: true}
);
export default PoliticalOfficeHistory;

View File

@@ -4,19 +4,19 @@ import { sequelize } from '../../../utils/sequelize.js';
class PromotionalGiftLog extends Model { };
PromotionalGiftLog.init({
senderCharacterId: {
sender_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
recipientCharacterId: {
recipient_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
giftId: {
gift_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
changeValue: {
change_value: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -27,6 +27,7 @@ PromotionalGiftLog.init({
schema: 'falukant_log',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default PromotionalGiftLog;

View File

@@ -19,7 +19,8 @@ const FalukantPredefineFirstname = sequelize.define('firstname', {
{
unique: true,
fields: ['name', 'gender']
}
,
freezeTableName: true}
],
});

View File

@@ -16,7 +16,8 @@ const FalukantPredefineLastname = sequelize.define('lastname', {
{
unique: true,
fields: ['name']
}
,
freezeTableName: true}
],
});

View File

@@ -30,7 +30,8 @@ PoliticalOfficeBenefit.init({
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
// Association
PoliticalOfficeBenefit.belongsTo(PoliticalOfficeBenefitType, {

View File

@@ -29,6 +29,7 @@ PoliticalOfficePrerequisite.init({
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default PoliticalOfficePrerequisite;

View File

@@ -39,7 +39,8 @@ PromotionalGiftCharacterTrait.init(
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default PromotionalGiftCharacterTrait;

View File

@@ -39,7 +39,8 @@ PromotionalGiftMood.init(
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default PromotionalGiftMood;

View File

@@ -13,7 +13,7 @@ BanquetteType.init(
type: DataTypes.INTEGER,
allowNull: false,
},
reputationGrowth: {
reputation_growth: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -25,7 +25,8 @@ BanquetteType.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default BanquetteType;

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class BranchType extends Model { }
BranchType.init({
labelTr: {
label_tr: {
type: DataTypes.STRING,
allowNull: false,
},
baseCost: {
base_cost: {
type: DataTypes.INTEGER,
allowNull: false,
}
@@ -23,7 +23,8 @@ BranchType.init({
{
unique: true,
fields: ['label_tr']
}
,
freezeTableName: true}
],
});

View File

@@ -17,7 +17,8 @@ CharacterTrait.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default CharacterTrait;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../../utils/sequelize.js';
class HouseType extends Model { }
HouseType.init({
labelTr: {
label_tr: {
type: DataTypes.STRING,
allowNull: false,
},
@@ -16,7 +16,7 @@ HouseType.init({
type: DataTypes.INTEGER,
allowNull: false,
},
minimumNobleTitle: {
minimum_noble_title: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -31,7 +31,8 @@ HouseType.init({
{
unique: true,
fields: ['label_tr']
}
,
freezeTableName: true}
],
});

View File

@@ -17,7 +17,8 @@ LearnRecipient.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default LearnRecipient;

View File

@@ -17,7 +17,8 @@ Mood.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default Mood;

View File

@@ -13,7 +13,7 @@ MusicType.init(
type: DataTypes.INTEGER,
allowNull: false,
},
reputationGrowth: {
reputation_growth: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -25,7 +25,8 @@ MusicType.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default MusicType;

View File

@@ -13,12 +13,12 @@ PartyType.init(
type: DataTypes.INTEGER,
allowNull: false,
},
forMarriage: {
for_marriage: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
reputationGrowth: {
reputation_growth: {
type: DataTypes.INTEGER,
allowNull: false,
}
@@ -30,7 +30,8 @@ PartyType.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default PartyType;

View File

@@ -21,6 +21,7 @@ PoliticalOfficeBenefitType.init({
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default PoliticalOfficeBenefitType;

View File

@@ -13,15 +13,15 @@ PoliticalOfficeType.init({
type: DataTypes.STRING,
allowNull: false,
},
seatsPerRegion: {
seats_per_region: {
type: DataTypes.INTEGER,
allowNull: false,
},
regionType: {
region_type: {
type: DataTypes.STRING,
allowNull: false,
},
termLength: {
term_length: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
@@ -33,6 +33,7 @@ PoliticalOfficeType.init({
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default PoliticalOfficeType;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../../utils/sequelize.js';
class ProductType extends Model { }
ProductType.init({
labelTr: {
label_tr: {
type: DataTypes.STRING,
allowNull: false,
},
@@ -12,11 +12,11 @@ ProductType.init({
type: DataTypes.INTEGER,
allowNull: false,
},
productionTime: {
production_time: {
type: DataTypes.INTEGER,
allowNull: false,
},
sellCost: {
sell_cost: {
type: DataTypes.INTEGER,
allowNull: false,
}
@@ -31,7 +31,8 @@ ProductType.init({
{
unique: true,
fields: ['label_tr']
}
,
freezeTableName: true}
],
});

View File

@@ -26,7 +26,8 @@ PromotionalGift.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default PromotionalGift;

View File

@@ -4,11 +4,11 @@ import { sequelize } from '../../../utils/sequelize.js';
class RegionType extends Model { }
RegionType.init({
labelTr: {
label_tr: {
type: DataTypes.STRING,
allowNull: false,
},
parentId: {
parent_id: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -24,6 +24,7 @@ RegionType.init({
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default RegionType;

View File

@@ -17,7 +17,8 @@ RelationshipType.init(
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
,
freezeTableName: true}
);
export default RelationshipType;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../../utils/sequelize.js';
class FalukantStockType extends Model { }
FalukantStockType.init({
labelTr: {
label_tr: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
@@ -20,6 +20,7 @@ FalukantStockType.init({
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default FalukantStockType;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../../utils/sequelize.js';
class TitleOfNobility extends Model { }
TitleOfNobility.init({
labelTr: {
label_tr: {
type: DataTypes.STRING,
allowNull: false,
},
@@ -20,6 +20,7 @@ TitleOfNobility.init({
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default TitleOfNobility;

View File

@@ -10,15 +10,15 @@ TitleRequirement.init({
primaryKey: true,
autoIncrement: true,
},
titleId: {
title_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
requirementType: {
requirement_type: {
type: DataTypes.STRING,
allowNull: false,
},
requirementValue: {
requirement_value: {
type: DataTypes.DECIMAL(14, 2),
allowNull: false,
},
@@ -34,7 +34,8 @@ TitleRequirement.init({
unique: true,
fields: ['title_id', 'requirement_type'],
name: 'title_requirement_titleid_reqtype_unique'
}
,
freezeTableName: true}
]
});

View File

@@ -20,6 +20,7 @@ UndergroundType.init({
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default UndergroundType;