Hold onto user accounts during migration drop

This commit is contained in:
Matthew Dillon 2015-07-14 10:12:01 -08:00
parent 3c790dc9ff
commit c4969084ff
3 changed files with 28 additions and 13 deletions

View file

@ -1,9 +1,6 @@
-- bactdb
-- Matthew R Dillon
-- Need to include something to keep gomigrate happy.
-- SELECT 1;
DROP TABLE users;
DROP TYPE e_roles;

View file

@ -1,17 +1,12 @@
-- bactdb
-- Matthew R Dillon
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'e_roles') THEN
CREATE TYPE e_roles AS ENUM('R', 'W', 'A');
-- 'R': read-only, default
-- 'W': read-write
-- 'A': administrator
END IF;
END$$;
CREATE TYPE e_roles AS ENUM('R', 'W', 'A');
-- 'R': read-only, default
-- 'W': read-write
-- 'A': administrator
CREATE TABLE IF NOT EXISTS users (
CREATE TABLE users (
id BIGSERIAL NOT NULL,
email CHARACTER VARYING(254) NOT NULL UNIQUE,
password CHARACTER(60) NOT NULL,