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

@@ -17,6 +17,7 @@ const ChatRight = sequelize.define('ChatRight', {
tableName: 'rights',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default ChatRight;

View File

@@ -11,20 +11,20 @@ const Room = sequelize.define('Room', {
type: DataTypes.TEXT,
allowNull: false,
},
ownerId: {
owner_id: {
type: DataTypes.INTEGER,
allowNull: true, // kann null sein, wenn system-owned
},
roomTypeId: {
room_type_id: {
type: DataTypes.INTEGER,
allowNull: true,
},
isPublic: {
is_public: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
genderRestrictionId: {
gender_restriction_id: {
type: DataTypes.INTEGER,
allowNull: true,
},
@@ -32,24 +32,24 @@ const Room = sequelize.define('Room', {
type: DataTypes.STRING,
allowNull: true,
},
minAge: {
min_age: {
type: DataTypes.INTEGER,
allowNull: true,
},
maxAge: {
max_age: {
type: DataTypes.INTEGER,
allowNull: true,
},
passwordHash: {
password_hash: {
type: DataTypes.TEXT,
allowNull: true,
},
friendsOfOwnerOnly: {
friends_of_owner_only: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
requiredUserRightId: {
required_user_right_id: {
type: DataTypes.INTEGER,
allowNull: true,
},
@@ -62,7 +62,8 @@ const Room = sequelize.define('Room', {
{
name: 'idx_chat_room_owner',
fields: ['owner_id'],
},
,
freezeTableName: true},
],
});

View File

@@ -17,6 +17,7 @@ const RoomType = sequelize.define('RoomType', {
tableName: 'room_type',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default RoomType;

View File

@@ -36,6 +36,7 @@ const ChatUser = sequelize.define('ChatUser', {
tableName: 'user',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default ChatUser;

View File

@@ -4,13 +4,13 @@ import ChatUser from './user.js';
import ChatRight from './rights.js';
const ChatUserRight = sequelize.define('ChatUserRight', {
chatUserId: {
chat_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
references: null, // Assoziation wird separat gesetzt
},
chatRightId: {
chat_right_id: {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
@@ -21,6 +21,7 @@ const ChatUserRight = sequelize.define('ChatUserRight', {
tableName: 'user_rights',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default ChatUserRight;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../utils/sequelize.js';
class Blog extends Model {}
Blog.init({
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'user_id'
@@ -23,12 +23,12 @@ Blog.init({
allowNull: false,
defaultValue: 'public',
},
ageMin: {
age_min: {
type: DataTypes.INTEGER,
allowNull: true,
field: 'age_min'
},
ageMax: {
age_max: {
type: DataTypes.INTEGER,
allowNull: true,
field: 'age_max'
@@ -38,12 +38,12 @@ Blog.init({
type: DataTypes.STRING(10),
allowNull: true,
},
createdAt: {
created_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'created_at'
},
updatedAt: {
updated_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'updated_at'
@@ -55,6 +55,7 @@ Blog.init({
schema: 'community',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Blog;

View File

@@ -4,12 +4,12 @@ import { sequelize } from '../../utils/sequelize.js';
class BlogPost extends Model {}
BlogPost.init({
blogId: {
blog_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'blog_id'
},
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'user_id'
@@ -22,12 +22,12 @@ BlogPost.init({
type: DataTypes.TEXT,
allowNull: false,
},
createdAt: {
created_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'created_at'
},
updatedAt: {
updated_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
field: 'updated_at'
@@ -39,6 +39,7 @@ BlogPost.init({
schema: 'community',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default BlogPost;

View File

@@ -4,7 +4,7 @@ import { sequelize } from '../../utils/sequelize.js';
class Diary extends Model { }
Diary.init({
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
@@ -12,11 +12,11 @@ Diary.init({
type: DataTypes.TEXT,
allowNull: false,
},
createdAt: {
created_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
},
updatedAt: {
updated_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
}
@@ -27,6 +27,7 @@ Diary.init({
schema: 'community',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default Diary;

View File

@@ -4,23 +4,23 @@ import { sequelize } from '../../utils/sequelize.js';
class DiaryHistory extends Model { }
DiaryHistory.init({
diaryId: {
diary_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
oldText: {
old_text: {
type: DataTypes.TEXT,
allowNull: false,
},
oldCreatedAt: {
old_created_at: {
type: DataTypes.DATE,
allowNull: false,
},
oldUpdatedAt: {
old_updated_at: {
type: DataTypes.DATE,
allowNull: false,
},
@@ -31,6 +31,7 @@ DiaryHistory.init({
schema: 'community',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default DiaryHistory;

View File

@@ -7,7 +7,7 @@ const Folder = sequelize.define('folder', {
type: DataTypes.STRING,
allowNull: false,
},
parentId: {
parent_id: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -15,7 +15,7 @@ const Folder = sequelize.define('folder', {
key: 'id',
},
},
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -28,6 +28,7 @@ const Folder = sequelize.define('folder', {
schema: 'community',
underscored: true,
timestamps: true,
});
,
freezeTableName: true});
export default Folder;

View File

@@ -8,7 +8,7 @@ const FolderImageVisibility = sequelize.define('folder_image_visibility', {
primaryKey: true,
allowNull: false
},
folderId: {
folder_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const FolderImageVisibility = sequelize.define('folder_image_visibility', {
key: 'id'
}
},
visibilityTypeId: {
visibility_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -32,6 +32,7 @@ const FolderImageVisibility = sequelize.define('folder_image_visibility', {
schema: 'community',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default FolderImageVisibility;

View File

@@ -8,7 +8,7 @@ const FolderVisibilityUser = sequelize.define('folder_visibility_user', {
primaryKey: true,
allowNull: false
},
folderId: {
folder_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const FolderVisibilityUser = sequelize.define('folder_visibility_user', {
key: 'id'
}
},
visibilityUserId: {
visibility_user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -29,6 +29,7 @@ const FolderVisibilityUser = sequelize.define('folder_visibility_user', {
schema: 'community',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default FolderVisibilityUser;

View File

@@ -32,6 +32,7 @@ const Friendship = sequelize.define('friendship', {
schema: 'community',
underscored: true,
timestamps: true,
});
,
freezeTableName: true});
export default Friendship;

View File

@@ -9,7 +9,7 @@ const GuestbookEntry = sequelize.define('guestbook_entry', {
primaryKey: true,
allowNull: false,
},
recipientId: {
recipient_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -17,7 +17,7 @@ const GuestbookEntry = sequelize.define('guestbook_entry', {
key: 'id'
}
},
senderId: {
sender_id: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -25,15 +25,15 @@ const GuestbookEntry = sequelize.define('guestbook_entry', {
key: 'id'
}
},
senderUsername: {
sender_username: {
type: DataTypes.STRING,
allowNull: true,
},
contentHtml: {
content_html: {
type: DataTypes.TEXT,
allowNull: false,
},
imageUrl: {
image_url: {
type: DataTypes.STRING,
allowNull: true,
},
@@ -42,6 +42,7 @@ const GuestbookEntry = sequelize.define('guestbook_entry', {
schema: 'community',
timestamps: true,
underscored: true,
});
,
freezeTableName: true});
export default GuestbookEntry;

View File

@@ -11,7 +11,7 @@ const Image = sequelize.define('image', {
type: DataTypes.TEXT,
allowNull: true,
},
originalFileName: {
original_file_name: {
type: DataTypes.STRING,
allowNull: false,
},
@@ -20,7 +20,7 @@ const Image = sequelize.define('image', {
allowNull: false,
unique: true,
},
folderId: {
folder_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -28,7 +28,7 @@ const Image = sequelize.define('image', {
key: 'id',
},
},
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -41,6 +41,7 @@ const Image = sequelize.define('image', {
schema: 'community',
underscored: true,
timestamps: true,
});
,
freezeTableName: true});
export default Image;

View File

@@ -8,7 +8,7 @@ const ImageImageVisibility = sequelize.define('image_image_visibility', {
primaryKey: true,
allowNull: false
},
imageId: {
image_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const ImageImageVisibility = sequelize.define('image_image_visibility', {
key: 'id'
}
},
visibilityTypeId: {
visibility_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -32,6 +32,7 @@ const ImageImageVisibility = sequelize.define('image_image_visibility', {
schema: 'community',
timestamps: false,
underscored: true,
});
,
freezeTableName: true});
export default ImageImageVisibility;

View File

@@ -21,6 +21,7 @@ const ImageVisibilityUser = sequelize.define('image_visibility_user', {
timestamps: false,
underscored: true,
schema: 'community'
});
,
freezeTableName: true});
export default ImageVisibilityUser;

View File

@@ -6,6 +6,7 @@ const interest = sequelize.define('interest_type', {
tableName: 'interest',
schema: 'community',
underscored: true
});
,
freezeTableName: true});
export default interest;

View File

@@ -36,7 +36,7 @@ const User = sequelize.define('user', {
type: DataTypes.STRING,
allowNull: false,
},
registrationDate: {
registration_date: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
@@ -45,11 +45,11 @@ const User = sequelize.define('user', {
type: DataTypes.BOOLEAN,
defaultValue: false
},
resetToken: {
reset_token: {
type: DataTypes.UUID,
allowNull: true
},
hashedId: {
hashed_id: {
type: DataTypes.STRING,
allowNull: true
},
@@ -57,7 +57,7 @@ const User = sequelize.define('user', {
type: DataTypes.BOOLEAN,
defaultValue: true
},
authCode: {
auth_code: {
type: DataTypes.STRING,
allowNull: true
}
@@ -70,7 +70,8 @@ const User = sequelize.define('user', {
const hashedId = crypto.createHash('sha256').update(user.id.toString()).digest('hex');
user.hashedId = hashedId;
await user.save();
}
,
freezeTableName: true}
}
});

View File

@@ -5,7 +5,7 @@ import UserParamType from '../type/user_param.js';
import { encrypt, decrypt } from '../../utils/encryption.js';
const UserParam = sequelize.define('user_param', {
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -13,7 +13,7 @@ const UserParam = sequelize.define('user_param', {
key: 'id',
},
},
paramTypeId: {
param_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -55,7 +55,8 @@ const UserParam = sequelize.define('user_param', {
{
unique: true,
fields: ['user_id', 'param_type_id'],
},
,
freezeTableName: true},
],
});

View File

@@ -21,6 +21,7 @@ const UserParamVisibility = sequelize.define('user_param_visibility', {
timestamps: false,
underscored: true,
schema: 'community'
});
,
freezeTableName: true});
export default UserParamVisibility;

View File

@@ -4,7 +4,7 @@ import User from './user.js';
import UserRightType from '../type/user_right.js';
const UserRight = sequelize.define('user_right', {
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -12,7 +12,7 @@ const UserRight = sequelize.define('user_right', {
key: 'id'
}
},
rightTypeId: {
right_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -24,6 +24,7 @@ const UserRight = sequelize.define('user_right', {
tableName: 'user_right',
schema: 'community',
underscored: true,
});
,
freezeTableName: true});
export default UserRight;

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;

View File

@@ -10,6 +10,7 @@ const Forum = sequelize.define('forum', {
tableName: 'forum',
schema: 'forum',
underscored: true
});
,
freezeTableName: true});
export default Forum;

View File

@@ -2,7 +2,7 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const ForumForumPermission = sequelize.define('forum_forum_permission', {
forumId: {
forum_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -10,7 +10,7 @@ const ForumForumPermission = sequelize.define('forum_forum_permission', {
key: 'id'
}
},
permissionId: {
permission_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -22,6 +22,7 @@ const ForumForumPermission = sequelize.define('forum_forum_permission', {
tableName: 'forum_forum_permission',
schema: 'forum',
underscored: true
});
,
freezeTableName: true});
export default ForumForumPermission;

View File

@@ -17,6 +17,7 @@ const ForumPermission = sequelize.define('forum_permission', {
schema: 'forum',
timestamps: false,
underscored: true
});
,
freezeTableName: true});
export default ForumPermission;

View File

@@ -2,15 +2,15 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const ForumUserPermission = sequelize.define('forum_user_permission', {
userId: {
user_id: {
type: DataTypes.INTEGER,
allowNull: true
},
permissionId: {
permission_id: {
type: DataTypes.INTEGER,
allowNull: false
},
forumId: {
forum_id: {
type: DataTypes.INTEGER,
allowNull: false
},
@@ -18,6 +18,7 @@ const ForumUserPermission = sequelize.define('forum_user_permission', {
tableName: 'forum_user_permission',
schema: 'forum',
underscored: true
});
,
freezeTableName: true});
export default ForumUserPermission;

View File

@@ -6,11 +6,11 @@ const Message = sequelize.define('message', {
type: DataTypes.TEXT,
allowNull: false
},
createdBy: {
created_by: {
type: DataTypes.INTEGER,
allowNull: false
},
titleId: {
title_id: {
type: DataTypes.INTEGER,
allowNull: false
}
@@ -19,6 +19,7 @@ const Message = sequelize.define('message', {
schema: 'forum',
underscored: true,
timestamps: true
});
,
freezeTableName: true});
export default Message;

View File

@@ -2,19 +2,19 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const MessageHistory = sequelize.define('message_history', {
messageId: {
message_id: {
type: DataTypes.INTEGER,
allowNull: false
},
oldText: {
old_text: {
type: DataTypes.TEXT,
allowNull: false
},
changedBy: {
changed_by: {
type: DataTypes.INTEGER,
allowNull: false
},
oldUpdatedAt: {
old_updated_at: {
type: DataTypes.DATE,
allowNull: false
}
@@ -23,6 +23,7 @@ const MessageHistory = sequelize.define('message_history', {
schema: 'forum',
underscored: true,
timestamps: false
});
,
freezeTableName: true});
export default MessageHistory;

View File

@@ -2,11 +2,11 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const MessageImage = sequelize.define('message_image', {
messageId: {
message_id: {
type: DataTypes.INTEGER,
allowNull: false
},
fileName: {
file_name: {
type: DataTypes.STRING,
allowNull: false
}
@@ -15,6 +15,7 @@ const MessageImage = sequelize.define('message_image', {
schema: 'forum',
underscored: true,
timestamps: false
});
,
freezeTableName: true});
export default MessageImage;

View File

@@ -11,11 +11,11 @@ const Title = sequelize.define('title', {
type: DataTypes.STRING,
allowNull: false
},
createdBy: {
created_by: {
type: DataTypes.INTEGER,
allowNull: false
},
forumId: {
forum_id: {
type: DataTypes.INTEGER,
allowNull: false
}
@@ -24,6 +24,7 @@ const Title = sequelize.define('title', {
schema: 'forum',
underscored: true,
timestamps: true,
});
,
freezeTableName: true});
export default Title;

View File

@@ -2,19 +2,19 @@ import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const TitleHistory = sequelize.define('title_history', {
titleId: {
title_id: {
type: DataTypes.INTEGER,
allowNull: false
},
oldTitle: {
old_title: {
type: DataTypes.STRING,
allowNull: false
},
changedBy: {
changed_by: {
type: DataTypes.INTEGER,
allowNull: false
},
oldUpdatedAt: {
old_updated_at: {
type: DataTypes.DATE,
allowNull: false
}
@@ -23,6 +23,7 @@ const TitleHistory = sequelize.define('title_history', {
schema: 'forum',
underscored: true,
timestamps: false
});
,
freezeTableName: true});
export default TitleHistory;

View File

@@ -13,7 +13,7 @@ const Login = sequelize.define('login', {
}
}, {
schema: 'logs',
underscored: true,
underscored: true,
tableName: 'login'
});

View File

@@ -15,7 +15,7 @@ const Campaign = sequelize.define('Campaign', {
type: DataTypes.TEXT,
allowNull: true
},
isActive: {
is_active: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
@@ -23,11 +23,11 @@ const Campaign = sequelize.define('Campaign', {
type: DataTypes.INTEGER,
defaultValue: 1
},
createdAt: {
created_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
updated_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
@@ -36,6 +36,7 @@ const Campaign = sequelize.define('Campaign', {
schema: 'match3',
timestamps: true,
underscored: true // WICHTIG: Alle Datenbankfelder im snake_case Format
});
,
freezeTableName: true});
export default Campaign;

View File

@@ -7,7 +7,7 @@ const Match3Level = sequelize.define('Match3Level', {
primaryKey: true,
autoIncrement: true
},
campaignId: {
campaign_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -27,40 +27,40 @@ const Match3Level = sequelize.define('Match3Level', {
type: DataTypes.INTEGER,
allowNull: false
},
boardLayout: {
board_layout: {
type: DataTypes.TEXT,
allowNull: true, // Ändern zu true, da bereits existierende Datensätze vorhanden sind
defaultValue: 'xxxxxx\nxxxxxx\nxxxxxx\nxxxxxx\nxxxxxx\nxxxxxx', // Standard-Layout für neue Level
comment: 'Level-Form als String (o = kein Feld, x = Feld, Zeilen durch \n getrennt)'
},
boardWidth: {
board_width: {
type: DataTypes.INTEGER,
allowNull: true, // Ändern zu true, da bereits existierende Datensätze vorhanden sind
defaultValue: 6, // Standardwert für neue Level
comment: 'Breite des Level-Boards'
},
boardHeight: {
board_height: {
type: DataTypes.INTEGER,
allowNull: true, // Ändern zu true, da bereits existierende Datensätze vorhanden sind
defaultValue: 6, // Standardwert für neue Level
comment: 'Höhe des Level-Boards'
},
tileTypes: {
tile_types: {
type: DataTypes.JSON,
allowNull: true, // Ändern zu true, da wir jetzt eine Verknüpfungstabelle haben
comment: 'Legacy: Array der verfügbaren Tile-Typen (wird durch levelTileTypes ersetzt)'
},
moveLimit: {
move_limit: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 20
},
timeLimit: {
time_limit: {
type: DataTypes.INTEGER,
allowNull: true,
comment: 'Zeitlimit in Sekunden (null = kein Limit)'
},
isActive: {
is_active: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true
@@ -70,6 +70,7 @@ const Match3Level = sequelize.define('Match3Level', {
schema: 'match3',
timestamps: true,
underscored: true // WICHTIG: Alle Datenbankfelder im snake_case Format
});
,
freezeTableName: true});
export default Match3Level;

View File

@@ -7,7 +7,7 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
primaryKey: true,
autoIncrement: true
},
levelId: {
level_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -16,7 +16,7 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
},
comment: 'Referenz auf den Level'
},
tileTypeId: {
tile_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -31,7 +31,7 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
defaultValue: 1,
comment: 'Gewichtung für die Wahrscheinlichkeit, dass dieser Tile-Typ erscheint'
},
isActive: {
is_active: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
@@ -46,7 +46,8 @@ const Match3LevelTileType = sequelize.define('Match3LevelTileType', {
{
unique: true,
fields: ['level_id', 'tile_type_id'] // WICHTIG: Bei underscored: true müssen snake_case Namen verwendet werden
}
,
freezeTableName: true}
]
});

View File

@@ -7,7 +7,7 @@ const Objective = sequelize.define('Objective', {
primaryKey: true,
autoIncrement: true
},
levelId: {
level_id: {
type: DataTypes.INTEGER,
allowNull: false
},
@@ -31,15 +31,15 @@ const Objective = sequelize.define('Objective', {
type: DataTypes.INTEGER,
defaultValue: 1
},
isRequired: {
is_required: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
createdAt: {
created_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
updated_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
@@ -48,6 +48,7 @@ const Objective = sequelize.define('Objective', {
schema: 'match3',
timestamps: true,
underscored: true // WICHTIG: Alle Datenbankfelder im snake_case Format
});
,
freezeTableName: true});
export default Objective;

View File

@@ -12,7 +12,7 @@ const Match3TileType = sequelize.define('Match3TileType', {
allowNull: false,
comment: 'Eindeutiger Name des Tile-Typs (z.B. "gem", "star", "heart")'
},
displayName: {
display_name: {
type: DataTypes.STRING(100),
allowNull: false,
comment: 'Anzeigename des Tile-Typs (z.B. "Juwel", "Stern", "Herz")'
@@ -39,7 +39,7 @@ const Match3TileType = sequelize.define('Match3TileType', {
defaultValue: 10,
comment: 'Punkte, die dieser Tile-Typ beim Matchen gibt'
},
isActive: {
is_active: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
@@ -54,7 +54,8 @@ const Match3TileType = sequelize.define('Match3TileType', {
{
unique: true,
fields: ['name']
}
,
freezeTableName: true}
]
});

View File

@@ -7,11 +7,11 @@ const UserLevelProgress = sequelize.define('UserLevelProgress', {
primaryKey: true,
autoIncrement: true
},
userProgressId: {
user_progress_id: {
type: DataTypes.INTEGER,
allowNull: false
},
levelId: {
level_id: {
type: DataTypes.INTEGER,
allowNull: false
},
@@ -31,7 +31,7 @@ const UserLevelProgress = sequelize.define('UserLevelProgress', {
type: DataTypes.INTEGER,
defaultValue: 0
},
isCompleted: {
is_completed: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
@@ -39,27 +39,27 @@ const UserLevelProgress = sequelize.define('UserLevelProgress', {
type: DataTypes.INTEGER,
defaultValue: 1
},
bestScore: {
best_score: {
type: DataTypes.INTEGER,
defaultValue: 0
},
bestMoves: {
best_moves: {
type: DataTypes.INTEGER,
defaultValue: 0
},
bestTime: {
best_time: {
type: DataTypes.INTEGER,
defaultValue: 0
},
completedAt: {
completed_at: {
type: DataTypes.DATE,
allowNull: true
},
createdAt: {
created_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
updated_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
@@ -72,7 +72,8 @@ const UserLevelProgress = sequelize.define('UserLevelProgress', {
{
unique: true,
fields: ['user_progress_id', 'level_id'] // WICHTIG: Bei underscored: true müssen snake_case Namen verwendet werden
}
,
freezeTableName: true}
]
});

Some files were not shown because too many files have changed in this diff Show More