闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
420 B

  1. class AddShortcodeToMediaAttachments < ActiveRecord::Migration[5.0]
  2. def up
  3. add_column :media_attachments, :shortcode, :string, null: true, default: nil
  4. add_index :media_attachments, :shortcode, unique: true
  5. # Migrate old links
  6. MediaAttachment.local.update_all('shortcode = id')
  7. end
  8. def down
  9. remove_index :media_attachments, :shortcode
  10. remove_column :media_attachments, :shortcode
  11. end
  12. end