This function creates one or more SQL scripts as defined in https://github.com/OHDSI/CommonDataModel.

CreateCDMIndexAndConstraintScripts(
  connectionDetails,
  cdmSchema,
  cdmVersion,
  githubTag = NULL
)

Arguments

connectionDetails

An R object of type
connectionDetails created using the function createConnectionDetails in the DatabaseConnector package.

cdmSchema

The name of the CDM database schema. Requires read and write permissions to this database. On SQL Server, this should specify both the database and the schema, so for example 'cdm_instance.dbo'.

cdmVersion

Your CDM version. Currently "5.3.1" and "5.4.0" are supported.

githubTag

An optional github tag from which to pull the DDL script. Currently "v5.3.1" and "v5.4.0" are supported. The default is NULL.

Details

This function creates SQL scripts for the indices and constraints on tables in a CDM by referring to the correct SQL DDL script in the OHDSI CommonDataModel repo. The database platform is determined by connectionDetails$dbms. Currently "oracle", "postgresql", "pdw", "netezza", and "sql server" are supported. The SQL DDL scripts are written to the output directory. The SQL scripts can then be run manually in a SQL session or by using DatabaseConnector::executeSql(connection,DDLscriptName)