2018-10-11 15:37:39 +00:00
|
|
|
defmodule Mobilizon.Repo.Migrations.Prerequites do
|
2018-01-13 22:33:03 +00:00
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
2019-02-21 17:11:49 +00:00
|
|
|
IO.puts("\n
|
|
|
|
#########################################################
|
|
|
|
# If the CREATE EXTENSION or DROP EXTENSION calls fail, #
|
|
|
|
# please manually execute them with an authorized #
|
|
|
|
# PostgreSQL user with SUPER USER role. #
|
|
|
|
#########################################################
|
|
|
|
\n
|
|
|
|
")
|
|
|
|
|
2018-07-25 14:42:04 +00:00
|
|
|
execute("""
|
2018-01-13 22:33:03 +00:00
|
|
|
CREATE TYPE datetimetz AS (
|
|
|
|
dt timestamptz,
|
|
|
|
tz varchar
|
|
|
|
);
|
2018-07-25 14:42:04 +00:00
|
|
|
""")
|
|
|
|
|
|
|
|
execute("CREATE EXTENSION IF NOT EXISTS postgis")
|
2019-02-21 17:11:49 +00:00
|
|
|
execute("CREATE EXTENSION IF NOT EXISTS pg_trgm")
|
|
|
|
execute("CREATE EXTENSION IF NOT EXISTS unaccent")
|
2018-01-13 22:33:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
2019-02-21 17:11:49 +00:00
|
|
|
IO.puts("\n
|
|
|
|
#########################################################
|
|
|
|
# If the CREATE EXTENSION or DROP EXTENSION calls fail, #
|
|
|
|
# please manually execute them with an authorized #
|
|
|
|
# PostgreSQL user with SUPER USER role. #
|
|
|
|
#########################################################
|
|
|
|
\n
|
|
|
|
")
|
|
|
|
|
2018-07-25 14:42:04 +00:00
|
|
|
execute("DROP TYPE IF EXISTS datetimetz;")
|
|
|
|
execute("DROP EXTENSION IF EXISTS postgis")
|
2019-02-21 17:11:49 +00:00
|
|
|
execute("DROP EXTENSION IF EXISTS pg_trgm")
|
|
|
|
execute("DROP EXTENSION IF EXISTS unaccent")
|
2018-01-13 22:33:03 +00:00
|
|
|
end
|
|
|
|
end
|