Create this image
- User
Create this image
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Create this image
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Certainly! Below is the PlantUML script to create the ER diagram for the House Rental Management System. You can use this script in a PlantUML editor to generate the diagram.
@startuml
skinparam defaultFontName Helvetica
' Entities
entity "User" as User {
+ user_id : int (PK)
--
+ email : varchar (Unique)
+ password : varchar
+ role : enum (tenant, owner, admin)
+ created_at : datetime
+ updated_at : datetime
}
entity "Tenant" as Tenant {
+ user_id : int (FK)
--
+ first_name : varchar
+ last_name : varchar
+ phone_number : varchar
}
entity "Owner" as Owner {
+ user_id : int (FK)
--
+ business_name : varchar
+ phone_number : varchar
}
entity "Admin" as Admin {
+ user_id : int (FK)
--
' No additional attributes
}
entity "House" as House {
+ house_id : int (PK)
--
+ owner_id : int (FK)
+ address : varchar
+ price : decimal
+ description : text
+ status : enum (available, booked, pending, deleted)
+ image_url : varchar
+ created_at : datetime
+ updated_at : datetime
}
entity "Booking" as Booking {
+ booking_id : int (PK)
--
+ tenant_id : int (FK)
+ house_id : int (FK)
+ booking_date : datetime
+ start_date : datetime
+ end_date : datetime
+ status : enum (pending, confirmed, rejected)
+ confirmation_date : datetime
}
' Relationships
' User Subtypes
User "1" -- "1" Tenant : "is a"
User "1" -- "1" Owner : "is a"
User "1" -- "1" Admin : "is a"
' Owner <-> House (1:N)
Owner "1" -- "*" House : "owns"
House : owner_id (FK) --> Owner : user_id (PK)
' Tenant <-> Booking (1:N)
Tenant "1" -- "*" Booking : "makes"
Booking : tenant_id (FK) --> Tenant : user_id (PK)
' House <-> Booking (1:N)
House "1" -- "*" Booking : "is booked in"
Booking : house_id (FK) --> House : house_id (PK)
' Admin permissions (via role in User)
note right of Admin
Admin can access all entities\n(via role in User table)
end note
@enduml
Copy the script above into a PlantUML editor:
Generate the Diagram:
User is the supertype with Tenant, Owner, and Admin as subtypes.House.owner_id links to User.user_id (filtered by role = "owner").Booking.tenant_id links to User.user_id (filtered by role = "tenant").Booking.house_id links to House.house_id.Owner → House: 1-to-many.Tenant → Booking: 1-to-many.House → Booking: 1-to-many.role field in User.Here’s a rough textual representation of how the diagram will look:
+-------------------+
| User |
| (PK) user_id |
| email (Unique) |
| password |
| role (ENUM) |
| created_at |
| updated_at |
+-------------------+
|
| 1
|
+-----------+ +-----------+ +-----------+
| Tenant | | Owner | | Admin |
| (FK) user_id | (FK) user_id | (FK) user_id |
| first_name | business_name | |
| last_name | phone_number | |
| phone_number| | |
+-----------+ +-----------+ +-----------+
+-------------------+
| House |
| (PK) house_id |
| owner_id (FK) |
| address |
| price |
| description |
| status (ENUM) |
| image_url |
| created_at |
| updated_at |
+-------------------+
|
| 1 * |
|--------------|
"owns"
+-------------------+
| Booking |
| (PK) booking_id |
| tenant_id (FK) |
| house_id (FK) |
| booking_date |
| start_date |
| end_date |
| status (ENUM) |
| confirmation_date |
+-------------------+
| |
| |
| |
| |
+-----------+ +-----------+
| Tenant | | House |
+-----------+ +-----------+
This script should give you a clear and accurate ER diagram for your House Rental Management System. If you need further adjustments, feel free to ask! 😊