Skip to main content

role

Table Name: role

The role table is used to store information about different roles within the system, which are assigned to users to determine their access rights and responsibilities. These roles help to manage permissions and user actions.


Columns

Column NameData TypeConstraintsDescription
roleIdsmallint(6)Primary Key, Not NullThe unique identifier for the role.
createdDatedatetimeNullableThe date and time when the role was created.
descriptionvarchar(255)NullableA brief description of the role.
lastEditedDatedatetimeNullableThe date and time when the role was last edited.
rolenamevarchar(30)Unique, NullableThe name of the role (e.g., "Admin", "Manager", "User").
createdByUserIdint(11)Nullable, Foreign KeyThe user ID of the person who created this role.
lastEditedByUserIdint(11)Nullable, Foreign KeyThe user ID of the person who last edited this role.
synchronizabletinyint(4)NullableIndicates whether the role can be synchronized with external systems (e.g., 1 for true, 0 for false).
isVaccinatortinyint(4)NullableIndicates whether the role is assigned to a vaccinator (e.g., 1 for true, 0 for false).

Indexes

  1. Primary Key:
    • roleId: Uniquely identifies each role in the system.
  2. Unique Key:
    • rolename: Ensures that each role name is unique across all roles.
  3. Foreign Keys:
    • role_createdByUserId_user_mappedId_FK:
      • References user(mappedId) for the createdByUserId column.
      • Links the role to the user who created it.
    • role_lastEditedByUserId_user_mappedId_FK:
      • References user(mappedId) for the lastEditedByUserId column.
      • Links the role to the user who last edited it.

Foreign Key Relations

  1. role_createdByUserId_user_mappedId_FK:
    • Referenced Table: user
    • Referenced Column: mappedId
    • Description: Ensures that the createdByUserId exists as a valid mappedId in the user table, thus maintaining a relationship with the user who created the role.
  2. role_lastEditedByUserId_user_mappedId_FK:
    • Referenced Table: user
    • Referenced Column: mappedId
    • Description: Ensures that the lastEditedByUserId exists as a valid mappedId in the user table, maintaining a relationship with the user who last edited the role.

Usage Notes

  • Purpose:
    • The role table is used to define various roles within the system. Each role can have specific permissions, and users are assigned these roles to manage access control.
  • Key Attributes:
    • roleId: A unique identifier for each role.
    • rolename: The unique name associated with the role.
    • createdByUserId: The user who created this role.
    • lastEditedByUserId: The user who last edited this role.
    • synchronizable: Whether the role is synchronizable.
    • isVaccinator: Indicates if the role is associated with vaccinators.