Closed Bug 1198490 Opened 6 years ago Closed 6 years ago

Add SQL migrations for BMO API keys

Categories

(MozReview Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcote, Unassigned)

References

Details

Attachments

(1 file)

We need to check in the SQL required to migrate to BMO API keys.
mozreview: SQL database migrations for BMO API keys (bug 1198490). r?smacleod

Since database evolutions don't work well for extensions, we'll apply
SQL changes manually.  These hold the modifications necessary for
bug 993233.
Attachment #8652573 - Flags: review?(smacleod)
Comment on attachment 8652573 [details]
MozReview Request: mozreview: SQL database migrations for BMO API keys (bug 1198490). r?smacleod

mozreview: SQL database migrations for BMO API keys (bug 1198490). r?smacleod

Since Django Evolutions don't work well for extensions, we'll apply
SQL changes manually.  These hold the modifications necessary for
bug 993233, as well as a script to clear the Django Evolutions tables and a
general README.
Comment on attachment 8652573 [details]
MozReview Request: mozreview: SQL database migrations for BMO API keys (bug 1198490). r?smacleod

https://reviewboard.mozilla.org/r/17199/#review15363

::: pylib/mozreview/mozreview/migrations/1-create-unverifiedbugzillaapikey.sql:1
(Diff revision 2)
> +CREATE TABLE "mozreview_unverifiedbugzillaapikey" (
> +    "id" integer NOT NULL PRIMARY KEY,
> +    "bmo_username" varchar(255) NOT NULL,
> +    "api_key" varchar(40) NOT NULL,
> +    "timestamp" datetime NOT NULL,
> +    "callback_result" varchar(36) NOT NULL
> +);
> +
> +CREATE INDEX "mozreview_unverifiedbugzillaapikey_index" ON "mozreview_unverifiedbugzillaapikey" ("bmo_username");

mdoglio generated this on a SQL database which gave the result
```
BEGIN;
CREATE TABLE `bugzilla_unverifiedbugzillaapikey` (
  `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
  `bmo_username` varchar(255) NOT NULL,
  `api_key` varchar(40) NOT NULL,
  `timestamp` datetime NOT NULL,
  `callback_result` varchar(36) NOT NULL
);
CREATE INDEX `bugzilla_unverifiedbugzillaapikey_093bd8ef` ON `bugzilla_unverifiedbugzillaapikey` (`bmo_username`);

COMMIT;
```

So I wouldn't trust us doing migrations with sql generated from sqlite.

That being said, as we discussed in person we should probably just leave this migration out and syncdb will take care of the table creation no problem.

::: pylib/mozreview/mozreview/migrations/README:8
(Diff revision 2)
> +commands in clear-evolution-sigs.sql.

Can you also include the fact that we *must* have a database backup before doing stuff like this.
Attachment #8652573 - Flags: review?(smacleod) → review+
http://hg.mozilla.org/hgcustom/version-control-tools/rev/9e927e51392f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Product: Developer Services → MozReview
You need to log in before you can comment on or make changes to this bug.