ALTER TABLE `calendar_profiles` 
    DROP COLUMN `max_usage`, 
    ADD COLUMN `opt` TEXT NULL DEFAULT NULL COMMENT 'json - type: \"bulk/similar/max_usage\",value: int\n' AFTER `is_public`;

CREATE TABLE `calendar_profiles_subscription` (
    `id` INT NOT NULL AUTO_INCREMENT,
    `profile` INT NULL,
    `user` INT NULL,
    PRIMARY KEY (`id`),
    INDEX `profile_idx` (`profile` ASC),
    INDEX `user_idx` (`user` ASC),
    CONSTRAINT `profile_fk`
        FOREIGN KEY (`profile`)
        REFERENCES `calendar_profiles` (`id`)
        ON DELETE NO ACTION
        ON UPDATE NO ACTION,
    CONSTRAINT `user_fk`
        FOREIGN KEY (`user`)
        REFERENCES `users` (`id`)
        ON DELETE NO ACTION
        ON UPDATE NO ACTION
) ENGINE=INNODB;

INSERT INTO widgets VALUES (NULL, 'my-profiles', 'My calendar profiles', NULL, NULL, '/widgets/index/my-profiles.php', '/index.php');
