mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-17 09:34:48 +00:00
fix(migrations): bring customer hierarchy tables in line with schema.prisma (#52175)
The customer daily usage migration gave LiteLLM_DailyCustomerMemberSpend.updated_at a DEFAULT CURRENT_TIMESTAMP that schema.prisma never declared, and the customer hierarchy cleanup renamed the default budget template foreign key to a 65 character name that Postgres cut to 63 characters, which is not the name Prisma derives. prisma migrate diff reported both, so test_schema_migration_in_sync failed on every main integration run. The new migration drops the updated_at default, matching every other daily spend table. The only writer, the daily spend bulk upsert, always sets updated_at itself. It also renames the truncated foreign key to the name Prisma expects, guarded so databases that never got the truncated name are left alone.
This commit is contained in:
parent
f33dcfd1dd
commit
dc4c8a67b5
1 changed files with 14 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
SET LOCAL lock_timeout = '10s';
|
||||
|
||||
ALTER TABLE "LiteLLM_DailyCustomerMemberSpend" ALTER COLUMN "updated_at" DROP DEFAULT;
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM pg_constraint
|
||||
WHERE conname = 'LiteLLM_CustomerOrganizationTable_default_budget_template_id_fk'
|
||||
AND conrelid = '"LiteLLM_CustomerOrganizationTable"'::regclass
|
||||
) THEN
|
||||
ALTER TABLE "LiteLLM_CustomerOrganizationTable" RENAME CONSTRAINT "LiteLLM_CustomerOrganizationTable_default_budget_template_id_fk" TO "LiteLLM_CustomerOrganizationTable_default_budget_template__fkey";
|
||||
END IF;
|
||||
END $$;
|
||||
Loading…
Add table
Reference in a new issue