ash_hq/priv/repo/migrations/20240403011723_migrate_resources61.exs
2024-04-02 21:17:40 -04:00

250 lines
10 KiB
Elixir

defmodule AshHq.Repo.Migrations.MigrateResources61 do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""
use Ecto.Migration
def up do
drop(constraint("user_tokens", "user_tokens_pkey"))
alter table(:users) do
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :confirmed_at
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:created_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:user_tokens) do
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :jti
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :subject
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :expires_at
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :purpose
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :extra_data
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :created_at
# Attribute removal has been commented out to avoid data loss. See the migration generator documentation for more
# If you uncomment this, be sure to also uncomment the corresponding attribute *addition* in the `down` migration
# remove :updated_at
add(:id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true)
end
alter table(:options) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:modules) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:mix_tasks) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:library_versions) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:libraries) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:guides) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:functions) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:extensions) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:emails) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:dsls) do
modify(:updated_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("(now() AT TIME ZONE 'utc')"))
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
alter table(:discord_reactions) do
modify(:id, :uuid, default: fragment("gen_random_uuid()"))
end
#
#
end
def down do
# Primary key removal is dropped because a corresponding attribute removal
# has been commented out. If you uncomment this, uncomment the attribute removal and vice versa.
# drop constraint("user_tokens", "user_tokens_pkey")
#
alter table(:discord_reactions) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
end
alter table(:dsls) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:emails) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:extensions) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:functions) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:guides) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:libraries) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:library_versions) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:mix_tasks) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:modules) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:options) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:inserted_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
end
alter table(:user_tokens) do
remove(:id)
# This is the `down` migration of the statement:
#
# remove :updated_at
#
# add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
# This is the `down` migration of the statement:
#
# remove :created_at
#
# add :created_at, :utc_datetime_usec, null: false, default: fragment("now()")
# This is the `down` migration of the statement:
#
# remove :extra_data
#
# add :extra_data, :map
# This is the `down` migration of the statement:
#
# remove :purpose
#
# add :purpose, :text, null: false
# This is the `down` migration of the statement:
#
# remove :expires_at
#
# add :expires_at, :utc_datetime, null: false
# This is the `down` migration of the statement:
#
# remove :subject
#
# add :subject, :text, null: false
# This is the `down` migration of the statement:
#
# remove :jti
#
# add :jti, :text, null: false, primary_key: true
end
alter table(:users) do
modify(:id, :uuid, default: fragment("uuid_generate_v4()"))
modify(:created_at, :utc_datetime_usec, default: fragment("now()"))
modify(:updated_at, :utc_datetime_usec, default: fragment("now()"))
# This is the `down` migration of the statement:
#
# remove :confirmed_at
#
# add :confirmed_at, :utc_datetime_usec
end
end
end