Created
June 16, 2015 05:01
-
-
Save stochastic-thread/caa5fc3921fa83c7e771 to your computer and use it in GitHub Desktop.
Migration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HelloPhoenix.Repo.Migrations.AddAuthInfoToUsers do | |
use Ecto.Migration | |
def up do | |
""" | |
ALTER TABLE users ADD COLUMN username varchar(200); | |
ALTER TABLE users ADD COLUMN hash varchar(130); | |
ALTER TABLE users ADD COLUMN recovery_hash varchar(130); | |
ALTER TABLE users ADD CONSTRAINT u_constraint UNIQUE (email); | |
""" | |
end | |
def down do | |
""" | |
ALTER TABLE users DROP COLUMN username varchar(200); | |
ALTER TABLE users DROP COLUMN hash varchar(130); | |
ALTER TABLE users DROP COLUMN recovery_hash varchar(130); | |
ALTER TABLE users DROP CONSTRAINT u_constraint UNIQUE (email); | |
""" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment