Good afternoon
First issues :
php upgrade.php (db update)
Stage 1 of update Update20140812134140 failed! mysqli error: [1091: Can't
DROP 'idx_name'; check that column/key exists] in EXECUTE("ALTER TABLE tags
DROP KEY idx_name,
ADD `account_id` int(11) NULL,
ADD UNIQUE KEY `idx_name` (`name`, `account_id`),
ADD CONSTRAINT `fk_tags_clients_id` FOREIGN KEY (`account_id`)
REFERENCES `clients` (`id`) ON DELETE CASCADE
")
wont work,
has to be 2 queries:
ALTER TABLE tags DROP KEY idx_name;
(it's not exists, but to make sure if exists)
ADD `account_id` int(11) NULL,
ADD UNIQUE KEY `idx_name` (`name`, `account_id`),
ADD CONSTRAINT `fk_tags_clients_id` FOREIGN KEY (`account_id`)
REFERENCES `clients` (`id`) ON DELETE CASCADE
Second issue
CREATE TABLE `tag_link` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tag_id` int(11) NOT NULL,
`resource` varchar(32) NOT NULL,
`resource_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk_tag_link_tags_id` FOREIGN KEY (`tag_id`)
REFERENCES `tags` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
this is more complex issue:
because
tags | CREATE TABLE `tags` (
`tag_id` int(11) unsigned NOT NULL COMMENT 'The unique identifier of the
tag',
`name` varchar(127) NOT NULL COMMENT 'The display name of the tag',
`account_id` int(11) DEFAULT NULL,
PRIMARY KEY (`tag_id`),
UNIQUE KEY `idx_name` (`name`,`account_id`),
KEY `fk_tags_clients_id` (`account_id`),
CONSTRAINT `fk_tags_clients_id` FOREIGN KEY (`account_id`) REFERENCES
`clients` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Tags'
so, should be CONSTRAINT `fk_tag_link_tags_id` FOREIGN KEY (`tag_id`)
REFERENCES `tags` (`*tag_id*`) ON DELETE CASCADE
Second issue is:
tags table:
`tag_id` int(11) *unsigned* NOT NULL COMMENT 'The unique identifier of
the tag',
tag_link table:
`tag_id` int(11) NOT NULL,
should be correct query:
CREATE TABLE `tag_link` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tag_id` int(11) unsigned NOT NULL,
`resource` varchar(32) NOT NULL,
`resource_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `fk_tag_link_tags_id` FOREIGN KEY (`tag_id`)
REFERENCES `tags` (`tag_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
You received this message because you are subscribed to the Google Groups
"scalr-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.