Skip to content

Commit

Permalink
adjust migration 0005 to not do a drop table
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Mar 3, 2023
1 parent 5144293 commit 280e6c4
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ So here we will:
* rename delegations_new -> delegations
*/

ALTER TABLE delegations RENAME TO delegations_deleted_1677807019;

CREATE TABLE
IF NOT EXISTS delegations_new (
IF NOT EXISTS delegations (
cid TEXT NOT NULL PRIMARY KEY,
bytes BLOB NOT NULL,
audience TEXT NOT NULL,
Expand All @@ -23,8 +25,5 @@ CREATE TABLE
UNIQUE (cid)
);

INSERT INTO delegations_new (cid, bytes, audience, issuer, expiration, inserted_at, updated_at)
SELECT cid, bytes, audience, issuer, expiration, inserted_at, updated_at FROM delegations;

DROP TABLE delegations;
ALTER TABLE delegations_new RENAME TO delegations;
INSERT INTO delegations (cid, bytes, audience, issuer, expiration, inserted_at, updated_at)
SELECT cid, bytes, audience, issuer, expiration, inserted_at, updated_at FROM delegations_deleted_1677807019;

0 comments on commit 280e6c4

Please sign in to comment.