Sha256: 736e6be7a8aae853ea4fdb58a2702a58bab27dea9e01048cd518292d13206836

Contents?: true

Size: 684 Bytes

Versions: 142

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

class MigrateProposalsCategory < ActiveRecord::Migration[5.1]
  def change
    # Create categorizations ensuring database integrity
    execute('
      INSERT INTO decidim_categorizations(decidim_category_id, categorizable_id, categorizable_type, created_at, updated_at)
        SELECT decidim_category_id, decidim_proposals_proposals.id, \'Decidim::Proposals::Proposal\', NOW(), NOW()
        FROM decidim_proposals_proposals
        INNER JOIN decidim_categories ON decidim_categories.id = decidim_proposals_proposals.decidim_category_id
    ')
    # Remove unused column
    remove_column :decidim_proposals_proposals, :decidim_category_id
  end
end

Version data entries

142 entries across 142 versions & 2 rubygems

Version Path
decidim-proposals-0.25.0.rc4 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.25.0.rc3 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.25.0.rc2 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.25.0.rc1 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.24.3 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.6 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.24.2 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.5 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.24.1 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.24.0 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.24.0.rc2 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.4 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.24.0.rc1 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.3 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.2 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.1 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.1.rc1 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.23.0 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.22.0 db/migrate/20170612101809_migrate_proposals_category.rb
decidim-proposals-0.21.0 db/migrate/20170612101809_migrate_proposals_category.rb