Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Alter column length on migration for PostgreSQL db fails due to incorrect syntax #42

@connectedtrips

Description

@connectedtrips

My migration looks like:

migration 1, :modify_url_length do
up do
modify_table :hotels do
change_column :url, String, :length => 1..255
end
end

down do
modify_table :hotels do
change_column :url, String, :length => 1..255
end
end
end

However, the migration fails with the error: ERROR: syntax error at or near "VARCHAR".

Seems to me that the SQL being ran is:

ALTER TABLE "hotels" ALTER COLUMN "url" VARCHAR(1 AND 255)

when it needs to be

ALTER TABLE "hotels" ALTER COLUMN "url" TYPE VARCHAR(1 AND 255)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions