Skip to content

Clean database

Clean database records

Since version 1.2, we offer command to clear records older than 30 days in seatable database (the default database name is dtable_db).

The following tables will be cleaned:

  • activities
  • operation_log
  • delete_operation_log
  • notifications_usernotification
  • dtable_notifications
  • dtable_snapshop
  • session_log
docker exec -it seatable /bin/bash python-env /opt/seatable/seatable-server-latest/dtable-web/ clean_db_records

Database backup (Optional)

Before running clean_db_records, you can make a backup by a shell script. The following tables with too many records will be excluded:

  • operation_log
  • delete_operation_log
  • session_log
  • activities

Examples of backup shell script

set -e
db_host='<IP address of database>'

echo 'Start backing up the database'

mysqldump -h$db_host -u$db_user -p --opt $db_name --ignore-table=$db_name.operation_log --ignore-table=$db_name.activities --ignore-table=$db_name.delete_operation_log --ignore-table=$db_name.session_log > $backup_dir/seatable.sql.`date +"%Y-%m-%d"`

echo 'Database backup succeeded'

Run the shell script

$ ./
Start backing up the database
Enter password: xxxxx
Database backup succeeded