db_create_new_schema.R 583 B

123456789101112131415161718192021
  1. #' Create the new schema
  2. #'
  3. #' Loome andmebaasi uue schema.
  4. #' @param conf list List of configuration data. Rewrite it.
  5. #' @keywords database, schema
  6. #' @export
  7. #' @examples
  8. #' config <- get_config()
  9. #' db_create_new_schema(conf = config)
  10. db_create_new_schema <- function(conf) {
  11. if (!ruut::db_is_shema_exist(conf$schema)) {
  12. conn <- ruut::db_connect()
  13. DBI::dbExecute(conn, sprintf(
  14. "-- DROP SCHEMA x_matsalu;
  15. CREATE SCHEMA %s AUTHORIZATION %s;", conf$schema, conf$user
  16. ))
  17. }
  18. }
  19. # conf <- ruut::get_config()
  20. # conf$schema <- "x_valga"
  21. # db_create_new_schema(conf)