diff options
Diffstat (limited to 'priv/repo/migrations')
6 files changed, 73 insertions, 1 deletions
| diff --git a/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs b/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs index 43d616705..bfac09f9e 100644 --- a/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs +++ b/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs @@ -9,7 +9,7 @@ defmodule Pleroma.Repo.Migrations.CreateSafeJsonbSet do      begin        result := jsonb_set(target, path, coalesce(new_value, 'null'::jsonb), create_missing);        if result is NULL then -        raise 'jsonb_set tried to wipe the object, please report this incindent to Pleroma bug tracker. https://git.pleroma.social/pleroma/pleroma/issues/new'; +        raise 'jsonb_set tried to wipe the object, please report this incident to Pleroma bug tracker. https://git.pleroma.social/pleroma/pleroma/issues/new';          return target;        else          return result; diff --git a/priv/repo/migrations/20201221202251_create_hashtags.exs b/priv/repo/migrations/20201221202251_create_hashtags.exs new file mode 100644 index 000000000..afc522002 --- /dev/null +++ b/priv/repo/migrations/20201221202251_create_hashtags.exs @@ -0,0 +1,14 @@ +defmodule Pleroma.Repo.Migrations.CreateHashtags do +  use Ecto.Migration + +  def change do +    create_if_not_exists table(:hashtags) do +      add(:name, :citext, null: false) +      add(:data, :map, default: %{}) + +      timestamps() +    end + +    create_if_not_exists(unique_index(:hashtags, [:name])) +  end +end diff --git a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs new file mode 100644 index 000000000..214ea81c3 --- /dev/null +++ b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs @@ -0,0 +1,13 @@ +defmodule Pleroma.Repo.Migrations.CreateHashtagsObjects do +  use Ecto.Migration + +  def change do +    create_if_not_exists table(:hashtags_objects, primary_key: false) do +      add(:hashtag_id, references(:hashtags), null: false) +      add(:object_id, references(:objects), null: false) +    end + +    create_if_not_exists(unique_index(:hashtags_objects, [:hashtag_id, :object_id])) +    create_if_not_exists(index(:hashtags_objects, [:object_id])) +  end +end diff --git a/priv/repo/migrations/20210105195018_create_data_migrations.exs b/priv/repo/migrations/20210105195018_create_data_migrations.exs new file mode 100644 index 000000000..5f2e8d96c --- /dev/null +++ b/priv/repo/migrations/20210105195018_create_data_migrations.exs @@ -0,0 +1,17 @@ +defmodule Pleroma.Repo.Migrations.CreateDataMigrations do +  use Ecto.Migration + +  def change do +    create_if_not_exists table(:data_migrations) do +      add(:name, :string, null: false) +      add(:state, :integer, default: 1) +      add(:feature_lock, :boolean, default: false) +      add(:params, :map, default: %{}) +      add(:data, :map, default: %{}) + +      timestamps() +    end + +    create_if_not_exists(unique_index(:data_migrations, [:name])) +  end +end diff --git a/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs b/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs new file mode 100644 index 000000000..2a965f075 --- /dev/null +++ b/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs @@ -0,0 +1,14 @@ +defmodule Pleroma.Repo.Migrations.DataMigrationCreatePopulateHashtagsTable do +  use Ecto.Migration + +  def up do +    dt = NaiveDateTime.utc_now() + +    execute( +      "INSERT INTO data_migrations(name, inserted_at, updated_at) " <> +        "VALUES ('populate_hashtags_table', '#{dt}', '#{dt}') ON CONFLICT DO NOTHING;" +    ) +  end + +  def down, do: :ok +end diff --git a/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs b/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs new file mode 100644 index 000000000..ba0be98af --- /dev/null +++ b/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs @@ -0,0 +1,14 @@ +defmodule Pleroma.Repo.Migrations.CreateDataMigrationFailedIds do +  use Ecto.Migration + +  def change do +    create_if_not_exists table(:data_migration_failed_ids, primary_key: false) do +      add(:data_migration_id, references(:data_migrations), null: false) +      add(:record_id, :bigint, null: false) +    end + +    create_if_not_exists( +      unique_index(:data_migration_failed_ids, [:data_migration_id, :record_id]) +    ) +  end +end | 
