In our Role Demo sample, we will store the role hierarchy in the "roledemo" database. We will create the following tables (see figure 17.2):
role
table will contain data related to a role (its name and description)role_hierarchy
table will contain parent-child relationships between rolespermission
table will contain permissionsrole_permission
table will allow to assign permissions to rolesuser_role
table will allow to assign roles to usersuser
table will contain data of users (we created this table earlier in User Demo sample)
Figure 17.2 Database Schema of Role Demo Sample
You can find a database migration, which creates these tables, in the Role Demo sample application. To run migrations, type the following command:
./vendor/bin/doctrine-module migrations:migrate
If you are new to migrations, refer to chapter Database Migrations.