Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
667B

  1. defmodule Pleroma.Repo.Migrations.ChangeAppsScopesToVarcharArray do
  2. use Ecto.Migration
  3. @alter_apps_scopes "ALTER TABLE apps ALTER COLUMN scopes"
  4. def up do
  5. execute(
  6. "#{@alter_apps_scopes} TYPE varchar(255)[] USING string_to_array(scopes, ',')::varchar(255)[];"
  7. )
  8. execute("#{@alter_apps_scopes} SET DEFAULT ARRAY[]::character varying[];")
  9. execute("#{@alter_apps_scopes} SET NOT NULL;")
  10. end
  11. def down do
  12. execute("#{@alter_apps_scopes} DROP NOT NULL;")
  13. execute("#{@alter_apps_scopes} DROP DEFAULT;")
  14. execute(
  15. "#{@alter_apps_scopes} TYPE varchar(255) USING array_to_string(scopes, ',')::varchar(255);"
  16. )
  17. end
  18. end