2 -- Upgrade script from schema revision 4 to revision 5
\r
5 -- Update schema revision
\r
6 UPDATE FileParams SET Value = '5' WHERE Key = 'SchemaRevision';
\r
8 -- Patch standard rulers with marker characters
\r
9 UPDATE RulerLibrary SET Ruler = "ID*,FirstName,LastName,Gender,City,Status,Owner,Notes,NationalID+,Address+,ZipCode+,HomePhone+,CellPhone+,EMail+,Origin+,School+,ActiveInd+,SignedDahashInd+,CanceledDahashInd+,FullName+" WHERE Name = "StdCandidatesRuler";
\r
10 UPDATE RulerLibrary SET Ruler = "ID*,Name,Type,StartDate,EndDate,ActiveAttendants,Location,Owner,Notes" WHERE Name = "StdEventsRuler";
\r
12 -- Helper view for event attendance
\r
13 CREATE VIEW EventAttendanceHelper AS SELECT
\r
15 E.TypeID AS EventTypeID,
\r
16 ET.Name AS EventType,
\r
18 AT.ActiveInd AS ActiveInd
\r
19 FROM EventAttendance EA
\r
20 JOIN AttendanceTypes AT ON EA.AttTypeID = AT.ID
\r
21 JOIN Events E ON EA.EventID = E.ID
\r
22 JOIN EventTypes ET ON E.TypeID = ET.ID;
\r
24 -- Create the Statistic Report table
\r
25 CREATE TABLE StatisticReports
\r
27 ID INTEGER PRIMARY KEY,
\r
28 Name VARCHAR NOT NULL,
\r
29 Class VARCHAR NOT NULL,
\r
30 Description VARCHAR,
\r
34 CreateDate VARCHAR DEFAULT CURRENT_DATE
\r
37 INSERT INTO StatisticReports (SeqNo, Name, Description, Class, Query, Ruler) VALUES (10,
\r
38 'מועמדים פעילים לפי ישוב',
\r
39 'מספר המועמדים הפעילים המתגוררים בכל ישוב',
\r
40 'negev.giyusit.statistics.PieReport',
\r
41 'select City, count(*) as Total from AllCandidates where ActiveInd = "true" and City is not null group by City order by Total desc',
\r
45 INSERT INTO StatisticReports (SeqNo, Name, Description, Class, Query, Ruler) VALUES (15,
\r
46 'מועמדים פעילים לפי מקור',
\r
47 'מספר המועמדים הפעילים שגויסו מכל מקור',
\r
48 'negev.giyusit.statistics.PieReport',
\r
49 'select Origin, count(*) as Total from AllCandidates where ActiveInd = "true" and Origin is not null group by Origin order by Total desc',
\r
53 INSERT INTO StatisticReports (SeqNo, Name, Description, Class, Query, Ruler) VALUES (20,
\r
55 'מספר המועמדים (ללא קשר לסטטוס) המתגוררים בכל ישוב',
\r
56 'negev.giyusit.statistics.PieReport',
\r
57 'select City, count(*) as Total from Candidates where City is not null group by City order by Total desc',
\r
61 INSERT INTO StatisticReports (SeqNo, Name, Description, Class, Query, Ruler) VALUES (25,
\r
63 'מספר המועמדים (ללא קשר לסטטוס) שגויסו מכל מקור',
\r
64 'negev.giyusit.statistics.PieReport',
\r
65 'select Origin, count(*) as Total from Candidates where Origin is not null group by Origin order by Total desc',
\r
69 INSERT INTO StatisticReports (SeqNo, Name, Description, Class, Query, Ruler) VALUES (30,
\r
71 'סך כל המועמדים שהשתתפו בפועל באירועים מכל סוג',
\r
72 'negev.giyusit.statistics.BarReport',
\r
73 'select EAH.EventType as Type, count(*) as Total from EventAttendanceHelper EAH
\r
74 where EAH.AttTypeID = 4 group by Type order by EAH.EventTypeID',
\r
78 INSERT INTO StatisticReports (SeqNo, Name, Description, Class, Query, Ruler) VALUES (25,
\r
79 'השתתפות באירועים (כולל צפי)',
\r
80 'סך כל המועמדים שהשתתפו או צפויים להשתתף באירועים מכל סוג',
\r
81 'negev.giyusit.statistics.BarReport',
\r
82 'select EAH.EventType as Type, count(*) as Total from EventAttendanceHelper EAH
\r
83 where EAH.ActiveInd = "true" group by Type order by EAH.EventTypeID',
\r