Guest User

Untitled

a guest
Dec 14th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.81 KB | None | 0 0
  1. CREATE TABLE `account_tariffs` (
  2.   `account_id` INT(11) NOT NULL COMMENT 'id аккаунта из таблицы accounts',
  3.   `tariff_id` INT(11) NOT NULL COMMENT 'id тарифа из таблицы tariffs',
  4.   `tariff_order` INT(11) DEFAULT NULL COMMENT 'сортировка, начинается с 1',
  5.   UNIQUE KEY `idx_account_tariffs_account_id_tariff_id` (`account_id`,`tariff_id`),
  6.   UNIQUE KEY `idx_account_tariffs_account_id_order` (`account_id`,`tariff_order`),
  7.   KEY `account_id` (`account_id`),
  8.   KEY `tariff_id` (`tariff_id`),
  9.   CONSTRAINT `fk_account_tariffs_tariffs` FOREIGN KEY (`tariff_id`) REFERENCES `tariffs` (`id`) ON DELETE CASCADE,
  10.   CONSTRAINT `fk_account_tariffs_accounts` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`) ON DELETE CASCADE
  11. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=0;
Add Comment
Please, Sign In to add comment