Sha256: 2c5af49f8f57e689c6541ba4de790baaab0fdf179a5b8cf262982215189c65cd
Contents?: true
Size: 544 Bytes
Versions: 3
Compression:
Stored size: 544 Bytes
Contents
class AddSourcesToShopSubscriptions < ActiveRecord::Migration[5.1] def change add_column :disco_app_subscriptions, :source_id, :integer, limit: 8, index: true add_foreign_key :disco_app_subscriptions, :disco_app_sources, column: :source_id DiscoApp::Subscription.where.not(source: nil).find_each do |subscription| DiscoApp::Source.find_or_create_by(source: subscription.source) do |new_source| new_source.name = subscription.source end end remove_column :disco_app_subscriptions, :source end end
Version data entries
3 entries across 3 versions & 1 rubygems