The DROP BUNDLE statement permanently deletes a bundle (schema) from the database. This operation removes the bundle definition and, when used with WITH FORCE, can also delete all documents and relationships associated with that bundle.
⚠️ WARNING: This is a destructive operation that cannot be undone. Always backup your data before dropping bundles.
DROP BUNDLE "<BUNDLE_NAME>";
Optional WITH FORCE clause:
DROP BUNDLE "<BUNDLE_NAME>" WITH FORCE;
The DROP keyword indicates a deletion operation. In SyndrDB, DROP is specifically used for removing bundle schemas.
Characteristics:
Related Commands:
CREATE BUNDLE - Creates a new bundle schemaDELETE DOCUMENTS - Deletes documents from a bundleThe BUNDLE keyword specifies that you are dropping a bundle (table/collection equivalent).
Characteristics:
The optional WITH FORCE clause allows dropping a bundle even if it contains documents or has relationships to other bundles.
Characteristics:
Without FORCE:
-- This will FAIL if bundle has documents or relationships
DROP BUNDLE "old_users";
With FORCE:
-- This will DELETE everything and drop the bundle
DROP BUNDLE "old_users" WITH FORCE;
Safety Considerations:
Bundle names must be:
"users", "order_items""Users" and "users" are different bundlesValid Examples:
DROP BUNDLE "users";
DROP BUNDLE "user_profiles";
DROP BUNDLE "user-sessions";
DROP BUNDLE "logs2025";
DROP BUNDLE "OrderItems";
Invalid Examples:
DROP BUNDLE users; -- ❌ Missing quotes
DROP BUNDLE ""; -- ❌ Empty bundle name
DROP BUNDLE; -- ❌ Missing bundle name
Drop empty bundle:
DROP BUNDLE "temp_data";
Drop bundle without semicolon (optional):
DROP BUNDLE "logs"
Drop with whitespace:
DROP BUNDLE
"archived_users";
Drop bundle with documents:
-- Bundle has 1,000 documents - force deletion
DROP BUNDLE "old_orders" WITH FORCE;
Drop bundle with relationships:
-- Bundle has relationships to other bundles - force removal
DROP BUNDLE "legacy_products" WITH FORCE;
Drop bundle with both documents and relationships:
-- Complete cleanup of old data structure
DROP BUNDLE "deprecated_schema" WITH FORCE;
Bundle with underscores:
DROP BUNDLE "user_sessions";
Bundle with hyphens:
DROP BUNDLE "api-keys";
Bundle with numbers:
DROP BUNDLE "logs_2024";
Mixed case bundle:
DROP BUNDLE "UserProfiles";
Check bundle contents first:
-- Query documents before dropping
SELECT COUNT(*) FROM "old_data";
-- Then drop if safe
DROP BUNDLE "old_data";
Export data before dropping:
-- Export important data first
SELECT * FROM "archive_users";
-- Then drop
DROP BUNDLE "archive_users" WITH FORCE;
Use descriptive bundle names:
DROP BUNDLE "temp_migration_2024_11"; -- ✅ Clear purpose
Check for relationships:
-- Verify no other bundles depend on this one
-- Then drop safely
DROP BUNDLE "standalone_logs";
Use transactions for multiple drops:
-- Drop related bundles in a coordinated way
DROP BUNDLE "orders" WITH FORCE;
DROP BUNDLE "order_items" WITH FORCE;
DROP BUNDLE "order_history" WITH FORCE;
Don't drop production bundles without backup:
DROP BUNDLE "customers" WITH FORCE; -- ❌ NO BACKUP!
Don't use generic names:
DROP BUNDLE "data"; -- ❌ Too vague
Don't drop without verifying bundle name:
DROP BUNDLE "user"; -- ❌ Did you mean "users"?
Don't chain drops without checking dependencies:
DROP BUNDLE "products"; -- ❌ May break orders
DROP BUNDLE "categories"; -- ❌ May break products
Error: bundle 'xyz' not found
Solution: Verify bundle name (case-sensitive) and check it exists.
Error: cannot drop bundle 'users' because it contains documents or has relationships. Use FORCE to override
Solution: Either:
WITH FORCE to bypass check (destructive)-- Option 1: Delete documents first
DELETE DOCUMENTS FROM "users" WHERE 1 == 1;
DROP BUNDLE "users";
-- Option 2: Use FORCE (destructive)
DROP BUNDLE "users" WITH FORCE;
Error: expected bundle name: unexpected end of input
Solution: Provide bundle name in quotes.
DROP BUNDLE "bundle_name"; -- ✅ Correct
Error: expected BUNDLE, got <token>
Solution: Check syntax matches pattern:
DROP BUNDLE "name"; -- ✅ Correct
DROP BUNDLE "name" WITH FORCE; -- ✅ Correct
DROP "name"; -- ❌ Missing BUNDLE keyword
Error: insufficient permissions to drop bundle 'users'
Solution: Ensure you have DROP permissions on the bundle.
Error: cannot drop bundle 'products' - referenced by bundle 'orders'
Solution: Drop dependent bundles first or use FORCE to override.
| Feature | Syntax | Required |
|---|---|---|
| Basic Drop | DROP BUNDLE "name"; |
✅ Yes |
| Bundle Name | Quoted string | ✅ Yes |
| Force Flag | WITH FORCE |
❌ Optional |
| Semicolon | ; |
❌ Optional |
| Operation | Keyword | Example |
|---|---|---|
| Drop empty bundle | DROP BUNDLE |
DROP BUNDLE "logs"; |
| Drop with documents | WITH FORCE |
DROP BUNDLE "users" WITH FORCE; |
| Drop with relationships | WITH FORCE |
DROP BUNDLE "products" WITH FORCE; |
| Method | Safety | Use Case |
|---|---|---|
DROP BUNDLE |
🟢 Safe | Empty bundles only |
DROP BUNDLE WITH FORCE |
🔴 Destructive | Development/migrations |
Version: SyndrDB 1.0
Last Updated: November 2024
Status: ✅ Implemented and tested