Closed Bug 1217631 Opened 9 years ago Closed 9 years ago

The DB schema changes in bug 1182464 were not made against the Heroku RDS instance

Categories

(Tree Management :: Treeherder: Infrastructure, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

In bug 1216153, this is causing:
django.db.utils.ProgrammingError: (1146, "Table 'treeherder.failure_match' doesn't exist")

Mauro, I'm presuming since we can't use migrations for the model, I'll need to manually run the SQL here:

https://github.com/mozilla/treeherder/blob/50172112e4ab8f3b77c81102b2a5aca7bbb5f018/treeherder/model/sql/template_schema/treeherder_reference_1.sql.tmpl#L642-L751

Is this correct?
Flags: needinfo?(mdoglio)
Depends on: 1216153
(In reply to Ed Morley [:emorley] from comment #0)
> In bug 1216153, this is causing:
> django.db.utils.ProgrammingError: (1146, "Table 'treeherder.failure_match'
> doesn't exist")
> 
> Mauro, I'm presuming since we can't use migrations for the model, I'll need
> to manually run the SQL here:
> 
> https://github.com/mozilla/treeherder/blob/
> 50172112e4ab8f3b77c81102b2a5aca7bbb5f018/treeherder/model/sql/
> template_schema/treeherder_reference_1.sql.tmpl#L642-L751
> 
> Is this correct?

Yes that's the correct sql code to run on the treeherder database. I really thought I applied those changes to the heroku instance as well. Sorry about that.
Flags: needinfo?(mdoglio)
Np - thank you :-)

I've run this on Heroku:

CREATE TABLE `failure_line` (
     `id` bigint AUTO_INCREMENT NOT NULL PRIMARY KEY,
     `job_guid` varchar(50) NOT NULL,
     `repository_id` integer NOT NULL,
     `action` varchar(11) NOT NULL,
     `line` integer UNSIGNED NOT NULL,
     `test` longtext NULL,
     `subtest` longtext NULL,
     `status` varchar(7) NOT NULL,
     `expected` varchar(7) NULL,
     `message` longtext NULL,
     `signature` longtext NULL,
     `level` varchar(8) NULL,
     `stack` longtext NULL,
     `stackwalk_stdout` longtext NULL,
     `stackwalk_stderr` longtext NULL,
     `created` datetime NOT NULL,
     `modified` datetime NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `classified_failure` (
    `id` bigint AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `bug_number` integer UNSIGNED NULL,
    `created` datetime NOT NULL,
    `modified` datetime NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;


CREATE TABLE `matcher` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(50) NOT NULL UNIQUE
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `failure_match` (
    `id` bigint AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `score` numeric(3, 2) NULL,
    `is_best` bool NOT NULL,
    `failure_line_id` bigint NOT NULL,
    `classified_failure_id` bigint NOT NULL,
    `matcher_id` integer NOT NULL
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

ALTER TABLE `failure_match` ADD CONSTRAINT `failure_match_failure_line_id_7aeee577_uniq` UNIQUE (`failure_line_id`, `classified_failure_id`, `matcher_id`);
ALTER TABLE `failure_match` ADD CONSTRAINT `failure_match_failure_line_id_66c79baa_fk_failure_id` FOREIGN KEY (`failure_line_id`) REFERENCES `failure_line` (`id`);
CREATE INDEX `failure_match_4b7d144b` ON `failure_match` (`failure_line_id`);
CREATE INDEX `failure_match_3172ccd0` ON `failure_match` (`classified_failure_id`);
ALTER TABLE `failure_match` ADD CONSTRAINT `da2a7f93f2c7705b917a81c5aed77017` FOREIGN KEY (`classified_failure_id`) REFERENCES `classified_failure` (`id`);
CREATE INDEX `failure_match_c724f956` ON `failure_match` (`matcher_id`);
ALTER TABLE `failure_match` ADD CONSTRAINT `failure_match_matcher_id_2c1e8bf2_fk_matcher_id` FOREIGN KEY (`matcher_id`) REFERENCES `matcher` (`id`);

And the migrate now succeeds :-)
Assignee: nobody → emorley
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.