Skip to content

Latest commit

 

History

History
360 lines (276 loc) · 4.97 KB

File metadata and controls

360 lines (276 loc) · 4.97 KB

🔧 TiQology Deployment - Quick Commands

Use this for quick reference during deployment


Database Commands

Generate New Migration

pnpm db:generate

Apply Migrations (Local/Test)

pnpm db:migrate

Open Drizzle Studio (Local DB Explorer)

pnpm db:studio

Push Schema to Database (Development)

pnpm db:push

Build Commands

Development Build

pnpm dev

Production Build (Local Test)

pnpm build

Build with Migrations (What Vercel was trying to do)

pnpm build:with-migrate

Start Production Server (After Build)

pnpm start

Testing Commands

Run All Tests

pnpm test

Run Playwright E2E Tests

pnpm test:e2e

Lint Code

pnpm lint

Format Code

pnpm format

Git Workflow

Check Current Branch

git branch

Check Status

git status

Create New Branch

git checkout -b feature/your-feature-name

Commit Changes

git add .
git commit -m "feat: your descriptive message"

Push to Remote

git push origin your-branch-name

Create Clean Branch for Deploy

git checkout -b deploy/production-$(date +%Y%m%d)
git push origin deploy/production-$(date +%Y%m%d)

Vercel CLI Commands (Optional)

Install Vercel CLI

pnpm add -g vercel

Login to Vercel

vercel login

Link Project

vercel link

Deploy to Preview

vercel

Deploy to Production

vercel --prod

Check Deployment Status

vercel ls

View Logs

vercel logs [deployment-url]

Pull Environment Variables

vercel env pull

Supabase SQL Commands (Run in SQL Editor)

List All Tables

SELECT tablename 
FROM pg_tables 
WHERE schemaname = 'public' 
ORDER BY tablename;

Check User Table

SELECT * FROM "User" ORDER BY id DESC LIMIT 10;

Check Recent Chats

SELECT * FROM "Chat" ORDER BY "createdAt" DESC LIMIT 10;

Check Recent Messages

SELECT * FROM "Message_v2" ORDER BY "createdAt" DESC LIMIT 10;

Count Records

SELECT 
  'Users' as table_name, COUNT(*) as count FROM "User"
UNION ALL
SELECT 'Chats', COUNT(*) FROM "Chat"
UNION ALL
SELECT 'Messages', COUNT(*) FROM "Message_v2";

Delete Test Data (CAUTION!)

-- Delete test guest users
DELETE FROM "User" WHERE email LIKE 'guest-%';

-- Delete old chats (older than 7 days)
DELETE FROM "Chat" WHERE "createdAt" < NOW() - INTERVAL '7 days';

Environment Variable Commands

Generate AUTH_SECRET

openssl rand -base64 32

Check Environment Variables (Local)

cat .env.local

Set Environment Variable (Local)

echo "VARIABLE_NAME=value" >> .env.local

Debugging Commands

Check Node Version

node --version

Check pnpm Version

pnpm --version

Check Dependencies

pnpm list

Check for Outdated Packages

pnpm outdated

Security Audit

pnpm audit

Fix Security Issues

pnpm audit fix

Clear Cache

pnpm store prune
rm -rf .next
rm -rf node_modules
pnpm install

Useful Aliases (Add to ~/.bashrc or ~/.zshrc)

# TiQology shortcuts
alias tiq-dev="cd /workspaces/ai-chatbot && pnpm dev"
alias tiq-build="cd /workspaces/ai-chatbot && pnpm build"
alias tiq-deploy="cd /workspaces/ai-chatbot && git push && vercel --prod"
alias tiq-logs="vercel logs --follow"
alias tiq-clean="rm -rf .next node_modules && pnpm install"

Emergency Commands

Rollback Git Changes

git reset --hard HEAD

Restore Specific File

git checkout HEAD -- path/to/file

View Recent Commits

git log --oneline -10

Revert to Previous Commit

git revert [commit-hash]

Performance Testing

Load Test (using autocannon)

npx autocannon -c 10 -d 30 https://your-domain.vercel.app

Bundle Analysis

ANALYZE=true pnpm build

Quick Status Checks

Full System Check

echo "Node: $(node --version)"
echo "pnpm: $(pnpm --version)"
echo "Git Branch: $(git branch --show-current)"
echo "Git Status: $(git status --short)"
pnpm build --dry-run

Database Connection Test (Local)

pnpm tsx -e "
import postgres from 'postgres';
const sql = postgres(process.env.POSTGRES_URL);
sql\`SELECT 1\`.then(() => console.log('✅ Connected')).catch(e => console.log('❌ Error:', e));
"

Backup Commands

Backup Database (Supabase Dashboard)

Supabase Dashboard → Settings → Database → Backups
Download PITR backup

Backup Environment Variables

# In Vercel Dashboard
vercel env pull .env.backup

Backup Code

git archive --format=zip --output=tiqology-backup-$(date +%Y%m%d).zip HEAD

Keep this handy during deployment! 🚀