Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

20 righe
941 B

  1. -- `CREATE USER` does not support `IF NOT EXISTS`, so we use this workaround to prevent an error and raise a notice instead.
  2. -- Seen here: https://stackoverflow.com/a/49858797
  3. DO $$
  4. BEGIN
  5. CREATE USER {{ additional_db.username }};
  6. EXCEPTION WHEN DUPLICATE_OBJECT THEN
  7. RAISE NOTICE 'not creating user {{ additional_db.username }}, since it already exists';
  8. END
  9. $$;
  10. -- This is useful for initial user creation (since we don't assign a password above) and for handling subsequent password changes
  11. -- TODO - we should escape quotes in the password.
  12. ALTER ROLE {{ additional_db.username }} PASSWORD '{{ additional_db.password }}';
  13. -- This will generate an error on subsequent execution
  14. CREATE DATABASE {{ additional_db.name }} WITH LC_CTYPE 'C' LC_COLLATE 'C' OWNER {{ additional_db.username }};
  15. -- This is useful for changing the database owner subsequently
  16. ALTER DATABASE {{ additional_db.name }} OWNER TO {{ additional_db.username }};