Renaming a Directus collection shouldn't break your entire project

Hey everyone :waving_hand:

I ran into the collection renaming problem one too many times and finally decided to do something about it. Just released directus-extension-safe-rename โ€” it lets you rename collections and fields straight from the UI and handles all the system table updates automatically in one atomic transaction.

It covers relations, permissions, presets, flows โ€” pretty much everything. PostgreSQL tested, other DBs still untested (help welcome! :eyes:)

What gets updated automatically:

  • Collections & fields metadata

  • Relations (O2M, M2M, M2A)

  • Permissions & presets

  • Flows & operations & more

Install via Directus Marketplace or npm:

npm install @contensu/directus-extension-safe-rename

:package: NPM: https://www.npmjs.com/package/@contensu/directus-extension-safe-rename

Built by Contensu โ€” we build software around your business, so your business can grow.

8 Likes

This is pretty cool. Havenโ€™t tried it yet. Iโ€™ve been wanting to rename a lot of collections but have avoided it for this reason.

1 Like

Update: v1.0.0 is out! :tada:

Since the beta post, a lot has happened:

  • The extension now has a full integration test suite โ€” 126 tests running across 15 CI jobs (3 Directus versions ร— 5 databases) on every push
  • All the databases that were โ€œuntestedโ€ are now fully verified:
    • :white_check_mark: PostgreSQL 13 & 16
    • :white_check_mark: MySQL 8
    • :white_check_mark: MariaDB 11
    • :white_check_mark: SQLite
  • Fixed several real bugs discovered during testing (alias field crashes, M2A one_allowed_collections handling, SQLite FK constraint issues)
  • Tested against Directus 11.14.1, 11.16.1, and 11.17.0

The beta warning is gone โ€” this is ready for production use. As always, backup your DB before any schema changes.

One thing worth noting: this extension requires direct database access, so it wonโ€™t appear in the Marketplace by default. Youโ€™ll need MARKETPLACE_TRUST="all" or install via npm:

npm install @contensu/directus-extension-safe-rename
2 Likes

Thanks Mr_Rogers! Thatโ€™s exactly the use case this was built for. Give it a try and let me know how it goes โ€” happy to help if you run into anything!