20 lines
627 B
SQL
20 lines
627 B
SQL
-- Initialize database for NestJS Serverless Application
|
|
-- This file is executed when the PostgreSQL container starts
|
|
|
|
-- Create database if it doesn't exist
|
|
SELECT 'CREATE DATABASE nestjs_user_crud'
|
|
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'nestjs_user_crud')\gexec
|
|
|
|
-- Connect to the database
|
|
\c nestjs_user_crud;
|
|
|
|
-- Create extensions if needed
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
|
|
-- Set timezone
|
|
SET timezone = 'UTC';
|
|
|
|
-- Create a user for the application (optional)
|
|
-- CREATE USER nestjs_user WITH PASSWORD 'nestjs_password';
|
|
-- GRANT ALL PRIVILEGES ON DATABASE nestjs_user_crud TO nestjs_user;
|