Drop features
DROP FEATURE removes features from the registry. FeatureQL enforces dependency constraints — you cannot drop a feature that other features depend on unless you handle the dependents first.
Syntax
DROP FEATURE [IF EXISTS] <feature_name> DROP FEATURES [IF EXISTS] <feature_name>, <feature_name>, ... DROP FEATURES [IF EXISTS] IN <namespace>
Dropping a single feature
Use DROP FEATURE IF EXISTS to safely remove a feature. The IF EXISTS clause prevents errors when the feature has already been deleted:
DROP FEATURE IF EXISTS FM.TUTORIALS.CAD.FEATURE1; Dependency protection
FeatureQL prevents you from dropping a feature that other features depend on. If FEATURE4 depends on FEATURE2, attempting to drop FEATURE2 alone fails:
-- Fails: FEATURE4 depends on FEATURE2
DROP FEATURES IF EXISTS FM.TUTORIALS.CAD.FEATURE2, FM.TUTORIALS.CAD.FEATURE3; The error message identifies exactly which dependents need to be handled:
ERROR: You must drop all dependant features {'FM.TUTORIALS.CAD.FEATURE4'} before dropping this feature. Dropping multiple features
Include all features in the dependency chain and FeatureQL resolves the correct deletion order:
DROP FEATURES IF EXISTS FM.TUTORIALS.CAD.FEATURE2, FM.TUTORIALS.CAD.FEATURE3, FM.TUTORIALS.CAD.FEATURE4; Alternatively, wrap individual drops in a transaction — FeatureQL resolves the order within the transaction boundary:
START TRANSACTION;
DROP FEATURE IF EXISTS FM.TUTORIALS.CAD.FEATURE2;
DROP FEATURE IF EXISTS FM.TUTORIALS.CAD.FEATURE3;
DROP FEATURE IF EXISTS FM.TUTORIALS.CAD.FEATURE4;
COMMIT; Mixing DROP and CREATE in a transaction
A single transaction can combine DROP and CREATE statements. FeatureQL processes them in the right order: drops first (respecting dependency order), then creates. CREATE OR REPLACE also works within transactions to atomically swap feature definitions.
When to use each variant
| Syntax | Behavior |
|---|---|
DROP FEATURE name | Fails if the feature doesn't exist |
DROP FEATURE IF EXISTS name | No-op if the feature doesn't exist |
DROP FEATURES name1, name2, ... | Drops multiple features, resolving dependency order |
DROP FEATURES IF EXISTS IN namespace | Drops all features in a namespace |