Merge pull request #466 from AyuntamientoMadrid/hotfix-field-length
Truncates values from the db before shortening them
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
class SetUsernameLimit < ActiveRecord::Migration
|
class SetUsernameLimit < ActiveRecord::Migration
|
||||||
def change
|
def up
|
||||||
|
execute "ALTER TABLE users ALTER COLUMN username TYPE VARCHAR(60) USING SUBSTR(username, 1, 60)"
|
||||||
change_column :users, :username, :string, limit: 60
|
change_column :users, :username, :string, limit: 60
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column :users, :username, :string, limit: nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class RemoveCommentTitle < ActiveRecord::Migration
|
class RemoveCommentTitle < ActiveRecord::Migration
|
||||||
def change
|
def change
|
||||||
remove_column :comments, :title
|
remove_column :comments, :title, :string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
class SetOrganizationNameLimit < ActiveRecord::Migration
|
class SetOrganizationNameLimit < ActiveRecord::Migration
|
||||||
def change
|
def up
|
||||||
|
execute "ALTER TABLE organizations ALTER COLUMN name TYPE VARCHAR(60) USING SUBSTR(name, 1, 60)"
|
||||||
change_column :organizations, :name, :string, limit: 60
|
change_column :organizations, :name, :string, limit: 60
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column :organizations, :name, :string, limit: nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
class SetTagNameLimit < ActiveRecord::Migration
|
class SetTagNameLimit < ActiveRecord::Migration
|
||||||
def change
|
def up
|
||||||
|
execute "ALTER TABLE tags ALTER COLUMN name TYPE VARCHAR(40) USING SUBSTR(name, 1, 40)"
|
||||||
change_column :tags, :name, :string, limit: 40
|
change_column :tags, :name, :string, limit: 40
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column :tags, :name, :string, limit: nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user