Add migration with extension column to uploads.

This commit is contained in:
Jakub Macina 2017-07-03 19:06:54 +02:00
parent aad1c9bef2
commit bb392973ca
2 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
class AddExtensionToTopicLinks < ActiveRecord::Migration
def change
add_column :topic_links, :extension, :string, limit: 5
add_column :topic_links, :extension, :string, limit: 10
add_index :topic_links, :extension
end
end

View File

@ -0,0 +1,11 @@
class AddExtensionToUploads < ActiveRecord::Migration
def up
add_column :uploads, :extension, :string, limit: 10
execute "CREATE INDEX index_uploads_on_extension ON uploads(lower(extension))"
end
def down
remove_column :uploads, :extension
execute "DROP INDEX index_uploads_on_extension"
end
end