Clean Up Database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • animax
    Senior Member
    • Jun 2018
    • 155

    Clean Up Database

    Hi there,

    it's about crons / jobs and database

    1.)
    I noticed that the automatic job "Clean-up" runs suddenly with errors. See Figure 2. What can I do to make the cron work properly again?

    2.) In the Espo database I found the tables from picture 1:
    - note
    - note_User
    - note_team
    - notifications

    In my opinion, it is unimportant log data. The tables are really big now! So my question is: can I safely empty these tables?
  • eymen-elkum
    Active Community Member
    • Nov 2014
    • 472

    #2
    Hi animax ,

    for the question number 1, needs to look at the log files to check the error messages, unless anyone cannot help.

    for the question number 2, the short answer is YES you can empty them with no effect to the whole crm, BUT keep in mind that you will lose the data included in these tables,

    It is good for you to know what every table refers to:

    - note: holds the users posts in streams & all entities action made like created action and updated audited fields
    this is a bit important data in some cases if users relied on it usually

    - note_User: holds data for who user can see which note

    - note_team: the same for teams

    - notifications: I think this is not very important and can be empty.

    I prefer to archive these tables before you empty, and for notes I prefer make conditionally clean so you remain for the posts for example and you may only remove the notes before 2020.
    CEO of Eblasoft
    EspoCRM Expert since 2014
    Full Stack Web Developer since 2008
    Creator of Numerous Successful Extensions & Projects​

    Comment

    • eymen-elkum
      Active Community Member
      • Nov 2014
      • 472

      #3
      This SQL statement can be used for the conditionally remove records from note table:

      PHP Code:
      DELETE     FROM `note`
       WHERE     `type` <> 'Post'  AND created_at < '2020-01-01' 
      
      Last edited by eymen-elkum; 03-26-2020, 08:54 AM.
      CEO of Eblasoft
      EspoCRM Expert since 2014
      Full Stack Web Developer since 2008
      Creator of Numerous Successful Extensions & Projects​

      Comment

      • animax
        Senior Member
        • Jun 2018
        • 155

        #4
        Hi ayman.alkom, thank you for your good support!

        Comment

        • dreginald
          Member
          • Sep 2018
          • 89

          #5
          Is there any Command to delete a record through workflow? For Example if an Opportunity the Status is Closed Lost and Close Date is Past, I want the Opportunity to be deleted after 30 Days

          Comment

          • yuri
            Member
            • Mar 2014
            • 8453

            #6
            > Is there any Command to delete a record through workflow

            Yes. By using Update Target Record action > formula:

            Code:
            deleted = true;
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            Working...