Files
2025-10-05 14:26:15 +00:00

28 lines
1.0 KiB
SQL

-- Script de configuration PostgreSQL pour UnionFlow
-- Exécuter en tant que superuser (postgres)
-- Créer l'utilisateur unionflow s'il n'existe pas
DO $$
BEGIN
IF NOT EXISTS (SELECT FROM pg_catalog.pg_user WHERE usename = 'unionflow') THEN
CREATE USER unionflow WITH PASSWORD 'unionflow123';
END IF;
END
$$;
-- Créer la base de données unionflow si elle n'existe pas
SELECT 'CREATE DATABASE unionflow OWNER unionflow'
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'unionflow')\gexec
-- Donner tous les privilèges à l'utilisateur unionflow
GRANT ALL PRIVILEGES ON DATABASE unionflow TO unionflow;
-- Se connecter à la base unionflow et donner les privilèges sur le schéma public
\c unionflow
GRANT ALL ON SCHEMA public TO unionflow;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO unionflow;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO unionflow;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO unionflow;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO unionflow;