Sha256: 680760105a4ed37d9e39259a4a0cfba5c057f8534229f36db8d3a434415cb443
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
class CreateQueryMember < ActiveRecord::Migration def up self.connection.execute %Q(CREATE OR REPLACE VIEW adherent_query_members AS SELECT adherent_members.id, organism_id, number, name, forname, birthdate, adherent_coords.mail AS mail, adherent_coords.tel AS tel, (SELECT to_date FROM adherent_adhesions WHERE adherent_adhesions.member_id = adherent_members.id ORDER BY to_date DESC LIMIT 1 ) AS m_to_date, (SELECT SUM(adherent_reglements.amount) FROM adherent_reglements, adherent_adhesions WHERE adherent_reglements.adhesion_id = adherent_adhesions.id AND adherent_adhesions.member_id = adherent_members.id) AS t_reglements, (SELECT SUM(amount) FROM adherent_adhesions WHERE adherent_adhesions.member_id = adherent_members.id) AS t_adhesions FROM adherent_members LEFT JOIN adherent_coords ON adherent_members.id = adherent_coords.member_id; ) end def down self.connection.execute "DROP VIEW IF EXISTS adherent_query_members" end end
Version data entries
4 entries across 4 versions & 1 rubygems