Skip to content

Commit

Permalink
improvement: support PhoenixHTML 4.0
Browse files Browse the repository at this point in the history
fix: ensure starting state of dropdowns is honored
  • Loading branch information
zachdaniel committed Jan 9, 2024
1 parent 0e86459 commit 92f9997
Show file tree
Hide file tree
Showing 9 changed files with 451 additions and 61 deletions.
39 changes: 39 additions & 0 deletions dev/repo/migrations/20240109001354_migrate_resources2.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
defmodule Demo.Repo.Migrations.MigrateResources2 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
alter table(:users) do
add :type, :text
end

drop_if_exists unique_index(:users, [:first_name, :last_name],
name: "users_representative_name_index"
)

create unique_index(:users, [:id, :first_name, :last_name],
where: "representative = true",
name: "users_representative_name_index"
)
end

def down do
drop_if_exists unique_index(:users, [:id, :first_name, :last_name],
name: "users_representative_name_index"
)

create unique_index(:users, [:id, :first_name, :last_name],
where: "representative = true",
name: "users_representative_name_index"
)

alter table(:users) do
remove :type
end
end
end
23 changes: 23 additions & 0 deletions dev/repo/migrations/20240109001954_migrate_resources3.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule Demo.Repo.Migrations.MigrateResources3 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
alter table(:users) do
modify :type, :text, default: "type1"
add :types, {:array, :text}
end
end

def down do
alter table(:users) do
remove :types
modify :type, :text, default: nil
end
end
end
165 changes: 165 additions & 0 deletions dev/resource_snapshots/repo/users/20240109001354.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"attributes": [
{
"default": "fragment(\"uuid_generate_v4()\")",
"size": null,
"type": "uuid",
"source": "id",
"references": null,
"allow_nil?": false,
"primary_key?": true,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "first_name",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "last_name",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "boolean",
"source": "representative",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "false",
"size": null,
"type": "boolean",
"source": "admin",
"references": null,
"allow_nil?": false,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "api_key",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "date",
"source": "date_of_birth",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "map",
"source": "profile",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": [
"array",
"map"
],
"source": "alternate_profiles",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": "text",
"source": "type",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "nil",
"size": null,
"type": [
"array",
"text"
],
"source": "tags",
"references": null,
"allow_nil?": true,
"primary_key?": false,
"generated?": false
},
{
"default": "fragment(\"now()\")",
"size": null,
"type": "utc_datetime_usec",
"source": "inserted_at",
"references": null,
"allow_nil?": false,
"primary_key?": false,
"generated?": false
},
{
"default": "fragment(\"now()\")",
"size": null,
"type": "utc_datetime_usec",
"source": "updated_at",
"references": null,
"allow_nil?": false,
"primary_key?": false,
"generated?": false
}
],
"table": "users",
"hash": "ABBC7E1B2B4BC0B24C2CBF2C08AFA65AD4A8F2D3FA6659DA9E5B7A5413CA421B",
"repo": "Elixir.Demo.Repo",
"multitenancy": {
"global": true,
"attribute": "id",
"strategy": "attribute"
},
"schema": null,
"check_constraints": [],
"identities": [
{
"name": "representative_name",
"keys": [
"first_name",
"last_name"
],
"base_filter": "representative = true",
"index_name": "users_representative_name_index"
}
],
"custom_indexes": [],
"base_filter": null,
"custom_statements": [],
"has_create_action": true
}
Loading

0 comments on commit 92f9997

Please sign in to comment.