Truncates values from the db before shortening them

This commit is contained in:
kikito
2015-09-10 19:04:57 +02:00
parent 59a99ed874
commit 480a9d6f4e
3 changed files with 3 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
class SetUsernameLimit < ActiveRecord::Migration
def change
execute "ALTER TABLE users ALTER COLUMN username TYPE VARCHAR(60) USING SUBSTR(username, 1, 60)"
change_column :users, :username, :string, limit: 60
end
end

View File

@@ -1,5 +1,6 @@
class SetOrganizationNameLimit < ActiveRecord::Migration
def change
execute "ALTER TABLE organizations ALTER COLUMN name TYPE VARCHAR(60) USING SUBSTR(name, 1, 60)"
change_column :organizations, :name, :string, limit: 60
end
end

View File

@@ -1,5 +1,6 @@
class SetTagNameLimit < ActiveRecord::Migration
def change
execute "ALTER TABLE tags ALTER COLUMN name TYPE VARCHAR(40) USING SUBSTR(name, 1, 40)"
change_column :tags, :name, :string, limit: 40
end
end