Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stochastic-thread/caa5fc3921fa83c7e771 to your computer and use it in GitHub Desktop.
Save stochastic-thread/caa5fc3921fa83c7e771 to your computer and use it in GitHub Desktop.
Migration file
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