Sha256: 406462e1997e711034d3e8c5b00ab818d6f9843f14be9470e4369a695c986ec2
Contents?: true
Size: 529 Bytes
Versions: 1
Compression:
Stored size: 529 Bytes
Contents
class ReconnectPostTypeToPost < ActiveRecord::Migration[5.0] def change add_column :pulitzer_posts, :post_type_version_id, :integer Pulitzer::Post.reset_column_information Pulitzer::PostType.all.each do |pt| ptv = pt.published_type_version ptv ||= pt.post_type_versions.create(status: 'active') Pulitzer::Post.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id end remove_column :pulitzer_posts, :post_type_id add_index :pulitzer_posts, :post_type_version_id end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pulitzer-0.15.0 | db/migrate/20170515232938_reconnect_post_type_to_post.rb |