Step 7

Install PostgreSQL Database

PostgreSQL stores all your OneAiMind data — life domains, chat history, skills, and settings.

Install PostgreSQL

bash
# Install PostgreSQL
sudo apt install -y postgresql postgresql-contrib

# Start and enable
sudo systemctl start postgresql
sudo systemctl enable postgresql

# Verify
sudo systemctl status postgresql
# Should show: Active: active (running)

Create Database & User

bash
# Open PostgreSQL console
sudo -u postgres psql
ℹ️
You are now inside the PostgreSQL console

Run the following SQL commands one at a time. Replace YourStrongPasswordHere with your actual password.

sql
-- Create the database user
CREATE USER oneaimind_user WITH PASSWORD 'YourStrongPasswordHere';

-- Create the database
CREATE DATABASE oneaimind OWNER oneaimind_user;

-- Grant all privileges
GRANT ALL PRIVILEGES ON DATABASE oneaimind TO oneaimind_user;

-- Exit the console
\q

Run Database Migrations

bash
cd ~/OneAiMind
npm run db:migrate

# Expected output:
# ✅ Creating table: users
# ✅ Creating table: chat_sessions
# ✅ Creating table: domain_entries
# ✅ Creating table: skills
# ✅ Creating table: dashboard_layouts
# ✅ Creating table: password_vault
# ✅ Database setup complete
💡
Database Ready

PostgreSQL is now running and your OneAiMind database is configured. The next step is cloning and launching the app itself.