Wan2.1/wan-pwa/packages/db
Claude f21ab74e38
chore: add configuration files for monorepo setup
- Add root package.json and turbo.json
- Add Next.js config files
- Add FastAPI environment example
- Add PWA manifest
- Add ESLint and Prettier config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 14:19:02 +00:00
..
migrations feat: Add complete Wan2.1 PWA - AI Video Generation Platform 2025-10-24 14:18:18 +00:00
package.json chore: add configuration files for monorepo setup 2025-10-24 14:19:02 +00:00
README.md feat: Add complete Wan2.1 PWA - AI Video Generation Platform 2025-10-24 14:18:18 +00:00

Database Package

This package contains database schema and migrations for the Wan2.1 PWA.

Setup

  1. Go to your Supabase dashboard
  2. Navigate to SQL Editor
  3. Create a new query
  4. Copy the contents of migrations/001_initial_schema.sql
  5. Run the query

Schema

Tables

users

  • Stores user profile data
  • Extends Supabase auth.users
  • Tracks credits and subscription tier

generations

  • Stores video generation requests and results
  • Links to users and tracks status
  • Stores prompts, settings, and output URLs

credit_transactions

  • Tracks all credit additions and deductions
  • Provides audit trail for user credits

Storage

images bucket

  • Stores uploaded images for Image-to-Video generation
  • Publicly accessible
  • Organized by user ID

Row Level Security (RLS)

All tables have RLS enabled to ensure users can only access their own data:

  • Users can read/update their own profile
  • Users can view/create their own generations
  • Users can view their own transactions

Migrations

Migrations should be run in order:

  1. 001_initial_schema.sql - Core schema
  2. 002_seed_data.sql - Optional seed data

Indexes

Indexes are created on:

  • generations.user_id
  • generations.created_at
  • credit_transactions.user_id
  • credit_transactions.created_at

These optimize common queries for user data and history.