You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When a boolean attribute in a Resource is renamed, the migration code generated by ash.codegen will fail on rollback.
To Reproduce
Create a Resource ResourceX, with attribute :is_authentic, :boolean
mix ash.codegen create_resource_x_table
mix ecto.migrate
Edit the ResourceX file and change the attribute line to attribute :is_spicy, :boolean
mix ash.codegen modify_resource_x_table
mix ecto.migrate
All good up till here
Rollback with mix ecto.rollback -n 1
Fails
Expected behavior
I expect Step 7 above to work. I have added additional information in 2 sections below
Actual Generated Migration Code at Step 5
def up do
rename table(:resource_x), :is_authentic, to: :is_spicy
alter table(:resource_x) do
modify :is_spicy, :boolean
end
end
def down do
alter table(:resource_x) do
modify :is_authentic, :boolean
end
rename table(:resource_x), :is_spicy, to: :is_authentic
end
The sequence for def down is incorrect
Expected/Correct Code
def down do
rename table(:resource_x), :is_spicy, to: :is_authentic
alter table(:resource_x) do
modify :is_authentic, :boolean
end
end
Runtime
Elixir version Elixir 1.17.2 (compiled with Erlang/OTP 27)
Describe the bug
When a boolean attribute in a Resource is renamed, the migration code generated by
ash.codegen
will fail on rollback.To Reproduce
ResourceX
, withattribute :is_authentic, :boolean
mix ash.codegen create_resource_x_table
mix ecto.migrate
attribute :is_spicy, :boolean
mix ash.codegen modify_resource_x_table
mix ecto.migrate
All good up till here
mix ecto.rollback -n 1
Fails
Expected behavior
I expect Step 7 above to work. I have added additional information in 2 sections below
Actual Generated Migration Code at Step 5
The sequence for
def down
is incorrectExpected/Correct Code
Runtime
Elixir version
Elixir 1.17.2 (compiled with Erlang/OTP 27)
Erlang version
27.0.1
Erlang/OTP 27 [erts-15.0.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
OS
Linux prometheus 6.10.4-zen2-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sun, 11 Aug 2024 16:18:46 +0000 x86_64 GNU/Linux
Ash version
any related extension versions
:ash, "3.4.1"
:ash_phoenix, "2.1.1"
:ash_postgres, "2.2.1"
:ash_sql, "0.2.30"
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: