2

我目前正在尝试编写Ecto迁移,以便将表列从VARCHAR(255)type 更改为TEXT. 到目前为止,我没有运气,即使迁移“成功”运行。我甚至在迁移中尝试了原始 SQL:

def change do
  alter table(:my_table) do
    "alter table <my_table> modify <my_column> text"
  end
end

schema_migrations在更改文件以确保它再次运行时,我还手动从表中删除了迁移。

任何提示都将受到欢迎。

更新。

应该更好地阅读文档:

def change do
  alter table(:my_table) do
    modify :my_column, :text
  end
end

它也已在其他地方得到回答,请参阅Gazler 的回复

4

0 回答 0