Add clump migration
parent
bd1392b22b
commit
ba367555e1
|
@ -0,0 +1,17 @@
|
||||||
|
-- +goose Up
|
||||||
|
-- SQL in this section is executed when the migration is applied.
|
||||||
|
|
||||||
|
ALTER TABLE paste RENAME COLUMN title TO filename;
|
||||||
|
CREATE TABLE clump (
|
||||||
|
clumpID SERIAL PRIMARY KEY,
|
||||||
|
title VARCHAR(512),
|
||||||
|
handle uuid UNIQUE
|
||||||
|
);
|
||||||
|
ALTER TABLE paste ADD COLUMN clumpID INTEGER DEFAULT NULL REFERENCES clump(clumpID) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
-- SQL in this section is executed when the migration is rolled back.
|
||||||
|
|
||||||
|
ALTER TABLE paste RENAME COLUMN filename TO paste;
|
||||||
|
ALTER TABLE paste DROP COLUMN clumpID;
|
||||||
|
DROP TABLE clump;
|
Loading…
Reference in New Issue