Sha256: c7af1a2593783ee9c32d9f66f633cf6dc54e5bdf6b3c4d68daa5cc7266812508

Contents?: true

Size: 333 Bytes

Versions: 2

Compression:

Stored size: 333 Bytes

Contents

class NonUserDraftingMigration < Drafting::MIGRATION_BASE_CLASS
  def self.up
    add_column :drafts, :user_type, :string, index: true

    # add in user_type for existing drafts table
    # for migration from old version
    Draft.update_all(user_type: 'User')
  end

  def self.down
    remove_column :drafts, :user_type
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
drafting-0.5.1 lib/generators/drafting/migration/templates/non_user_migration.rb
drafting-0.5.0 lib/generators/drafting/migration/templates/non_user_migration.rb