update
This commit is contained in:
23
scripts/init-db.sql
Normal file
23
scripts/init-db.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- Initialize database for development
|
||||
-- This script runs when the PostgreSQL container starts
|
||||
|
||||
-- Create database if it doesn't exist (this is handled by POSTGRES_DB env var)
|
||||
-- The database 'portfolio_dev' is created automatically
|
||||
|
||||
-- Create user if it doesn't exist (this is handled by POSTGRES_USER env var)
|
||||
-- The user 'portfolio_user' is created automatically
|
||||
|
||||
-- Grant permissions
|
||||
GRANT ALL PRIVILEGES ON DATABASE portfolio_dev TO portfolio_user;
|
||||
|
||||
-- Create schema if it doesn't exist
|
||||
CREATE SCHEMA IF NOT EXISTS public;
|
||||
|
||||
-- Grant schema permissions
|
||||
GRANT ALL ON SCHEMA public TO portfolio_user;
|
||||
GRANT ALL ON ALL TABLES IN SCHEMA public TO portfolio_user;
|
||||
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO portfolio_user;
|
||||
|
||||
-- Set default privileges for future tables
|
||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO portfolio_user;
|
||||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO portfolio_user;
|
||||
Reference in New Issue
Block a user