run migrations on kitsune staging

RESOLVED FIXED

Status

Mozilla Messaging
Server Operations
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: sancus, Assigned: gozer)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
Couple things that need to be done here, first of all, in the kitsune database run:
CREATE TABLE schema_version (version INTEGER NOT NULL);
INSERT INTO schema_versions VALUES(83);

-- Our initial SQL import is up to date with migration 83, everything after that we don't have --

You can get the schematic script to run here: https://github.com/jbalogh/schematic

just download it into the kitsune dir and run:
`python schematic migrations`

The first and only argument is the directory where all the migrations are stored.

I have already updated staging to 2.7, so you should have all the necessary migrations.
(Reporter)

Updated

7 years ago
Assignee: nobody → gozer
(Assignee)

Comment 1

7 years ago
Running migration 84:
-- Remove the old notifications_eventwatch table.
DROP TABLE notifications_eventwatch;

That took 0.76 seconds
################################################## 

Running migration 85:
-- Allow tweets to be hidden on Army of Awesome page.
ALTER TABLE `customercare_tweet` ADD `hidden` TINYINT(1) NOT NULL DEFAULT '0';
ALTER TABLE `customercare_tweet` ADD INDEX ( `hidden` ) ;

That took 0.83 seconds
################################################## 

Running migration 86:
-- Delete orphaned replies so the foreign key we're about to add doesn't freak
-- out:
CREATE TEMPORARY TABLE tweets_to_delete (id int)
    SELECT child.id FROM customercare_tweet child
        LEFT JOIN customercare_tweet parent ON child.reply_to=parent.tweet_id
        WHERE parent.id IS NULL AND
              child.reply_to IS NOT NULL;
DELETE FROM customercare_tweet WHERE id IN (SELECT id FROM tweets_to_delete);

-- Remove surrogate key, and use tweet ID instead. Make reply_to a foreign key,
-- and rename it to conform to our conventions.
ALTER TABLE customercare_tweet DROP id, ADD PRIMARY KEY (tweet_id);
ALTER TABLE customercare_tweet CHANGE reply_to reply_to_id bigint;
ALTER TABLE customercare_tweet ADD CONSTRAINT reply_to_id_refs_tweet_id_47b7f44d FOREIGN KEY (reply_to_id) REFERENCES customercare_tweet (tweet_id);

-- Drop old tweet_id index, now redundant with pkey:
ALTER TABLE customercare_tweet DROP KEY tweet_id;

That took 0.91 seconds
################################################## 

Running migration 87:
INSERT INTO django_content_type (`name`, `app_label`, `model`) VALUES
    ('image attachment', 'upload', 'imageattachment');

SET @ct = LAST_INSERT_ID();

INSERT INTO auth_permission (`name`, `content_type_id`, `codename`) VALUES
    ('Can add image attachments', @ct, 'add_imageattachment'),
    ('Can change image attachments', @ct, 'change_imageattachment'),
    ('Can delete image attachments', @ct, 'delete_imageattachment');

That took 0.15 seconds
################################################## 

Running migration 88:
CREATE TABLE `postcrash_signature` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `signature` varchar(255) NOT NULL UNIQUE,
    `document_id` integer NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
;
ALTER TABLE `postcrash_signature` ADD CONSTRAINT `document_id_refs_id_4d433fd5` FOREIGN KEY (`document_id`) REFERENCES `wiki_document` (`id`);
CREATE INDEX `postcrash_signature_f4226d13` ON `postcrash_signature` (`document_id`);

That took 0.57 seconds
################################################## 

Running migration 89:
CREATE TABLE `activity_activity` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL,
    `creator_id` integer,
    `created` datetime NOT NULL,
    `title` varchar(120) NOT NULL,
    `content` varchar(400) NOT NULL,
    `url` varchar(200),
    `content_type_id` integer,
    `object_id` integer UNSIGNED
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;

ALTER TABLE `activity_activity` ADD CONSTRAINT `user_id_refs_id_a9d97970` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `activity_activity` ADD CONSTRAINT `creator_id_refs_id_a9d97970` FOREIGN KEY (`creator_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `activity_activity` ADD CONSTRAINT `content_type_id_refs_id_4349db6c` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`);
CREATE INDEX `activity_activity_e569965d` ON `activity_activity` (`user_id`);
CREATE INDEX `activity_activity_f97a5119` ON `activity_activity` (`creator_id`);
CREATE INDEX `activity_activity_3216ff68` ON `activity_activity` (`created`);
CREATE INDEX `activity_activity_e4470c6e` ON `activity_activity` (`content_type_id`);

