2018-10-11 17:37:39 +02:00
|
|
|
defmodule Mobilizon.Repo.Migrations.Prerequites do
|
2018-01-13 23:33:03 +01:00
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
2019-02-21 18:11:49 +01: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 16:42:04 +02:00
|
|
|
execute("""
|
2018-01-13 23:33:03 +01:00
|
|
|
CREATE TYPE datetimetz AS (
|
|
|
|
dt timestamptz,
|
|
|
|
tz varchar
|
|
|
|
);
|
2018-07-25 16:42:04 +02:00
|
|
|
""")
|
|
|
|
|
|
|
|
execute("CREATE EXTENSION IF NOT EXISTS postgis")
|
2019-02-21 18:11:49 +01:00
|
|
|
execute("CREATE EXTENSION IF NOT EXISTS pg_trgm")
|
|
|
|
execute("CREATE EXTENSION IF NOT EXISTS unaccent")
|
2018-01-13 23:33:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
2019-02-21 18:11:49 +01: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 16:42:04 +02:00
|
|
|
execute("DROP TYPE IF EXISTS datetimetz;")
|
|
|
|
execute("DROP EXTENSION IF EXISTS postgis")
|
2019-02-21 18:11:49 +01:00
|
|
|
execute("DROP EXTENSION IF EXISTS pg_trgm")
|
|
|
|
execute("DROP EXTENSION IF EXISTS unaccent")
|
2018-01-13 23:33:03 +01:00
|
|
|
end
|
|
|
|
end
|