-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
26 lines (19 loc) · 1.18 KB
/
Copy pathinit.sql
File metadata and controls
26 lines (19 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- Initial database setup for SaveVideoBot
-- This file is executed when the PostgreSQL container starts for the first time
-- Create database if it doesn't exist (this is handled by POSTGRES_DB env var)
-- CREATE DATABASE botdb;
-- Connect to the database
\c botdb;
-- Create extensions
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Create tables (these will be created by SQLAlchemy, but we can add some initial data here)
-- Insert some initial configuration if needed
-- INSERT INTO config (key, value) VALUES ('bot_version', '1.0.0') ON CONFLICT (key) DO NOTHING;
-- Create indexes for better performance (these will be created by SQLAlchemy, but we can add custom ones)
-- CREATE INDEX IF NOT EXISTS idx_download_requests_user_id_created_at ON download_requests(user_id, created_at DESC);
-- CREATE INDEX IF NOT EXISTS idx_download_requests_status ON download_requests(status);
-- CREATE INDEX IF NOT EXISTS idx_download_requests_platform ON download_requests(platform);
-- Grant permissions
GRANT ALL PRIVILEGES ON DATABASE botdb TO user;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO user;