Sha256: 5a5e6d81daf245143b0a619cbddd0a58ab00030e340e15fdfafddb5290f8cb45

Contents?: true

Size: 838 Bytes

Versions: 8

Compression:

Stored size: 838 Bytes

Contents

class AssociateThemeCustomizationsWithSites < ActiveRecord::Migration[5.2]
  def up
    add_reference(:pageflow_theme_customizations, :site)

    execute(<<-SQL)
      UPDATE pageflow_theme_customizations
      LEFT JOIN pageflow_accounts
      ON pageflow_accounts.id = pageflow_theme_customizations.account_id
      SET site_id = pageflow_accounts.default_site_id;
    SQL

    remove_reference(:pageflow_theme_customizations, :account)
  end

  def down
    add_reference(:pageflow_theme_customizations, :account)

    execute(<<-SQL)
      UPDATE pageflow_theme_customizations
      LEFT JOIN pageflow_sites
      ON pageflow_sites.id = pageflow_theme_customizations.site_id
      SET pageflow_theme_customizations.account_id = pageflow_sites.account_id;
    SQL

    remove_reference(:pageflow_theme_customizations, :site)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pageflow-17.0.4 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb
pageflow-17.0.3 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb
pageflow-17.0.2 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb
pageflow-17.0.1 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb
pageflow-17.0.0 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb
pageflow-16.2.0 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb
pageflow-16.1.0 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb
pageflow-16.0.0 db/migrate/20230103155934_associate_theme_customizations_with_sites.rb