You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
712 B
SQL
21 lines
712 B
SQL
-- Initialize Stock Oracle Database
|
|
-- This file is automatically executed when PostgreSQL container starts
|
|
|
|
-- Note: Database is already created by POSTGRES_DB environment variable
|
|
|
|
-- Create user if not exists (PostgreSQL syntax)
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'stockoracle') THEN
|
|
CREATE ROLE stockoracle WITH LOGIN PASSWORD 'stockoracle2024';
|
|
END IF;
|
|
END
|
|
$$;
|
|
|
|
-- Grant permissions
|
|
GRANT ALL PRIVILEGES ON DATABASE stock_oracle TO stockoracle;
|
|
|
|
-- Grant schema permissions
|
|
GRANT ALL ON SCHEMA public TO stockoracle;
|
|
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO stockoracle;
|
|
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO stockoracle; |