Drizzle Multi-Project Schema Issue
Setup: Monorepo with two packages sharing the same PostgreSQL
database:
- database package: manages main application tables
- agents package: manages RAG-related tables with mastraalready
prefix
Configuration:
- Database package: tablesFilter: ["!mastra_"] (exclude mastra
tables)
- Agents package: tablesFilter: ["mastraalready"] (only manage
mastra tables)
Problem:
When running drizzle-kit push from the agents package, it tries to
DROP database objects (like enum billing_period) that belong to the
database package, even though:
1. The tablesFilter is configured to only manage mastraalready*
tables
2. drizzle-kit generate correctly produces SQL only for the filtered
tables (no DROP commands)
3. drizzle-kit introspect respects the filter (shows 0 tables, but
still fetches 7 enums)
Error:
error: cannot drop type billing_period because other objects depend
on it
detail: 'column starting_price_period of table pricing depends on
type billing_period'
Expected: drizzle-kit push should only manage tables matching the
tablesFilter pattern and ignore all other database objects (tables,
enums, types) outside that scope.
Question: Is this a known limitation? What's the recommended
approach for multiple packages managing different tables in the same
database?
0 Replies