Announcement

Collapse
No announcement yet.

Does Database Cleanup Delete Columns?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does Database Cleanup Delete Columns?

    If I remove a custom created column on an entity, either a default entity or a custom entity, does the cleanup job delete the column if it has been removed in the system? I'm noticing that some columns are sticking around that shouldn't be. I'm not sure if the columns are deleted when the field is deleted in Entity Manager or if it is done by the cleanup job.

    Just needing some clarification on when these are removed. Thanks!

  • #2
    Adding new fields or links do create new columns in the tables but removing them does not change the table structures.

    "Deleting" a field or an entity merely removes all metadata reference to them so they don't exist as far as Espo is concerned, but they do not change the database.

    The same is true for any customizations that you might have done using the custom fields or entities or links.

    Removing a field in entity manager which is used in metadata/entityDefs/ "orderBy" the columns will not be removed from OrderBy statement which ends up in HTTP 500 accessing the entity. In the log ...


    While the entity manager is an unbeatable tool for customizing your instance with minimum effort, any use of the created entities, links or fields in your customization will have to be removed manually if you decide to "delete" the entity, link or field created.
    Last edited by telecastg; 10-31-2022, 06:19 PM.

    Comment


    • #3
      Awesome! Thank you so much for that clarification!

      Comment


      • telecastg
        telecastg commented
        Editing a comment
        You're welcome

    • #4
      Check out Hard Rebuild. It won’t drop unused tables but it does say it drops unused columns.




      As of v7.4.
      php command.php rebuild --hard


      Hard database rebuild. It will drop unused columns, decrease exceeding column lengths, fix index names, set proper collations. It won't drop unused tables (consider removing them manually).

      Recommended to have a database backup before running hard rebuild.

      Comment

      Working...
      X