summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20220116183110_add_birthday_to_users.exs12
-rw-r--r--priv/repo/migrations/20220125104429_add_birthday_month_day_index_to_users.exs11
2 files changed, 23 insertions, 0 deletions
diff --git a/priv/repo/migrations/20220116183110_add_birthday_to_users.exs b/priv/repo/migrations/20220116183110_add_birthday_to_users.exs
new file mode 100644
index 000000000..0b22ecc69
--- /dev/null
+++ b/priv/repo/migrations/20220116183110_add_birthday_to_users.exs
@@ -0,0 +1,12 @@
+defmodule Pleroma.Repo.Migrations.AddBirthdayToUsers do
+ use Ecto.Migration
+
+ def change do
+ alter table(:users) do
+ add_if_not_exists(:birthday, :date)
+ add_if_not_exists(:show_birthday, :boolean, default: false, null: false)
+ end
+
+ create_if_not_exists(index(:users, [:show_birthday]))
+ end
+end
diff --git a/priv/repo/migrations/20220125104429_add_birthday_month_day_index_to_users.exs b/priv/repo/migrations/20220125104429_add_birthday_month_day_index_to_users.exs
new file mode 100644
index 000000000..8ce4c77c5
--- /dev/null
+++ b/priv/repo/migrations/20220125104429_add_birthday_month_day_index_to_users.exs
@@ -0,0 +1,11 @@
+defmodule Pleroma.Repo.Migrations.AddBirthdayMonthDayIndexToUsers do
+ use Ecto.Migration
+
+ def change do
+ create(
+ index(:users, ["date_part('month', birthday)", "date_part('day', birthday)"],
+ name: :users_birthday_month_day_index
+ )
+ )
+ end
+end