That took 2.39 seconds
################################################## 

Running migration 90:
CREATE TABLE `waffle_flag_groups` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `flag_id` integer NOT NULL,
    `group_id` integer NOT NULL,
    UNIQUE (`flag_id`, `group_id`)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `waffle_flag_groups` ADD CONSTRAINT `group_id_refs_id_4ea49f34` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`);

CREATE TABLE `waffle_flag_users` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `flag_id` integer NOT NULL,
    `user_id` integer NOT NULL,
    UNIQUE (`flag_id`, `user_id`)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `waffle_flag_users` ADD CONSTRAINT `user_id_refs_id_bae2dfc2` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);

CREATE TABLE `waffle_flag` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(100) NOT NULL UNIQUE,
    `everyone` bool,
    `percent` numeric(3, 1),
    `superusers` bool NOT NULL,
    `staff` bool NOT NULL,
    `authenticated` bool NOT NULL,
    `rollout` bool NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `waffle_flag_groups` ADD CONSTRAINT `flag_id_refs_id_8e6a807d` FOREIGN KEY (`flag_id`) REFERENCES `waffle_flag` (`id`);
ALTER TABLE `waffle_flag_users` ADD CONSTRAINT `flag_id_refs_id_8fef0c12` FOREIGN KEY (`flag_id`) REFERENCES `waffle_flag` (`id`);

That took 1.84 seconds
################################################## 

Running migration 91:
-- Add a preferred locale to profiles.
ALTER TABLE `users_profile`
    ADD `locale` varchar(7) NOT NULL DEFAULT 'en-US';

That took 0.60 seconds
################################################## 

Running migration 92:
DROP TABLE `activity_activity`;

CREATE TABLE `activity_action_users` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `action_id` integer NOT NULL,
    `user_id` integer NOT NULL,
    UNIQUE (`action_id`, `user_id`)
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;

ALTER TABLE `activity_action_users` ADD CONSTRAINT `user_id_refs_id_514426b8` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);

CREATE TABLE `activity_action` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `creator_id` integer,
    `created` datetime NOT NULL,
    `data` varchar(400) NOT NULL,
    `url` varchar(200),
    `content_type_id` integer,
    `object_id` integer UNSIGNED,
    `formatter_cls` varchar(200) NOT NULL
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;

ALTER TABLE `activity_action` ADD CONSTRAINT `creator_id_refs_id_4475b305` FOREIGN KEY (`creator_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `activity_action` ADD CONSTRAINT `content_type_id_refs_id_95f5c947` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`);
ALTER TABLE `activity_action_users` ADD CONSTRAINT `action_id_refs_id_52ad1f42` FOREIGN KEY (`action_id`) REFERENCES `activity_action` (`id`);
CREATE INDEX `activity_action_f97a5119` ON `activity_action` (`creator_id`);
CREATE INDEX `activity_action_3216ff68` ON `activity_action` (`created`);
CREATE INDEX `activity_action_e4470c6e` ON `activity_action` (`content_type_id`);


That took 4.44 seconds
################################################## 

Running migration 93:
-- Announcement model
CREATE TABLE `announcements_announcement` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `created` datetime NOT NULL,
    `creator_id` integer NOT NULL,
    `show_after` datetime NOT NULL,
    `show_until` datetime,
    `content` longtext NOT NULL,
    `group_id` integer
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `announcements_announcement` ADD CONSTRAINT `creator_id_refs_id_1b56d8` FOREIGN KEY (`creator_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `announcements_announcement` ADD CONSTRAINT `group_id_refs_id_685bd3c7` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`);
CREATE INDEX `announcements_announcement_f97a5119` ON `announcements_announcement` (`creator_id`);
CREATE INDEX `announcements_announcement_3c9f0fe7` ON `announcements_announcement` (`show_after`);
CREATE INDEX `announcements_announcement_d63a60f1` ON `announcements_announcement` (`show_until`);
CREATE INDEX `announcements_announcement_bda51c3c` ON `announcements_announcement` (`group_id`);

-- Auth permissions
INSERT INTO django_content_type (`name`, `app_label`, `model`) VALUES
    ('announcement', 'announcements', 'announcement');

SET @ct = LAST_INSERT_ID();

INSERT INTO auth_permission (`name`, `content_type_id`, `codename`) VALUES
    ('Can add announcement', @ct, 'add_announcement'),
    ('Can change announcement', @ct, 'change_announcement'),
    ('Can delete announcement', @ct, 'delete_announcement');

That took 4.66 seconds
##################################################
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.