Open ChemiKyle opened 1 year ago
Archiving and shutting down projects has created several (possibly generically) useful functions, we should consider porting these functions to redcapcustodian.
The code from STP is as follows:
get_schema_via_mysqldump <- function(table_name, host, database, username, password) { command <- paste( "mysqldump", "--no-data --skip-lock-tables --triggers --routines --events --skip-add-locks --skip-comments --no-tablespaces", paste0("--host=", host), paste0("--user=", username), "-p", database, table_name, "| sed -e 's/AUTO_INCREMENT=[[:digit:]]* //'", "| sed '/50013 DEFINER=/d'" ) schema <- system( command = command, input = password, intern = TRUE ) project_name <- tolower(word(table_name, 1, sep = "_")) schema_filename <- paste0(output_dir, "/", project_name, "_schema", ".sql") write(schema, schema_filename) }
Archiving and shutting down projects has created several (possibly generically) useful functions, we should consider porting these functions to redcapcustodian.
The code from STP is as follows: