Sha256: 08b7e8e803ee89be0b3afd8007fd20644f5043fa2c38cf39872d89062da3f7b9

Contents?: true

Size: 1.02 KB

Versions: 82

Compression:

Stored size: 1.02 KB

Contents

class UpdateEventPerformancesViewWithSite < ActiveRecord::Migration
  def up
    execute <<-SQL
      CREATE OR REPLACE VIEW festivity_event_performances AS
        SELECT
          performance.id AS performance_id, performance.start_date, performance.end_date,
          event.id AS event_id, event.title AS event_title, event.short_description, event.buy_url,
          event.featured_item, event.header, event.sub_header, event.site_id, location.id as location_id,
          location.slug AS location_slug, location.title AS location_title, location.festivity_directions_url,
          area.id AS area_id, area.slug as area_slug, area.title AS area_title
        FROM festivity_performances performance
        INNER JOIN pages event
          ON event.id = performance.event_page_id
        INNER JOIN pages location
          ON location.id = performance.location_page_id
        INNER JOIN pages area
          ON area.id = location.parent_id
    SQL

  end

  def down
    execute 'DROP VIEW festivity_event_performances'
  end
end


Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
trusty-festivity-extension-2.6.3 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.6.2 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.6.1 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.6 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.19 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.18 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.17 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.16 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.15 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.14 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.13 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.12 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.11 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.10 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.9 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.8 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.7 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.6 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.5 db/migrate/200150425136087799_update_event_performances_view_with_site.rb
trusty-festivity-extension-2.5.4 db/migrate/200150425136087799_update_event_performances_view_with_site.rb