CREATE TABLE role (
	  id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
	  nazov VARCHAR(50) NOT NULL,
	 
	  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
	 
CREATE TABLE permission (
	  id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
	  nazov VARCHAR(50) NOT NULL,
	 
	  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
	 
CREATE TABLE role_permission (
	  role_id INTEGER UNSIGNED NOT NULL,
	  permission_id INTEGER UNSIGNED NOT NULL,
	  PRIMARY KEY (`role_id`,`permission_id`),
	  KEY `role_permission_FKIndex1` (`role_id`),
	  KEY `role_permission_FKIndex2` (`permission_id`),
	  CONSTRAINT `fk_role_permission_role` FOREIGN KEY (role_id) REFERENCES role(id) ON DELETE NO ACTION ON UPDATE NO ACTION,
      CONSTRAINT `fk_role_permission_permission` FOREIGN KEY (permission_id) REFERENCES permission(id) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
	 
