class ConvertToRealUnicode < ActiveRecord::Migration[5.1] def change change_column :records, :recordable_type, :string, limit: 191 change_column :users, :login, :string, default: "", null: false, limit: 191 change_column :users, :email, :string, default: "", null: false, limit: 191 change_column :users, :reset_password_token, :string, limit: 191 end end git' href='https://git.fourisland.com/thoughts' title='thoughts Git repository'/>
about summary refs log tree commit diff stats
path: root/db/migrate/20180114181813_cache_current_pokemon_revision.pokeviewer.rb
blob: e8f15a8296e9e32036eeb3944c31b1c937c90eda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This migration comes from pokeviewer (originally 20180114170238)
class CacheCurrentPokemonRevision < ActiveRecord::Migration[5.1]
  def up
    change_table :pokeviewer_pokemon do |t|
      t.references :current, null: true
    end

    add_foreign_key :pokeviewer_pokemon, :pokeviewer_revisions,
      column: :current_id

    Pokeviewer::Pokemon.all.each do |p|
      p.current_id = p.revisions.last.id
      p.save!
    end
  end

  def down
    remove_column :pokeviewer_pokemon, :current_id
  end
end