CREATE TABLE `role_permissions` (
	`id` varchar(36) NOT NULL,
	`role` varchar(50) NOT NULL,
	`resource` varchar(100) NOT NULL,
	`action` varchar(50) NOT NULL,
	`is_enabled` TINYINT(1) NOT NULL DEFAULT 1,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `role_permissions_id` PRIMARY KEY(`id`),
	CONSTRAINT `unique_role_resource_action` UNIQUE(`role`, `resource`, `action`)
);

--> statement-breakpoint

CREATE TABLE `system_modules` (
	`id` varchar(36) NOT NULL,
	`module_id` varchar(50) NOT NULL,
	`is_enabled` TINYINT(1) NOT NULL DEFAULT 1,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `system_modules_id` PRIMARY KEY(`id`),
	CONSTRAINT `unique_module_id` UNIQUE(`module_id`)
);