From d3c7274f12414025738f6c35542bd995f36e1106 Mon Sep 17 00:00:00 2001 From: Sam Ottenhoff Date: Fri, 2 Sep 2016 16:41:58 -0400 Subject: [PATCH] SAK-31276 remove unnecessary SST keys because composite keys handle (#3283) --- .../conversion/sakai_12_mysql_conversion.sql | 5 +++ .../conversion/sakai_12_oracle_conversion.sql | 5 +++ .../sakai_2_7_0_mysql_conversion.sql | 3 +- .../sakai_2_7_0_oracle_conversion.sql | 3 +- .../sakai_2_8_0_mysql_conversion.sql | 1 - .../sakai_2_8_0_mysql_hbm_indexes.sql | 1 - .../sakai_2_8_0_oracle_conversion.sql | 1 - .../sakai_2_8_0_oracle_hbm_indexes.sql | 1 - .../schema/db-tables/derby/sitestats.sql | 30 ---------------- .../schema/db-tables/hsqldb/sitestats.sql | 2 -- .../schema/db-tables/mssql/sitestats.sql | 28 --------------- .../schema/db-tables/mysql/sitestats.sql | 2 -- .../schema/db-tables/oracle/sitestats.sql | 2 -- .../schema/db-tables/postgres/sitestats.sql | 36 ------------------- .../sitestats/impl/hbm/EventStatImpl.hbm.xml | 2 +- .../impl/hbm/SitePresenceImpl.hbm.xml | 2 +- .../sakaiproject/sitestats/impl/DBHelper.java | 2 -- .../SiteStats_2-x_2-2_db2_conversion.sql | 15 -------- .../SiteStats_2-x_2-2_mysql_conversion.sql | 1 - .../SiteStats_2-x_2-2_oracle_conversion.sql | 1 - 20 files changed, 14 insertions(+), 129 deletions(-) delete mode 100644 sitestats/schema/db-tables/derby/sitestats.sql delete mode 100644 sitestats/schema/db-tables/mssql/sitestats.sql delete mode 100644 sitestats/schema/db-tables/postgres/sitestats.sql delete mode 100644 sitestats/updating/SiteStats_2-x_2-2_db2_conversion.sql diff --git a/reference/docs/conversion/sakai_12_mysql_conversion.sql b/reference/docs/conversion/sakai_12_mysql_conversion.sql index 75168b8bbf65..149b5c75801f 100644 --- a/reference/docs/conversion/sakai_12_mysql_conversion.sql +++ b/reference/docs/conversion/sakai_12_mysql_conversion.sql @@ -196,5 +196,10 @@ ALTER TABLE pasystem_popup_assign DROP COLUMN user_eid; ALTER TABLE pasystem_popup_dismissed DROP COLUMN user_eid; ALTER TABLE pasystem_banner_dismissed DROP COLUMN user_eid; +-- SAK-31276 remove unncecessary keys because there is a composite key that handles this +DROP INDEX SST_PRESENCE_SITE_ID_IX ON SST_PRESENCES; +DROP INDEX SST_EVENTS_USER_ID_IX ON SST_EVENTS; +-- END SAK-31276 + -- #3258 Drop this unused column ALTER TABLE gb_grade_record_t DROP COLUMN user_entered_grade; diff --git a/reference/docs/conversion/sakai_12_oracle_conversion.sql b/reference/docs/conversion/sakai_12_oracle_conversion.sql index 29d6ffc58b54..fbf8f0a5b307 100644 --- a/reference/docs/conversion/sakai_12_oracle_conversion.sql +++ b/reference/docs/conversion/sakai_12_oracle_conversion.sql @@ -209,5 +209,10 @@ ALTER TABLE pasystem_popup_assign DROP COLUMN user_eid; ALTER TABLE pasystem_popup_dismissed DROP COLUMN user_eid; ALTER TABLE pasystem_banner_dismissed DROP COLUMN user_eid; +-- SAK-31276 remove unncecessary keys because there is a composite key that handles this +DROP INDEX SST_PRESENCE_SITE_ID_IX ON SST_PRESENCES; +DROP INDEX SST_EVENTS_USER_ID_IX ON SST_EVENTS; +-- END SAK-31276 + -- #3258 Drop this unused column ALTER TABLE gb_grade_record_t DROP COLUMN user_entered_grade; \ No newline at end of file diff --git a/reference/docs/conversion/sakai_2_7_0_mysql_conversion.sql b/reference/docs/conversion/sakai_2_7_0_mysql_conversion.sql index 65a11667e69c..d12b3aebfb42 100644 --- a/reference/docs/conversion/sakai_2_7_0_mysql_conversion.sql +++ b/reference/docs/conversion/sakai_2_7_0_mysql_conversion.sql @@ -370,7 +370,6 @@ create table SST_RESOURCES (ID bigint not null auto_increment, USER_ID varchar(9 create table SST_SITEACTIVITY (ID bigint not null auto_increment, SITE_ID varchar(99) not null, ACTIVITY_DATE date not null, EVENT_ID varchar(32) not null, ACTIVITY_COUNT bigint not null, primary key (ID)); create table SST_SITEVISITS (ID bigint not null auto_increment, SITE_ID varchar(99) not null, VISITS_DATE date not null, TOTAL_VISITS bigint not null, TOTAL_UNIQUE bigint not null, primary key (ID)); create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); @@ -690,4 +689,4 @@ INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where RE alter table CONTENT_RESOURCE_DELETE CHANGE DELETE_DATE DELETE_DATE DATETIME; -- SAK-17206 -alter table POLL_OPTION add column DELETED bit(1) DEFAULT NULL; \ No newline at end of file +alter table POLL_OPTION add column DELETED bit(1) DEFAULT NULL; diff --git a/reference/docs/conversion/sakai_2_7_0_oracle_conversion.sql b/reference/docs/conversion/sakai_2_7_0_oracle_conversion.sql index 2d795f0bf6a6..06e66dc21115 100644 --- a/reference/docs/conversion/sakai_2_7_0_oracle_conversion.sql +++ b/reference/docs/conversion/sakai_2_7_0_oracle_conversion.sql @@ -369,7 +369,6 @@ create table SST_RESOURCES (ID number(19,0) not null, USER_ID varchar2(99 char) create table SST_SITEACTIVITY (ID number(19,0) not null, SITE_ID varchar2(99 char) not null, ACTIVITY_DATE date not null, EVENT_ID varchar2(32 char) not null, ACTIVITY_COUNT number(19,0) not null, primary key (ID)); create table SST_SITEVISITS (ID number(19,0) not null, SITE_ID varchar2(99 char) not null, VISITS_DATE date not null, TOTAL_VISITS number(19,0) not null, TOTAL_UNIQUE number(19,0) not null, primary key (ID)); create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); @@ -687,4 +686,4 @@ INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where RE -- end SAK-18370 -- SAK-17206 -alter table POLL_OPTION add DELETED number(1,0) DEFAULT NULL; \ No newline at end of file +alter table POLL_OPTION add DELETED number(1,0) DEFAULT NULL; diff --git a/reference/docs/conversion/sakai_2_8_0_mysql_conversion.sql b/reference/docs/conversion/sakai_2_8_0_mysql_conversion.sql index f01b7b4a611b..dc69585a41e7 100644 --- a/reference/docs/conversion/sakai_2_8_0_mysql_conversion.sql +++ b/reference/docs/conversion/sakai_2_8_0_mysql_conversion.sql @@ -292,7 +292,6 @@ create table SST_PRESENCES ( -- SAK-20076: missing Sitestats indexes create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); -- RES-2: table structure for validationaccount_item diff --git a/reference/docs/conversion/sakai_2_8_0_mysql_hbm_indexes.sql b/reference/docs/conversion/sakai_2_8_0_mysql_hbm_indexes.sql index 61061487fec3..8ee88e876dea 100644 --- a/reference/docs/conversion/sakai_2_8_0_mysql_hbm_indexes.sql +++ b/reference/docs/conversion/sakai_2_8_0_mysql_hbm_indexes.sql @@ -43,7 +43,6 @@ create index PROFILE_STATUS_DATE_ADDED_I on PROFILE_STATUS_T (DATE_ADDED); -- SAK-20076 missing Sitestats indexes create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); -- SHORTURL-27 diff --git a/reference/docs/conversion/sakai_2_8_0_oracle_conversion.sql b/reference/docs/conversion/sakai_2_8_0_oracle_conversion.sql index 2beada900361..fd4d087676ef 100644 --- a/reference/docs/conversion/sakai_2_8_0_oracle_conversion.sql +++ b/reference/docs/conversion/sakai_2_8_0_oracle_conversion.sql @@ -302,7 +302,6 @@ create sequence SST_PRESENCE_ID; -- SAK-20076: missing Sitestats indexes create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); -- KNL-563: dynamic bundling loading diff --git a/reference/docs/conversion/sakai_2_8_0_oracle_hbm_indexes.sql b/reference/docs/conversion/sakai_2_8_0_oracle_hbm_indexes.sql index 430f87c0899f..462365079965 100644 --- a/reference/docs/conversion/sakai_2_8_0_oracle_hbm_indexes.sql +++ b/reference/docs/conversion/sakai_2_8_0_oracle_hbm_indexes.sql @@ -43,7 +43,6 @@ create index PROFILE_STATUS_DATE_ADDED_I on PROFILE_STATUS_T (DATE_ADDED); -- SAK-20076 missing Sitestats indexes create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); -- SHORTURL-27 diff --git a/sitestats/schema/db-tables/derby/sitestats.sql b/sitestats/schema/db-tables/derby/sitestats.sql deleted file mode 100644 index e48a5800d5be..000000000000 --- a/sitestats/schema/db-tables/derby/sitestats.sql +++ /dev/null @@ -1,30 +0,0 @@ -create table SST_EVENTS (ID bigint not null, USER_ID varchar(99) not null, SITE_ID varchar(99) not null, EVENT_ID varchar(32) not null, EVENT_DATE date not null, EVENT_COUNT bigint not null, primary key (ID)); -create table SST_JOB_RUN (ID bigint not null, JOB_START_DATE timestamp, JOB_END_DATE timestamp, START_EVENT_ID bigint, END_EVENT_ID bigint, LAST_EVENT_DATE timestamp, primary key (ID)); -create table SST_PREFERENCES (ID bigint not null, SITE_ID varchar(99) not null, PREFS clob(255) not null, primary key (ID)); -create table SST_PRESENCES (ID bigint not null, SITE_ID varchar(99) not null, USER_ID varchar(99) not null, P_DATE date not null, DURATION bigint default 0 not null, LAST_VISIT_START_TIME timestamp default null, primary key (ID)); -create table SST_REPORTS (ID bigint not null, SITE_ID varchar(99), TITLE varchar(255) not null, DESCRIPTION clob(2147483647), HIDDEN smallint, REPORT_DEF clob(255) not null, CREATED_BY varchar(99) not null, CREATED_ON timestamp not null, MODIFIED_BY varchar(99), MODIFIED_ON timestamp, primary key (ID)); -create table SST_RESOURCES (ID bigint not null, USER_ID varchar(99) not null, SITE_ID varchar(99) not null, RESOURCE_REF varchar(255) not null, RESOURCE_ACTION varchar(12) not null, RESOURCE_DATE date not null, RESOURCE_COUNT bigint not null, primary key (ID)); -create table SST_SITEACTIVITY (ID bigint not null, SITE_ID varchar(99) not null, ACTIVITY_DATE date not null, EVENT_ID varchar(32) not null, ACTIVITY_COUNT bigint not null, primary key (ID)); -create table SST_SITEVISITS (ID bigint not null, SITE_ID varchar(99) not null, VISITS_DATE date not null, TOTAL_VISITS bigint not null, TOTAL_UNIQUE bigint not null, primary key (ID)); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); -create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); -create index SST_EVENTS_SITEEVENTUSER_ID_IX on SST_EVENTS (USER_ID, SITE_ID, EVENT_ID); -create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); -create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); -create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); -create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); -create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); -create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); -create index SST_REPORTS_SITE_ID_IX on SST_REPORTS (SITE_ID); -create index SST_RESOURCES_USER_ID_IX on SST_RESOURCES (USER_ID); -create index SST_RESOURCES_SITE_ID_IX on SST_RESOURCES (SITE_ID); -create index SST_RESOURCES_RES_ACT_IDX on SST_RESOURCES (RESOURCE_ACTION); -create index SST_RESOURCES_DATE_IX on SST_RESOURCES (RESOURCE_DATE); -create index SST_SITEACTIVITY_EVENT_ID_IX on SST_SITEACTIVITY (EVENT_ID); -create index SST_SITEACTIVITY_DATE_IX on SST_SITEACTIVITY (ACTIVITY_DATE); -create index SST_SITEACTIVITY_SITE_ID_IX on SST_SITEACTIVITY (SITE_ID); -create index SST_SITEVISITS_DATE_IX on SST_SITEVISITS (VISITS_DATE); -create index SST_SITEVISITS_SITE_ID_IX on SST_SITEVISITS (SITE_ID); -create table hibernate_unique_key ( next_hi integer ); -insert into hibernate_unique_key values ( 0 ); diff --git a/sitestats/schema/db-tables/hsqldb/sitestats.sql b/sitestats/schema/db-tables/hsqldb/sitestats.sql index c3ed4ccf28f6..6c33f2ae9b48 100644 --- a/sitestats/schema/db-tables/hsqldb/sitestats.sql +++ b/sitestats/schema/db-tables/hsqldb/sitestats.sql @@ -6,7 +6,6 @@ create table SST_REPORTS (ID bigint generated by default as identity (start with create table SST_RESOURCES (ID bigint generated by default as identity (start with 1), USER_ID varchar(99) not null, SITE_ID varchar(99) not null, RESOURCE_REF varchar(255) not null, RESOURCE_ACTION varchar(12) not null, RESOURCE_DATE date not null, RESOURCE_COUNT bigint not null, primary key (ID)); create table SST_SITEACTIVITY (ID bigint generated by default as identity (start with 1), SITE_ID varchar(99) not null, ACTIVITY_DATE date not null, EVENT_ID varchar(32) not null, ACTIVITY_COUNT bigint not null, primary key (ID)); create table SST_SITEVISITS (ID bigint generated by default as identity (start with 1), SITE_ID varchar(99) not null, VISITS_DATE date not null, TOTAL_VISITS bigint not null, TOTAL_UNIQUE bigint not null, primary key (ID)); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); create index SST_EVENTS_SITEEVENTUSER_ID_IX on SST_EVENTS (USER_ID, SITE_ID, EVENT_ID); create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); @@ -14,7 +13,6 @@ create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); create index SST_REPORTS_SITE_ID_IX on SST_REPORTS (SITE_ID); create index SST_RESOURCES_USER_ID_IX on SST_RESOURCES (USER_ID); diff --git a/sitestats/schema/db-tables/mssql/sitestats.sql b/sitestats/schema/db-tables/mssql/sitestats.sql deleted file mode 100644 index 857fe83b8b62..000000000000 --- a/sitestats/schema/db-tables/mssql/sitestats.sql +++ /dev/null @@ -1,28 +0,0 @@ -create table SST_EVENTS (ID numeric(19,0) identity not null, USER_ID varchar(99) not null, SITE_ID varchar(99) not null, EVENT_ID varchar(32) not null, EVENT_DATE datetime not null, EVENT_COUNT numeric(19,0) not null, primary key (ID)); -create table SST_JOB_RUN (ID numeric(19,0) identity not null, JOB_START_DATE datetime null, JOB_END_DATE datetime null, START_EVENT_ID numeric(19,0) null, END_EVENT_ID numeric(19,0) null, LAST_EVENT_DATE datetime null, primary key (ID)); -create table SST_PREFERENCES (ID numeric(19,0) identity not null, SITE_ID varchar(99) not null, PREFS text not null, primary key (ID)); -create table SST_PRESENCES (ID numeric(19,0) identity not null, SITE_ID varchar(99) not null, USER_ID varchar(99) not null, P_DATE datetime not null, DURATION numeric(19,0) default 0 not null, LAST_VISIT_START_TIME datetime default null null, primary key (ID)); -create table SST_REPORTS (ID numeric(19,0) identity not null, SITE_ID varchar(99) null, TITLE varchar(255) not null, DESCRIPTION text null, HIDDEN tinyint null, REPORT_DEF text not null, CREATED_BY varchar(99) not null, CREATED_ON datetime not null, MODIFIED_BY varchar(99) null, MODIFIED_ON datetime null, primary key (ID)); -create table SST_RESOURCES (ID numeric(19,0) identity not null, USER_ID varchar(99) not null, SITE_ID varchar(99) not null, RESOURCE_REF varchar(255) not null, RESOURCE_ACTION varchar(12) not null, RESOURCE_DATE datetime not null, RESOURCE_COUNT numeric(19,0) not null, primary key (ID)); -create table SST_SITEACTIVITY (ID numeric(19,0) identity not null, SITE_ID varchar(99) not null, ACTIVITY_DATE datetime not null, EVENT_ID varchar(32) not null, ACTIVITY_COUNT numeric(19,0) not null, primary key (ID)); -create table SST_SITEVISITS (ID numeric(19,0) identity not null, SITE_ID varchar(99) not null, VISITS_DATE datetime not null, TOTAL_VISITS numeric(19,0) not null, TOTAL_UNIQUE numeric(19,0) not null, primary key (ID)); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); -create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); -create index SST_EVENTS_SITEEVENTUSER_ID_IX on SST_EVENTS (USER_ID, SITE_ID, EVENT_ID); -create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); -create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); -create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); -create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); -create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); -create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); -create index SST_REPORTS_SITE_ID_IX on SST_REPORTS (SITE_ID); -create index SST_RESOURCES_USER_ID_IX on SST_RESOURCES (USER_ID); -create index SST_RESOURCES_SITE_ID_IX on SST_RESOURCES (SITE_ID); -create index SST_RESOURCES_RES_ACT_IDX on SST_RESOURCES (RESOURCE_ACTION); -create index SST_RESOURCES_DATE_IX on SST_RESOURCES (RESOURCE_DATE); -create index SST_SITEACTIVITY_EVENT_ID_IX on SST_SITEACTIVITY (EVENT_ID); -create index SST_SITEACTIVITY_DATE_IX on SST_SITEACTIVITY (ACTIVITY_DATE); -create index SST_SITEACTIVITY_SITE_ID_IX on SST_SITEACTIVITY (SITE_ID); -create index SST_SITEVISITS_DATE_IX on SST_SITEVISITS (VISITS_DATE); -create index SST_SITEVISITS_SITE_ID_IX on SST_SITEVISITS (SITE_ID); diff --git a/sitestats/schema/db-tables/mysql/sitestats.sql b/sitestats/schema/db-tables/mysql/sitestats.sql index a1c020ccbb6c..355585c071ba 100644 --- a/sitestats/schema/db-tables/mysql/sitestats.sql +++ b/sitestats/schema/db-tables/mysql/sitestats.sql @@ -6,7 +6,6 @@ create table SST_REPORTS (ID bigint not null auto_increment, SITE_ID varchar(99) create table SST_RESOURCES (ID bigint not null auto_increment, USER_ID varchar(99) not null, SITE_ID varchar(99) not null, RESOURCE_REF varchar(255) not null, RESOURCE_ACTION varchar(12) not null, RESOURCE_DATE date not null, RESOURCE_COUNT bigint not null, primary key (ID)); create table SST_SITEACTIVITY (ID bigint not null auto_increment, SITE_ID varchar(99) not null, ACTIVITY_DATE date not null, EVENT_ID varchar(32) not null, ACTIVITY_COUNT bigint not null, primary key (ID)); create table SST_SITEVISITS (ID bigint not null auto_increment, SITE_ID varchar(99) not null, VISITS_DATE date not null, TOTAL_VISITS bigint not null, TOTAL_UNIQUE bigint not null, primary key (ID)); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); create index SST_EVENTS_SITEEVENTUSER_ID_IX on SST_EVENTS (USER_ID, SITE_ID, EVENT_ID); create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); @@ -14,7 +13,6 @@ create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); create index SST_REPORTS_SITE_ID_IX on SST_REPORTS (SITE_ID); create index SST_RESOURCES_USER_ID_IX on SST_RESOURCES (USER_ID); diff --git a/sitestats/schema/db-tables/oracle/sitestats.sql b/sitestats/schema/db-tables/oracle/sitestats.sql index 1eaf9593188a..aaece2ef0d3e 100644 --- a/sitestats/schema/db-tables/oracle/sitestats.sql +++ b/sitestats/schema/db-tables/oracle/sitestats.sql @@ -6,7 +6,6 @@ create table SST_REPORTS (ID number(19,0) not null, SITE_ID varchar2(99 char), T create table SST_RESOURCES (ID number(19,0) not null, USER_ID varchar2(99 char) not null, SITE_ID varchar2(99 char) not null, RESOURCE_REF varchar2(255 char) not null, RESOURCE_ACTION varchar2(12 char) not null, RESOURCE_DATE date not null, RESOURCE_COUNT number(19,0) not null, primary key (ID)); create table SST_SITEACTIVITY (ID number(19,0) not null, SITE_ID varchar2(99 char) not null, ACTIVITY_DATE date not null, EVENT_ID varchar2(32 char) not null, ACTIVITY_COUNT number(19,0) not null, primary key (ID)); create table SST_SITEVISITS (ID number(19,0) not null, SITE_ID varchar2(99 char) not null, VISITS_DATE date not null, TOTAL_VISITS number(19,0) not null, TOTAL_UNIQUE number(19,0) not null, primary key (ID)); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); create index SST_EVENTS_SITEEVENTUSER_ID_IX on SST_EVENTS (USER_ID, SITE_ID, EVENT_ID); create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); @@ -14,7 +13,6 @@ create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); create index SST_REPORTS_SITE_ID_IX on SST_REPORTS (SITE_ID); create index SST_RESOURCES_USER_ID_IX on SST_RESOURCES (USER_ID); diff --git a/sitestats/schema/db-tables/postgres/sitestats.sql b/sitestats/schema/db-tables/postgres/sitestats.sql deleted file mode 100644 index 0d4d66603781..000000000000 --- a/sitestats/schema/db-tables/postgres/sitestats.sql +++ /dev/null @@ -1,36 +0,0 @@ -create table SST_EVENTS (ID int8 not null, USER_ID varchar(99) not null, SITE_ID varchar(99) not null, EVENT_ID varchar(32) not null, EVENT_DATE date not null, EVENT_COUNT int8 not null, primary key (ID)); -create table SST_JOB_RUN (ID int8 not null, JOB_START_DATE timestamp, JOB_END_DATE timestamp, START_EVENT_ID int8, END_EVENT_ID int8, LAST_EVENT_DATE timestamp, primary key (ID)); -create table SST_PREFERENCES (ID int8 not null, SITE_ID varchar(99) not null, PREFS text not null, primary key (ID)); -create table SST_PRESENCES (ID int8 not null, SITE_ID varchar(99) not null, USER_ID varchar(99) not null, DATE date not null, DURATION int8 default 0 not null, LAST_VISIT_START_TIME timestamp default null, primary key (ID)); -create table SST_REPORTS (ID int8 not null, SITE_ID varchar(99), TITLE varchar(255) not null, DESCRIPTION text, HIDDEN bool, REPORT_DEF text not null, CREATED_BY varchar(99) not null, CREATED_ON timestamp not null, MODIFIED_BY varchar(99), MODIFIED_ON timestamp, primary key (ID)); -create table SST_RESOURCES (ID int8 not null, USER_ID varchar(99) not null, SITE_ID varchar(99) not null, RESOURCE_REF varchar(255) not null, RESOURCE_ACTION varchar(12) not null, RESOURCE_DATE date not null, RESOURCE_COUNT int8 not null, primary key (ID)); -create table SST_SITEACTIVITY (ID int8 not null, SITE_ID varchar(99) not null, ACTIVITY_DATE date not null, EVENT_ID varchar(32) not null, ACTIVITY_COUNT int8 not null, primary key (ID)); -create table SST_SITEVISITS (ID int8 not null, SITE_ID varchar(99) not null, VISITS_DATE date not null, TOTAL_VISITS int8 not null, TOTAL_UNIQUE int8 not null, primary key (ID)); -create index SST_EVENTS_USER_ID_IX on SST_EVENTS (USER_ID); -create index SST_EVENTS_SITE_ID_IX on SST_EVENTS (SITE_ID); -create index SST_EVENTS_SITEEVENTUSER_ID_IX on SST_EVENTS (USER_ID, SITE_ID, EVENT_ID); -create index SST_EVENTS_EVENT_ID_IX on SST_EVENTS (EVENT_ID); -create index SST_EVENTS_DATE_IX on SST_EVENTS (EVENT_DATE); -create index SST_PREFERENCES_SITE_ID_IX on SST_PREFERENCES (SITE_ID); -create index SST_PRESENCE_DATE_IX on SST_PRESENCES (DATE); -create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); -create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, DATE); -create index SST_REPORTS_SITE_ID_IX on SST_REPORTS (SITE_ID); -create index SST_RESOURCES_USER_ID_IX on SST_RESOURCES (USER_ID); -create index SST_RESOURCES_SITE_ID_IX on SST_RESOURCES (SITE_ID); -create index SST_RESOURCES_RES_ACT_IDX on SST_RESOURCES (RESOURCE_ACTION); -create index SST_RESOURCES_DATE_IX on SST_RESOURCES (RESOURCE_DATE); -create index SST_SITEACTIVITY_EVENT_ID_IX on SST_SITEACTIVITY (EVENT_ID); -create index SST_SITEACTIVITY_DATE_IX on SST_SITEACTIVITY (ACTIVITY_DATE); -create index SST_SITEACTIVITY_SITE_ID_IX on SST_SITEACTIVITY (SITE_ID); -create index SST_SITEVISITS_DATE_IX on SST_SITEVISITS (VISITS_DATE); -create index SST_SITEVISITS_SITE_ID_IX on SST_SITEVISITS (SITE_ID); -create sequence SST_EVENTS_ID; -create sequence SST_JOB_RUN_ID; -create sequence SST_PREFERENCES_ID; -create sequence SST_PRESENCE_ID; -create sequence SST_REPORTS_ID; -create sequence SST_RESOURCES_ID; -create sequence SST_SITEACTIVITY_ID; -create sequence SST_SITEVISITS_ID; diff --git a/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/EventStatImpl.hbm.xml b/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/EventStatImpl.hbm.xml index e154d7b7efec..02c499081613 100644 --- a/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/EventStatImpl.hbm.xml +++ b/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/EventStatImpl.hbm.xml @@ -11,7 +11,7 @@ SST_EVENTS_ID - + diff --git a/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/SitePresenceImpl.hbm.xml b/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/SitePresenceImpl.hbm.xml index 1f9718fc379a..c804742f56f9 100644 --- a/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/SitePresenceImpl.hbm.xml +++ b/sitestats/sitestats-impl-hib/src/java/org/sakaiproject/sitestats/impl/hbm/SitePresenceImpl.hbm.xml @@ -11,7 +11,7 @@ SST_PRESENCE_ID - + diff --git a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java index f5e29f9d9786..552095bf6961 100644 --- a/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java +++ b/sitestats/sitestats-impl/src/java/org/sakaiproject/sitestats/impl/DBHelper.java @@ -142,8 +142,6 @@ public Object doInHibernate(Session session) throws HibernateException, SQLExcep // SST_EVENTS if(sstEventsIxs.contains("SITE_ID_IX")) renameIndex(c, "SITE_ID_IX", "SST_EVENTS_SITE_ID_IX", "SITE_ID", "SST_EVENTS"); else if(!sstEventsIxs.contains("SST_EVENTS_SITE_ID_IX")) createIndex(c, "SST_EVENTS_SITE_ID_IX", "SITE_ID", "SST_EVENTS"); - if(sstEventsIxs.contains("USER_ID_IX")) renameIndex(c, "USER_ID_IX", "SST_EVENTS_USER_ID_IX", "USER_ID", "SST_EVENTS"); - else if(!sstEventsIxs.contains("SST_EVENTS_USER_ID_IX")) createIndex(c, "SST_EVENTS_USER_ID_IX", "USER_ID", "SST_EVENTS"); if(sstEventsIxs.contains("EVENT_ID_IX")) renameIndex(c, "EVENT_ID_IX", "SST_EVENTS_EVENT_ID_IX", "EVENT_ID", "SST_EVENTS"); else if(!sstEventsIxs.contains("SST_EVENTS_EVENT_ID_IX")) createIndex(c, "SST_EVENTS_EVENT_ID_IX", "EVENT_ID", "SST_EVENTS"); if(sstEventsIxs.contains("DATE_ID_IX")) renameIndex(c, "DATE_ID_IX", "SST_EVENTS_DATE_ID_IX", "EVENT_DATE", "SST_EVENTS"); diff --git a/sitestats/updating/SiteStats_2-x_2-2_db2_conversion.sql b/sitestats/updating/SiteStats_2-x_2-2_db2_conversion.sql deleted file mode 100644 index 2795d04732d8..000000000000 --- a/sitestats/updating/SiteStats_2-x_2-2_db2_conversion.sql +++ /dev/null @@ -1,15 +0,0 @@ --- This is the DB2 SiteStats 2.x -> 2.2 conversion script ----------------------------------------------------------------------------------------------------------------------------------------- --- --- Run this before you run your first app server with the updated SiteStats. --- auto.ddl does not need to be enabled in your app server - this script takes care of all new TABLEs, changed TABLEs, and changed data. --- ----------------------------------------------------------------------------------------------------------------------------------------- - - --- STAT-241: Tracking of time spent in site -create table SST_PRESENCES (ID bigint generated by default as identity, SITE_ID varchar(99) not null, USER_ID varchar(99) not null, P_DATE date not null, DURATION bigint default 0 not null, LAST_VISIT_START_TIME timestamp default null, primary key (ID)); -create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); -create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); -create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); diff --git a/sitestats/updating/SiteStats_2-x_2-2_mysql_conversion.sql b/sitestats/updating/SiteStats_2-x_2-2_mysql_conversion.sql index ecbf16183ae3..5155f2ecd619 100644 --- a/sitestats/updating/SiteStats_2-x_2-2_mysql_conversion.sql +++ b/sitestats/updating/SiteStats_2-x_2-2_mysql_conversion.sql @@ -11,5 +11,4 @@ create table SST_PRESENCES (ID bigint not null auto_increment, SITE_ID varchar(99) not null, USER_ID varchar(99) not null, P_DATE date not null, DURATION bigint default 0 not null, LAST_VISIT_START_TIME datetime default null, primary key (ID)); create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); diff --git a/sitestats/updating/SiteStats_2-x_2-2_oracle_conversion.sql b/sitestats/updating/SiteStats_2-x_2-2_oracle_conversion.sql index 79c25c4fe35c..ff60ab00494b 100644 --- a/sitestats/updating/SiteStats_2-x_2-2_oracle_conversion.sql +++ b/sitestats/updating/SiteStats_2-x_2-2_oracle_conversion.sql @@ -11,7 +11,6 @@ create table SST_PRESENCES (ID number(19,0) not null, SITE_ID varchar2(99 char) not null, USER_ID varchar2(99 char) not null, P_DATE date not null, DURATION number(19,0) default 0 not null, LAST_VISIT_START_TIME timestamp default null, primary key (ID)); create index SST_PRESENCE_DATE_IX on SST_PRESENCES (P_DATE); create index SST_PRESENCE_USER_ID_IX on SST_PRESENCES (USER_ID); -create index SST_PRESENCE_SITE_ID_IX on SST_PRESENCES (SITE_ID); create index SST_PRESENCE_SUD_ID_IX on SST_PRESENCES (SITE_ID, USER_ID, P_DATE); -- STAT-286: missing SiteStats sequence