-- liquibase formatted sql

-- changeset L_DelOff:create_table_users_roles rollbackSplitStatements:true
-- comment: Создание сопоставляющей таблицы пользователь -  роли

CREATE TABLE users_roles
(
    `user_id` VARCHAR(36) NOT NULL,
    `role_id` VARCHAR(36) NOT NULL,
    PRIMARY KEY (`user_id`,`role_id`),
    KEY `role_id` (`role_id`),
    CONSTRAINT `users_roles_ibfk_1`
        FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
    CONSTRAINT `users_roles_ibfk_2`
        FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`)
);


-- rollback DROP TABLE users_roles;