Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
54 lines
2.2 KiB
SQL
54 lines
2.2 KiB
SQL
-- Create the database
|
|
DO $$ BEGIN PERFORM log_message('Creating database {DB_NAME_HOCUSPOCUS}'); END $$;
|
|
CREATE DATABASE {DB_NAME_HOCUSPOCUS} TEMPLATE {DB_NAME};
|
|
|
|
-- Create the user
|
|
DO $$ BEGIN PERFORM log_message('Creating USER {DB_USER_HOCUSPOCUS}'); END $$;
|
|
CREATE USER {DB_USER_HOCUSPOCUS} WITH PASSWORD '{DB_PASSWORD_HOCUSPOCUS}';
|
|
|
|
\c {DB_NAME_HOCUSPOCUS}
|
|
|
|
DO $$ BEGIN PERFORM log_message('Closing all connections to {DB_NAME} to avoid any error '); END $$;
|
|
SELECT pg_terminate_backend(pg_stat_activity.pid)
|
|
FROM pg_stat_activity
|
|
WHERE pg_stat_activity.datname = '{DB_NAME}'
|
|
AND pid <> pg_backend_pid();
|
|
|
|
|
|
-- Grant usage on schema
|
|
DO $$ BEGIN PERFORM log_message('Granting schemas permissions to user {DB_USER_HOCUSPOCUS}'); END $$;
|
|
GRANT USAGE ON SCHEMA public TO {DB_USER_HOCUSPOCUS};
|
|
|
|
-- Grant all privileges on all tables in the schema
|
|
DO $$ BEGIN PERFORM log_message('Granting all privileges for all tables to user {DB_USER_HOCUSPOCUS}'); END $$;
|
|
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO {DB_USER_HOCUSPOCUS};
|
|
|
|
-- Grant all privileges on all sequences in the schema
|
|
DO $$ BEGIN PERFORM log_message('Granting all privileges for all sequences to user {DB_USER_HOCUSPOCUS}'); END $$;
|
|
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO {DB_USER_HOCUSPOCUS};
|
|
|
|
-- Grant all privileges on all functions in the schema
|
|
|
|
DO $$ BEGIN PERFORM log_message('Granting all privileges for all functions to user {DB_USER_HOCUSPOCUS}'); END $$;
|
|
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO {DB_USER_HOCUSPOCUS};
|
|
|
|
-- Grant all privileges on the database
|
|
DO $$ BEGIN PERFORM log_message('Granting all privileges for database to user {DB_USER_HOCUSPOCUS}'); END $$;
|
|
GRANT ALL PRIVILEGES ON DATABASE {DB_NAME_HOCUSPOCUS} TO {DB_USER_HOCUSPOCUS};
|
|
|
|
|
|
|
|
|
|
-- Create the users table
|
|
-- FIXME: This is only for testing purposes
|
|
CREATE TABLE users (
|
|
id SERIAL PRIMARY KEY,
|
|
username VARCHAR(50) UNIQUE NOT NULL,
|
|
email VARCHAR(100) UNIQUE NOT NULL,
|
|
password_hash VARCHAR(255) NOT NULL,
|
|
first_name VARCHAR(50),
|
|
last_name VARCHAR(50),
|
|
date_of_birth DATE,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
|
|
); |