Instruction file imported from konstantine-garozashvili/Intra-Big-job (
.cursor/rules/database.mdc). Copyright stays with the author.
Database Structure
Comprehensive documentation of the database tables, columns, and relationships
User Management
User
- Primary Keys:
id(auto-increment) - Main Columns:
id: int, Primary KeylastName: string (255)firstName: string (255)birthDate: datetimeemail: string (180), uniquephoneNumber: string (20)password: string (255)profilePicturePath: string (255), nullablelinkedinUrl: string (255), nullablecreatedAt: datetime_immutableupdatedAt: datetime_immutable, nullable
- Security Fields:
isEmailVerified: booleanverificationToken: string (255), nullableresetPasswordToken: string (255), nullableresetPasswordExpires: datetime_immutable, nullable
- Foreign Keys:
nationality_id→Nationality.idtheme_id→Theme.idspecialization_id→Specialization.id, nullable
- Relations:
- OneToMany:
userRoles,addresses,signatures,createdGroups,tickets,assignedTickets,userDiplomas - ManyToMany:
formations,groups - OneToOne:
studentProfile
- OneToMany:
UserRole
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyuser_id: introle_id: int
- Foreign Keys:
user_id→User.id(cascade delete)role_id→Role.id
- Junction Table: Links users to roles
Role
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)code: string (255)createdAt: datetime_immutableupdatedAt: datetime_immutable
- Standard Values:
- ADMIN
- SUPERADMIN
- HR
- TEACHER
- STUDENT (104)
- GUEST
- RECRUITER
UserStatus
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)code: string (255)
UserStatusHistory
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyuser_id: intstatus_id: intcreatedAt: datetime_immutablenotes: text, nullable
- Foreign Keys:
user_id→User.idstatus_id→UserStatus.id
UserSituationType
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)code: string (255)
Student Domain
StudentProfile
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyuser_id: intisSeekingInternship: booleanisSeekingApprenticeship: booleancurrentInternshipCompany: string (255), nullableinternshipStartDate: date, nullableinternshipEndDate: date, nullableportfolioUrl: string (255), nullablecreatedAt: datetimeupdatedAt: datetime
- Foreign Keys:
user_id→User.id(cascade delete)situationType_id→UserSituationType.id, nullable
- Relations:
- OneToOne:
user
- OneToOne:
Education Data
Formation
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)promotion: string (255)description: text, nullable
- Relations:
- ManyToMany:
students(junction:formation_student)
- ManyToMany:
Diploma
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)description: text, nullablelevel: string (255), nullable
UserDiploma
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyuser_id: intdiploma_id: intobtainedAt: date, nullableinstitution: string (255), nullable
- Foreign Keys:
user_id→User.id(cascade delete)diploma_id→Diploma.id(cascade delete)
Domain
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)description: text, nullable
Specialization
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)description: text, nullabledomain_id: int
- Foreign Keys:
domain_id→Domain.id
Location Data
Address
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary KeystreetAddress: string (255)additionalAddress: string (255), nullableuser_id: intcity_id: intpostalCode_id: intisPrimary: boolean
- Foreign Keys:
user_id→User.id(cascade delete)city_id→City.idpostalCode_id→PostalCode.id
City
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)zipCode: string (255)
PostalCode
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keycode: string (255)
Nationality
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)code: string (255)
Document Management
Document
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyuser_id: intdocumentType_id: intname: string (255)filename: string (255)mimeType: string (100)size: intpath: string (255)status: enum (DocumentStatus)comment: text, nullablevalidatedBy_id: int, nullablevalidatedAt: datetime, nullableuploadedAt: datetimeupdatedAt: datetime
- Foreign Keys:
user_id→User.iddocumentType_id→DocumentType.idvalidatedBy_id→User.id
- Relations:
- OneToMany:
history
- OneToMany:
DocumentType
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)description: text, nullablecategory_id: int, nullable
- Foreign Keys:
category_id→DocumentCategory.id
DocumentCategory
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)description: text, nullable
DocumentHistory
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keydocument_id: intaction: string (255)actor_id: int, nullablecreatedAt: datetimedetails: text, nullable
- Foreign Keys:
document_id→Document.id(cascade delete)actor_id→User.id
Communication
Ticket
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keytitle: string (255)description: textcreator_id: intassignedTo_id: int, nullablestatus_id: intpriority: string (50), nullableservice_id: int, nullablecreatedAt: datetime_immutableupdatedAt: datetime_immutable, nullableresolvedAt: datetime_immutable, nullable
- Foreign Keys:
creator_id→User.id(cascade delete)assignedTo_id→User.idstatus_id→TicketStatus.idservice_id→TicketService.id
- Relations:
- OneToMany:
comments
- OneToMany:
TicketComment
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keycontent: textticket_id: intauthor_id: intcreatedAt: datetime_immutable
- Foreign Keys:
ticket_id→Ticket.id(cascade delete)author_id→User.id
TicketStatus
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)code: string (255)color: string (255)createdAt: datetime_immutableupdatedAt: datetime_immutable
- Standard Values:
- OPEN
- IN_PROGRESS
- PENDING
- RESOLVED
- CLOSED
TicketService
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)description: textcreatedAt: datetime_immutableupdatedAt: datetime_immutable
- Standard Values:
- Support Technique
- Administration
- Pédagogie
- Absences
Message
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keysender_id: intrecipient_id: int, nullablecontent: textcreatedAt: datetime_immutableisGlobal: booleanreadBy: json arraygroup_id: int, nullable
- Foreign Keys:
sender_id→User.idrecipient_id→User.idgroup_id→Group.id
Group (Messaging Group)
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)description: text, nullablecreatedAt: datetime_immutablecreator_id: int
- Foreign Keys:
creator_id→User.id
- Relations:
- ManyToMany:
members(User) - OneToMany:
messages
- ManyToMany:
Events & Calendar
ScheduleEvent
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keytitle: string (255)description: text, nullablestartDateTime: datetime_immutableendDateTime: datetime_immutablelocation: string (255), nullabletype: string (255)createdBy_id: intcreatedAt: datetime_immutable
- Foreign Keys:
createdBy_id→User.id
- Relations:
- OneToMany:
eventParticipants
- OneToMany:
EventParticipant
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyevent_id: intuser_id: intstatus: string (255), nullable
- Foreign Keys:
event_id→ScheduleEvent.id(cascade delete)user_id→User.id
UI Settings
Theme
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyname: string (255)code: string (255)
- Standard Values:
- LIGHT
- DARK
- SYSTEM
Signature
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary Keyimage: longblobuser_id: intcreatedAt: datetime_immutableisActive: boolean
- Foreign Keys:
user_id→User.id(cascade delete)
Security
RefreshToken
- Primary Keys:
id(auto-increment) - Columns:
id: int, Primary KeyrefreshToken: string (255)username: string (255)valid: datetime
- Used for: JWT token refresh mechanism