mipadi
mipadi

Reputation: 410602

How do I remove a uniqueness constraint from a MySQL table?

I created a table in a MySQL database via the following:

CREATE TABLE `newsubscriptions_orderspecification` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `display_name` varchar(256) NOT NULL,
    `sub_def_id` integer UNSIGNED NOT NULL,
    `source_code_id` integer UNSIGNED NOT NULL,
    `order_code_id` integer UNSIGNED NOT NULL,
    `rate` numeric(5, 2) NOT NULL,
    `type` varchar(4) NOT NULL,
    `region` varchar(4) NOT NULL,
    `term` varchar(4) NOT NULL,
    `buyer_type` varchar(4) NOT NULL,
    `is_active` bool NOT NULL,
    UNIQUE (`sub_def_id`, `buyer_type`, `rate`, `is_active`)
)
;

How can I remove the uniqueness constraint?

Upvotes: 7

Views: 4913

Answers (1)

Nanne
Nanne

Reputation: 64399

use this:

ALTER TABLE  `newsubscriptions_orderspecification` DROP INDEX  `sub_def_id`

Upvotes: 12

Related Questions