nxtgauge-backend-rust/crates/db/migrations/20260615060600_ai_credit_packages.up.sql
Ashwin Kumar Sivakumar c85e6af22e feat(ai): complete AI plans/credits implementation and build tooling
- Add AI plans, credits, model routing, LiteLLM client, and orchestrator services
- Add AI management endpoints, auto-apply/auto-request handlers, and log endpoints
- Add cron jobs for daily action reset and monthly credit reset
- Add AI credit purchase flow in payments service
- Add ai_credit_packages migration with seed data
- Update Dockerfile build tooling across services
2026-06-15 06:15:49 +05:30

18 lines
773 B
SQL

CREATE TABLE ai_credit_packages (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(150) NOT NULL,
description TEXT,
credits INT NOT NULL,
price_inr INT NOT NULL,
is_active BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_ai_credit_packages_active ON ai_credit_packages(is_active, price_inr);
INSERT INTO ai_credit_packages (name, description, credits, price_inr) VALUES
('Starter AI Credits', '50 AI credits for casual usage', 50, 99),
('Pro AI Credits', '200 AI credits for power users', 200, 349),
('Business AI Credits', '750 AI credits for teams', 750, 999),
('Enterprise AI Credits', '2500 AI credits for heavy usage', 2500, 2499);