Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE `account_tariffs` (
- `account_id` INT(11) NOT NULL COMMENT 'id аккаунта из таблицы accounts',
- `tariff_id` INT(11) NOT NULL COMMENT 'id тарифа из таблицы tariffs',
- `tariff_order` INT(11) DEFAULT NULL COMMENT 'сортировка, начинается с 1',
- UNIQUE KEY `idx_account_tariffs_account_id_tariff_id` (`account_id`,`tariff_id`),
- UNIQUE KEY `idx_account_tariffs_account_id_order` (`account_id`,`tariff_order`),
- KEY `account_id` (`account_id`),
- KEY `tariff_id` (`tariff_id`),
- CONSTRAINT `fk_account_tariffs_tariffs` FOREIGN KEY (`tariff_id`) REFERENCES `tariffs` (`id`) ON DELETE CASCADE,
- CONSTRAINT `fk_account_tariffs_accounts` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=0;
Add Comment
Please, Sign In to add comment