mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
We have a couple of examples of enormous amounts of text being entered in the name column of bookmarks. This is not desirable...it is just meant to be a short note / reminder of why you bookmarked this. This PR caps the column at 100 characters and truncates existing names in the database to 100 characters.
13 lines
349 B
Ruby
13 lines
349 B
Ruby
# frozen_string_literal: true
|
|
|
|
class CapBookmarkNameAt100Characters < ActiveRecord::Migration[6.0]
|
|
def up
|
|
DB.exec("UPDATE bookmarks SET name = LEFT(name, 100) WHERE name IS NOT NULL AND name <> LEFT(name, 100)")
|
|
change_column :bookmarks, :name, :string, limit: 100
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|