locationtype
Table Name: locationtype
The locationtype table defines the types or categories of locations in the system. It is used as a reference table to classify and organize locations based on their attributes (e.g., city, village, district). Each location type is assigned a unique identifier and contains additional metadata such as its level in the hierarchy, editability, and associated timestamps for creation and modification.
Columns
| Column Name | Data Type | Description |
|---|---|---|
| locationTypeId | int(11) | The unique identifier for the location type. |
| typeName | varchar(45) | The name of the location type (e.g., City, District). |
| level | int(11) | Indicates the level of the location type in a hierarchy. |
| isEditable | tinyint(1) | Specifies whether this location type is editable (1 for editable, 0 otherwise). |
| description | varchar(255) | A brief description of the location type. |
| createdDate | datetime | The date and time when this location type was created. |
| createdByUserId | int(11) | The userId of the user who created this location type. |
| lastEditedByUserId | int(11) | The userId of the user who last edited this location type. |
| lastEditedDate | datetime | The date and time when this location type was last edited. |
Indexes
- Primary Key Index:
- locationTypeId: Ensures each location type has a unique identifier.
- Unique Key on typeName:
- Ensures that each location type name is unique within the system.
Usage Notes
- The locationtype table is used as a reference for defining and categorizing locations in the location table.
- The level column indicates the position of the location type in a hierarchy, enabling a structured representation of administrative levels (e.g., country -> state -> city).
- The isEditable column determines whether a specific location type can be modified through the system, providing flexibility for managing location types dynamically or marking some as immutable.
- Timestamps (createdDate, lastEditedDate) and user identifiers (createdByUserId, lastEditedByUserId) provide a complete audit trail for tracking changes to location types.
- The unique constraint on typeName ensures that no two location types have the same name, avoiding redundancy and conflicts in type definition.