Sha256: 11d7dfdef8e7a24e5276b46d62157a2e2c0584259d812e0a1cf9fa54bed37859

Contents?: true

Size: 668 Bytes

Versions: 142

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true

class MigrateProjectsCategory < 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_budgets_projects.id, \'Decidim::Budgets::Project\', NOW(), NOW()
        FROM decidim_budgets_projects
        INNER JOIN decidim_categories ON decidim_categories.id = decidim_budgets_projects.decidim_category_id
    ')
    # Remove unused column
    remove_column :decidim_budgets_projects, :decidim_category_id
  end
end

Version data entries

142 entries across 142 versions & 2 rubygems

Version Path
decidim-budgets-0.29.1 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.28.4 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.27.9 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.29.0 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.28.3 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.27.8 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.29.0.rc4 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.29.0.rc3 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.29.0.rc2 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.29.0.rc1 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.28.2 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.27.7 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.28.1 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.27.6 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.26.10 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.26.9 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.28.0 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.27.5 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.28.0.rc5 db/migrate/20170612101846_migrate_projects_category.rb
decidim-budgets-0.28.0.rc4 db/migrate/20170612101846_migrate_projects_category.rb