Skip to content

Commit

Permalink
chore: generate_migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Apr 3, 2024
1 parent 56823dc commit b6c1db1
Show file tree
Hide file tree
Showing 16 changed files with 2,205 additions and 0 deletions.
27 changes: 27 additions & 0 deletions priv/repo/migrations/20240403005622_install_5_extensions.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
defmodule AshHq.Repo.Migrations.Install5Extensions20240403005620 do
@moduledoc """
Installs any extensions that are mentioned in the repo's `installed_extensions/0` callback
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""

use Ecto.Migration

def up do
execute("CREATE EXTENSION IF NOT EXISTS \"pg_trgm\"")
execute("CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\"")
execute("CREATE EXTENSION IF NOT EXISTS \"citext\"")
execute("CREATE EXTENSION IF NOT EXISTS \"pg_stat_statements\"")
execute("CREATE EXTENSION IF NOT EXISTS \"sslinfo\"")
end

def down do
# Uncomment this if you actually want to uninstall the extensions
# when this migration is rolled back:
# execute("DROP EXTENSION IF EXISTS \"pg_trgm\"")
# execute("DROP EXTENSION IF EXISTS \"uuid-ossp\"")
# execute("DROP EXTENSION IF EXISTS \"citext\"")
# execute("DROP EXTENSION IF EXISTS \"pg_stat_statements\"")
# execute("DROP EXTENSION IF EXISTS \"sslinfo\"")
end
end
250 changes: 250 additions & 0 deletions priv/repo/migrations/20240403011723_migrate_resources61.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
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
88 changes: 88 additions & 0 deletions priv/resource_snapshots/repo/discord_reactions/20240403011723.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"attributes": [
{
"default": "fragment(\"gen_random_uuid()\")",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"allow_nil?": false,
"generated?": false,
"primary_key?": true
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "count",
"references": null,
"allow_nil?": false,
"generated?": false,
"primary_key?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "emoji",
"references": null,
"allow_nil?": false,
"generated?": false,
"primary_key?": false
},
{
"default": "nil",
"size": null,
"type": "bigint",
"source": "message_id",
"references": {
"name": "discord_reactions_message_id_fkey",
"table": "discord_messages",
"schema": "public",
"on_delete": "delete",
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"primary_key?": true,
"destination_attribute": "id",
"deferrable": false,
"match_type": null,
"match_with": null,
"on_update": "update",
"destination_attribute_default": null,
"destination_attribute_generated": null
},
"allow_nil?": false,
"generated?": false,
"primary_key?": false
}
],
"table": "discord_reactions",
"hash": "7473ECFC71B86E3F780E42DBA157867B900E78DB1DA04FD50A43CDD9CC45D90F",
"repo": "Elixir.AshHq.Repo",
"identities": [
{
"name": "unique_message_emoji",
"keys": [
"emoji",
"message_id"
],
"all_tenants?": false,
"index_name": "discord_reactions_unique_message_emoji_index",
"base_filter": null
}
],
"schema": null,
"multitenancy": {
"global": null,
"attribute": null,
"strategy": null
},
"base_filter": null,
"check_constraints": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true
}
Loading

0 comments on commit b6c1db1

Please sign in to comment.