Migration not keeping varchar size information
Eduardo B. Alexandre:
Not sure if I found a bug or not.
But if I have this attribute in my migration:
attribute :blibs, :string
and then, after generating the first migration, add this:
migration_types blibs: {:varchar, 255}
Ash will generate this migration:
def up do
alter table(:users) do
modify :blibs, :varchar
end
end
def down do
alter table(:users) do
modify :blibs, :text
end
end
This migration doesn’t contain any information about the varchar size in it.
Now, if I actually have both the attribute and the
migration_types
in the resource before the first migration being generated, I will get the correct migration:
def up do
alter table(:users) do
add :blibs, :varchar, size: 255
end
end
def down do
alter table(:users) do
remove :blibs
end
end
zachdaniel:
I think similar to the other issue you want to ignore this field on one of the resources.
Eduardo B. Alexandre:
There is only one resource in this case
zachdaniel:
Oh…interesting
zachdaniel:
Can you make an issue on ash_postgres for this?
zachdaniel:
And ideally a test in the migration generator test illustrating this behavior
Eduardo B. Alexandre:
Done: https://github.com/ash-project/ash_postgres/issues/150