diff --git a/R/Analyses.R b/R/Analyses.R index 018603b5..afe3e8fe 100644 --- a/R/Analyses.R +++ b/R/Analyses.R @@ -210,7 +210,8 @@ createOutcome <- function(outcomeId, riskWindowEnd = NULL, endAnchor = NULL) { errorMessages <- checkmate::makeAssertCollection() - checkmate::assertInt(outcomeId, add = errorMessages) + checkmate::assertNumeric(outcomeId, add = errorMessages) + checkmate::assertTRUE(all(outcomeId %% 1 == 0), add = errorMessages) checkmate::assertLogical(outcomeOfInterest, add = errorMessages) checkmate::assertNumeric(trueEffectSize, len = 1, null.ok = TRUE, add = errorMessages) checkmate::assertInt(riskWindowStart, null.ok = TRUE, add = errorMessages) @@ -259,8 +260,9 @@ createTargetComparatorOutcomes <- function(targetId, excludedCovariateConceptIds = c(), includedCovariateConceptIds = c()) { errorMessages <- checkmate::makeAssertCollection() - checkmate::assertInt(targetId, add = errorMessages) - checkmate::assertInt(comparatorId, add = errorMessages) + checkmate::assertNumeric(targetId, add = errorMessages) + checkmate::assertNumeric(comparatorId, add = errorMessages) + checkmate::assertTRUE(all(c(targetId, comparatorId) %% 1 == 0), add = errorMessages) checkmate::assertList(outcomes, min.len = 1, add = errorMessages) for (i in seq_along(outcomes)) { checkmate::assertClass(outcomes[[i]], "outcome", add = errorMessages) diff --git a/R/DataLoadingSaving.R b/R/DataLoadingSaving.R index e50b8d03..c577113b 100644 --- a/R/DataLoadingSaving.R +++ b/R/DataLoadingSaving.R @@ -127,9 +127,10 @@ getDbCohortMethodData <- function(connectionDetails, checkmate::assertClass(connectionDetails, "ConnectionDetails", add = errorMessages) checkmate::assertCharacter(cdmDatabaseSchema, len = 1, add = errorMessages) checkmate::assertCharacter(tempEmulationSchema, len = 1, null.ok = TRUE, add = errorMessages) - checkmate::assertInt(targetId, add = errorMessages) - checkmate::assertInt(comparatorId, add = errorMessages) - checkmate::assertIntegerish(outcomeIds, add = errorMessages) + checkmate::assertNumeric(targetId, add = errorMessages) + checkmate::assertNumeric(comparatorId, add = errorMessages) + checkmate::assertNumeric(outcomeIds, add = errorMessages) + checkmate::assertTRUE(all(c(targetId, comparatorId, outcomeIds) %% 1 == 0), add = errorMessages) checkmate::assertCharacter(studyStartDate, len = 1, add = errorMessages) checkmate::assertCharacter(studyEndDate, len = 1, add = errorMessages) checkmate::assertCharacter(exposureDatabaseSchema, len = 1, add = errorMessages) diff --git a/R/StudyPopulation.R b/R/StudyPopulation.R index 31a7f39b..90b56427 100644 --- a/R/StudyPopulation.R +++ b/R/StudyPopulation.R @@ -101,7 +101,8 @@ createStudyPopulation <- function(cohortMethodData, errorMessages <- checkmate::makeAssertCollection() checkmate::assertClass(cohortMethodData, "CohortMethodData", add = errorMessages) checkmate::assertDataFrame(population, null.ok = TRUE, add = errorMessages) - checkmate::assertInt(outcomeId, null.ok = TRUE, add = errorMessages) + checkmate::assertNumeric(outcomeId, null.ok = TRUE, add = errorMessages) + if (!is.null(outcomeId)) checkmate::assertTRUE(all(outcomeId %% 1 == 0), add = errorMessages) checkmate::assertLogical(firstExposureOnly, len = 1, add = errorMessages) checkmate::assertLogical(restrictToCommonPeriod, len = 1, add = errorMessages) checkmate::assertInt(washoutPeriod, lower = 0, add = errorMessages) diff --git a/inst/csv/resultsDataModelSpecification.csv b/inst/csv/resultsDataModelSpecification.csv index 853b7f47..3bc0b5a2 100644 --- a/inst/csv/resultsDataModelSpecification.csv +++ b/inst/csv/resultsDataModelSpecification.csv @@ -2,15 +2,15 @@ table_name,column_name,data_type,is_required,primary_key,min_cell_count,deprecat cm_attrition,sequence_number,int,Yes,Yes,No,No,The place in the sequence of steps defining the final analysis cohort. 1 indicates the original exposed population without any inclusion criteria. cm_attrition,description,varchar,Yes,No,No,No,"A description of the last restriction, e.g. ""Removing persons with the outcome prior"". " cm_attrition,subjects,int,Yes,No,Yes,No,The number of subjects in the cohort. -cm_attrition,exposure_id,int,Yes,Yes,No,No,The identifier of the exposure cohort to which the attrition applies. Can be either the target or comparator cohort ID. -cm_attrition,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_attrition,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_attrition,exposure_id,bigint,Yes,Yes,No,No,The identifier of the exposure cohort to which the attrition applies. Can be either the target or comparator cohort ID. +cm_attrition,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_attrition,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. cm_attrition,analysis_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. -cm_attrition,outcome_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table. +cm_attrition,outcome_id,bigint,Yes,Yes,No,No,Foreign key referencing the cm_analysis table. cm_attrition,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. -cm_follow_up_dist,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_follow_up_dist,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. -cm_follow_up_dist,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_follow_up_dist,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_follow_up_dist,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_follow_up_dist,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_follow_up_dist,analysis_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table. cm_follow_up_dist,target_min_days,float,No,No,No,No,The minimum number of observation days for a person. cm_follow_up_dist,target_p_10_days,float,No,No,No,No,The 10^th^ percentile of number of observation days for a person in the target group. @@ -35,9 +35,9 @@ cm_analysis,analysis_id,int,Yes,Yes,No,No,A unique identifier for an analysis. cm_analysis,description,varchar,Yes,No,No,No,"A description for an analysis, e.g. 'On-treatment'." cm_analysis,definition,varchar,Yes,No,No,No,A CohortMethod JSON object specifying the analysis. cm_result,analysis_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table. -cm_result,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_result,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. -cm_result,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_result,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_result,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_result,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_result,rr,float,No,No,No,No,The estimated relative risk (e.g. the hazard ratio). cm_result,ci_95_lb,float,No,No,No,No,The lower bound of the 95% confidence interval of the relative risk. cm_result,ci_95_ub,float,No,No,No,No,The upper bound of the 95% confidence interval of the relative risk. @@ -62,9 +62,9 @@ cm_result,calibrated_se_log_rr,float,No,No,No,No,The standard error of the log o cm_result,target_estimator,varchar,Yes,No,No,No,"The target estimator, for example ""att"", ""ate"", ""atu"" or ""ato""." cm_result,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. cm_interaction_result,analysis_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table. -cm_interaction_result,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_interaction_result,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. -cm_interaction_result,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_interaction_result,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_interaction_result,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_interaction_result,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_interaction_result,interaction_covariate_id,int,Yes,Yes,No,No,Foreign key referencing the cm_covariate table. cm_interaction_result,rr,float,Yes,No,No,No,The estimated relative risk (e.g. the ratio of hazard ratios). cm_interaction_result,ci_95_lb,float,Yes,No,No,No,The lower bound of the 95% confidence interval of the relative risk. @@ -95,9 +95,9 @@ cm_covariate_analysis,covariate_analysis_id,int,Yes,Yes,No,No,A unique identifie cm_covariate_analysis,covariate_analysis_name,varchar,Yes,No,No,No,"A name for a covariate analysis, e.g. 'Demographics: age group'." cm_covariate_analysis,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. cm_covariate_balance,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. -cm_covariate_balance,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_covariate_balance,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. -cm_covariate_balance,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_covariate_balance,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_covariate_balance,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_covariate_balance,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_covariate_balance,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. cm_covariate_balance,covariate_id,bigint,Yes,Yes,No,No,A foreign key referencing the cm_covariate table. cm_covariate_balance,target_mean_before,float,No,No,Yes,No,The mean value of the covariate in the target cohort before propensity score adjustment. @@ -112,9 +112,9 @@ cm_covariate_balance,target_std_diff,float,No,No,No,No,The standardized differen cm_covariate_balance,comparator_std_diff,float,No,No,No,No,The standardized difference of the means before and after propensity score adjustment in the comparator cohort. cm_covariate_balance,target_comparator_std_diff,float,No,No,No,No,The standardized difference of the means before and after propensity score adjustment in the union of the target and comparator cohorts. cm_diagnostics_summary,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. -cm_diagnostics_summary,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_diagnostics_summary,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. -cm_diagnostics_summary,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_diagnostics_summary,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_diagnostics_summary,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_diagnostics_summary,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_diagnostics_summary,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. cm_diagnostics_summary,max_sdm,float,No,No,No,No,The maximum absolute standardized difference of mean. cm_diagnostics_summary,shared_max_sdm,float,No,No,No,No,The maximum absolute standardized difference of mean of the shared balance (shared across outcomes). @@ -132,11 +132,11 @@ cm_diagnostics_summary,generalizability_diagnostic,varchar(20),Yes,No,No,No,Pass cm_diagnostics_summary,ease_diagnostic,varchar(20),Yes,No,No,No,Pass / warning / fail classification of the EASE diagnostic. cm_diagnostics_summary,unblind,int,Yes,No,No,No,"Is unblinding the result recommended? (1 = yes, 0 = no)" cm_diagnostics_summary,unblind_for_evidence_synthesis,int,Yes,No,No,No,"Is unblinding the result for inclusion in evidence synthesis recommended? This ignores the MDRR diagnostic. (1 = yes, 0 = no)" -cm_target_comparator_outcome,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_target_comparator_outcome,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_target_comparator_outcome,outcome_of_interest,int,Yes,No,No,No,"Is the outcome of interest (1 = yes, 0 = no)" cm_target_comparator_outcome,true_effect_size,float,No,No,No,No,The true effect size for the target-comparator-outcome. For negatitive controls this equals 1. -cm_target_comparator_outcome,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_target_comparator_outcome,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_target_comparator_outcome,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_target_comparator_outcome,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. cm_kaplan_meier_dist,time_day,int,Yes,Yes,No,No,Time in days since cohort start. cm_kaplan_meier_dist,target_survival,float,Yes,No,No,No,The estimated survival fraction in the target cohort. cm_kaplan_meier_dist,target_survival_lb,float,Yes,No,No,No,The lower bound of the 95% confidence interval of the survival fraction in the target cohort. @@ -146,34 +146,34 @@ cm_kaplan_meier_dist,comparator_survival_lb,float,Yes,No,No,No,The lower bound o cm_kaplan_meier_dist,comparator_survival_ub,float,Yes,No,No,No,The upper bound of the 95% confidence interval of the survival fraction in the comparator cohort. cm_kaplan_meier_dist,target_at_risk,int,No,No,Yes,No,The number of subjects still at risk in the target cohort. cm_kaplan_meier_dist,comparator_at_risk,int,No,No,Yes,No,The number of subjects still at risk in the comparator cohort. -cm_kaplan_meier_dist,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_kaplan_meier_dist,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. -cm_kaplan_meier_dist,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_kaplan_meier_dist,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_kaplan_meier_dist,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_kaplan_meier_dist,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_kaplan_meier_dist,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. cm_kaplan_meier_dist,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. cm_likelihood_profile,log_rr,float,Yes,Yes,No,No,The log of the relative risk where the likelihood is sampled. cm_likelihood_profile,log_likelihood,float,Yes,No,No,No,The normalized log likelihood. -cm_likelihood_profile,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_likelihood_profile,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. -cm_likelihood_profile,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort. +cm_likelihood_profile,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_likelihood_profile,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_likelihood_profile,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort. cm_likelihood_profile,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. cm_likelihood_profile,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. cm_preference_score_dist,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. -cm_preference_score_dist,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_preference_score_dist,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_preference_score_dist,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_preference_score_dist,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. cm_preference_score_dist,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. cm_preference_score_dist,preference_score,float,Yes,Yes,No,No,A preference score value. cm_preference_score_dist,target_density,float,Yes,No,No,No,The distribution density for the target cohort at the given preference score. cm_preference_score_dist,comparator_density,float,Yes,No,No,No,The distribution density for the comparator cohort at the given preference score. -cm_propensity_model,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_propensity_model,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_propensity_model,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_propensity_model,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. cm_propensity_model,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. cm_propensity_model,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. cm_propensity_model,covariate_id,bigint,Yes,Yes,No,No,Foreign key referencing the cm_covariate table. 0 is reserved for the intercept. cm_propensity_model,coefficient,float,Yes,No,No,No,The coefficient (beta) for the covariate in the propensity model. cm_shared_covariate_balance,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database. -cm_shared_covariate_balance,target_id,int,Yes,Yes,No,No,The identifier for the target cohort. -cm_shared_covariate_balance,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort. +cm_shared_covariate_balance,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort. +cm_shared_covariate_balance,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort. cm_shared_covariate_balance,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table. cm_shared_covariate_balance,covariate_id,bigint,Yes,Yes,No,No,A foreign key referencing the cm_covariate table. cm_shared_covariate_balance,mean_before,float,No,No,Yes,No,The mean value of the covariate in the union of the target and comparator cohort before propensity score adjustment. diff --git a/inst/sql/postgresql/migrations/Migration_2-v5.2.2.sql b/inst/sql/postgresql/migrations/Migration_2-v5.2.2.sql new file mode 100644 index 00000000..623d9731 --- /dev/null +++ b/inst/sql/postgresql/migrations/Migration_2-v5.2.2.sql @@ -0,0 +1,58 @@ +-- Generated SQL statements to alter columns to BIGINT data type + +-- Alter columns in cm_attrition table +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN exposure_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN outcome_id TYPE BIGINT; + +-- Alter columns in cm_follow_up_dist table +ALTER TABLE @database_schema.@table_prefixcm_follow_up_dist ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_follow_up_dist ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_follow_up_dist ALTER COLUMN outcome_id TYPE BIGINT; + +-- Alter columns in cm_result table +ALTER TABLE @database_schema.@table_prefixcm_result ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_result ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_result ALTER COLUMN outcome_id TYPE BIGINT; + +-- Alter columns in cm_interaction_result table +ALTER TABLE @database_schema.@table_prefixcm_interaction_result ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_interaction_result ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_interaction_result ALTER COLUMN outcome_id TYPE BIGINT; + + +ALTER TABLE @database_schema.@table_prefixcm_covariate_balance ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_covariate_balance ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_covariate_balance ALTER COLUMN outcome_id TYPE BIGINT; + +ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ALTER COLUMN outcome_id TYPE BIGINT; + +-- Alter columns in cm_target_comparator_outcome table +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN outcome_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN outcome_of_interest TYPE BIGINT; + +-- Alter columns in cm_kaplan_meier_dist table +ALTER TABLE @database_schema.@table_prefixcm_kaplan_meier_dist ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_kaplan_meier_dist ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_kaplan_meier_dist ALTER COLUMN outcome_id TYPE BIGINT; + +-- Alter columns in cm_likelihood_profile table +ALTER TABLE @database_schema.@table_prefixcm_likelihood_profile ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_likelihood_profile ALTER COLUMN comparator_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_likelihood_profile ALTER COLUMN outcome_id TYPE BIGINT; + +ALTER TABLE @database_schema.@table_prefixcm_propensity_model ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_propensity_model ALTER COLUMN comparator_id TYPE BIGINT; + +ALTER TABLE @database_schema.@table_prefixcm_preference_score_dist ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_preference_score_dist ALTER COLUMN comparator_id TYPE BIGINT; + + +-- Alter columns in cm_shared_covariate_balance table +ALTER TABLE @database_schema.@table_prefixcm_shared_covariate_balance ALTER COLUMN target_id TYPE BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_shared_covariate_balance ALTER COLUMN comparator_id TYPE BIGINT; diff --git a/inst/sql/sql_server/migrations/Migration_2-v5.2.2.sql b/inst/sql/sql_server/migrations/Migration_2-v5.2.2.sql new file mode 100644 index 00000000..bf15cd17 --- /dev/null +++ b/inst/sql/sql_server/migrations/Migration_2-v5.2.2.sql @@ -0,0 +1,58 @@ +-- Generated SQL statements to alter columns to BIGINT data type + +-- Alter columns in cm_attrition table +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN exposure_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_attrition ALTER COLUMN outcome_id BIGINT; + +-- Alter columns in cm_follow_up_dist table +ALTER TABLE @database_schema.@table_prefixcm_follow_up_dist ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_follow_up_dist ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_follow_up_dist ALTER COLUMN outcome_id BIGINT; + +-- Alter columns in cm_result table +ALTER TABLE @database_schema.@table_prefixcm_result ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_result ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_result ALTER COLUMN outcome_id BIGINT; + +-- Alter columns in cm_interaction_result table +ALTER TABLE @database_schema.@table_prefixcm_interaction_result ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_interaction_result ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_interaction_result ALTER COLUMN outcome_id BIGINT; + + +ALTER TABLE @database_schema.@table_prefixcm_covariate_balance ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_covariate_balance ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_covariate_balance ALTER COLUMN outcome_id BIGINT; + +ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_diagnostics_summary ALTER COLUMN outcome_id BIGINT; + +-- Alter columns in cm_target_comparator_outcome table +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN outcome_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_target_comparator_outcome ALTER COLUMN outcome_of_interest BIGINT; + +-- Alter columns in cm_kaplan_meier_dist table +ALTER TABLE @database_schema.@table_prefixcm_kaplan_meier_dist ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_kaplan_meier_dist ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_kaplan_meier_dist ALTER COLUMN outcome_id BIGINT; + +-- Alter columns in cm_likelihood_profile table +ALTER TABLE @database_schema.@table_prefixcm_likelihood_profile ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_likelihood_profile ALTER COLUMN comparator_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_likelihood_profile ALTER COLUMN outcome_id BIGINT; + +ALTER TABLE @database_schema.@table_prefixcm_propensity_model ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_preficm_propensity_model ALTER COLUMN comparator_id BIGINT + +ALTER TABLE @database_schema.@table_prefixcm_preference_score_dist ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_preference_score_dist ALTER COLUMN comparator_id BIGINT + + +-- Alter columns in cm_shared_covariate_balance table +ALTER TABLE @database_schema.@table_prefixcm_shared_covariate_balance ALTER COLUMN target_id BIGINT; +ALTER TABLE @database_schema.@table_prefixcm_shared_covariate_balance ALTER COLUMN comparator_id BIGINT;