All checks were successful
build-and-release / build (customers) (push) Successful in 1m23s
build-and-release / build (employees) (push) Successful in 1m48s
build-and-release / build (catering-services) (push) Successful in 1m57s
build-and-release / build (companies) (push) Successful in 2m6s
build-and-release / build (cron) (push) Successful in 2m23s
build-and-release / build (gateway) (push) Successful in 51s
build-and-release / build (developers) (push) Successful in 2m44s
build-and-release / build (fitness-trainers) (push) Successful in 1m39s
build-and-release / build (jobs) (push) Successful in 45s
build-and-release / build (graphic-designers) (push) Successful in 2m16s
build-and-release / build (job-seekers) (push) Successful in 2m16s
build-and-release / build (leads) (push) Successful in 1m46s
build-and-release / build (payments) (push) Successful in 2m19s
build-and-release / build (makeup-artists) (push) Successful in 3m0s
build-and-release / build (photographers) (push) Successful in 2m42s
build-and-release / build (social-media-managers) (push) Successful in 2m19s
build-and-release / build (ugc-content-creators) (push) Successful in 2m33s
build-and-release / build (tutors) (push) Successful in 2m42s
build-and-release / build (video-editors) (push) Successful in 2m44s
build-and-release / build (users) (push) Successful in 6m38s
Same class of bug as the ai_plans_and_limits fix: ai_credit_packages and
users_litellm_key used plain CREATE TABLE/ADD COLUMN with no re-run guard,
and payu_rename_columns did a bare RENAME COLUMN that fails outright on any
second run ("column razorpay_order_id does not exist"). All three were
discovered by actually running the db-migrate job end to end for the first
time and fixed in the same pass as the verification_logs FK fix - already
baked into the db-migrate image that was built and run manually, this
commit just brings the source in the repo in sync with what's deployed.
Also: apps/employees login handler's DB error was being discarded via
.map_err(|_| ...) with zero logging, making the reported "db error while
logging in" impossible to diagnose from pod logs. Log the real error.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
24 lines
1.1 KiB
SQL
24 lines
1.1 KiB
SQL
CREATE TABLE IF NOT EXISTS 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 IF NOT EXISTS idx_ai_credit_packages_active ON ai_credit_packages(is_active, price_inr);
|
|
|
|
-- name has no unique constraint to key an ON CONFLICT off of, so guard the
|
|
-- whole seed on the table being empty (this migration only ever ran once
|
|
-- successfully; a second run inserted zero extra rows before this fix).
|
|
INSERT INTO ai_credit_packages (name, description, credits, price_inr)
|
|
SELECT * FROM (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)
|
|
) AS v(name, description, credits, price_inr)
|
|
WHERE NOT EXISTS (SELECT 1 FROM ai_credit_packages);
|