Protect your database schema

Protected mode is a database setting that prevents destructive changes to the schema.

You can set protected mode in the Create Database dialog when you click the CREATE DATABASE button, choosing one of the following protection setting options:

  • Enabled

  • Disabled (default)

  • Inherit

Protected mode and the database hierarchy

A database can have one of the following protection settings:

Setting Description

Enabled

Protected mode enabled.

Disabled

(default) Protected mode disabled.

inherit

Sets the protected mode of the database to that of its nearest ancestor that isn’t also set to inherit.

Prohibited changes

The following table shows which schema changes are potentially destructive and, therefore, protected when protected mode is set:

Entity or Field Prohibited operations Comments

Collection

Delete

history_days

Decrease
Remove

ttl_days

Decrease
Add

indexes

Change
Remove

Prohibits changing or removing an index or unique constraint in a way that causes a backing index to be deleted. That is, removing or changing the definition of an indexes or unique constraint that doesn’t share the same terms and values with another index or unique constraint.

indexes are implemented with a backing classic index behind the user-facing definition. Protected mode disallows changing or removing indexes when the change or removal causes a backing index to be deleted because the change can’t easily be reverted. If an index shares its backing index with another index, changing or removing the index doesn’t delete the backing index. In this case, protected mode allows the change or removal because if the original index definition is restored, the existing backing index is used, and a new index doesn’t have to be built. When you accidentally trigger a new backing index build and then want to revert to the previous definition, protected mode allows the deletion of backing indexes in pending status.

unique constraint

Change
Remove

Prohibits changing or removing an index or unique constraint in a way that causes a backing index to be deleted. That is, removing or changing the definition of an indexes or unique constraint that doesn’t share the same terms and values with another index or unique constraint.

unique constraints are implemented with a backing classic index behind the user-facing definition. Protected mode disallows changing or removing unique constraints when the change or removal causes a backing index to be deleted because the change can’t easily be reverted. If an index shares its backing index with another unique constraint, changing or removing the index doesn’t delete the backing index. In this case, protected mode allows the change or removal because if the original index definition is restored, the existing backing index is used, and a new index doesn’t have to be built.

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!