Sha256: deaa21a6c33ed30b5ebb52946b8fc55426a9d43ed5fdf403cd1489ac742dc3b7

Contents?: true

Size: 740 Bytes

Versions: 11

Compression:

Stored size: 740 Bytes

Contents

# The PostgreSQL schema for 2.0.6 differs from the MySQL schema--
# pgsql had articles_categories.primary_item, while mysql had
# articles_categories.is_primary.  More modenen schemas all have is_primary.
# This will break Postgres upgrades from 2.0.6, and apparently it bit #375.

class FixIsPrimaryPostgres < ActiveRecord::Migration
  def self.up
    config = ActiveRecord::Base.configurations
    if not $schema_generator and config[RAILS_ENV]['adapter'] == 'postgres'
      execute "alter table articles_categories rename primary_item to is_primary" rescue nil
    end
  end

  def self.down
    # don't do anything
    # this is a one-way migration, but it's not "irreversable"
    # because it doesn't change any code logic
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
typo-3.99.0 db/migrate/016_fix_is_primary_postgres.rb
typo-3.99.1 db/migrate/016_fix_is_primary_postgres.rb
typo-3.99.3 db/migrate/016_fix_is_primary_postgres.rb
typo-3.99.2 db/migrate/016_fix_is_primary_postgres.rb
typo-4.0.0 db/migrate/016_fix_is_primary_postgres.rb
typo-4.0.2 db/migrate/016_fix_is_primary_postgres.rb
typo-4.0.1 db/migrate/016_fix_is_primary_postgres.rb
typo-3.99.4 db/migrate/016_fix_is_primary_postgres.rb
typo-4.0.3 db/migrate/016_fix_is_primary_postgres.rb
typo-4.1.1 db/migrate/016_fix_is_primary_postgres.rb
typo-4.1 db/migrate/016_fix_is_primary_postgres.rb