Core: Database Records

Created on 11 Jul 2017  路  4Comments  路  Source: php-telegram-bot/core

My tables in Database (specific update and message Tables) are grown , and I can't remove old records(foreign key error)
what can I do ?
can I remove these Tables (update AND message )?

Most helpful comment

No idea but editing message that was previously in database can result in constrain error in this case.

We might want to implement cleanup <days> command for this...
I have very similar command in one of my bots, If i don't forget I'll handle this!

All 4 comments

Updates table can be emptied without a problem, no foreign key errors there.

TRUNCATE telegram_update;

As for the others, you could just ignore the foreign key constraints and empty it.

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE message;
SET FOREIGN_KEY_CHECKS = 1;

@jacklul Any downside on doing this? Apart from the obvious links being broken?

No idea but editing message that was previously in database can result in constrain error in this case.

We might want to implement cleanup <days> command for this...
I have very similar command in one of my bots, If i don't forget I'll handle this!

@mohsenshahab Check out the new /cleanup admin command in version 0.46.0 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sineverba picture sineverba  路  3Comments

smaznet picture smaznet  路  4Comments

irmmr picture irmmr  路  3Comments

NabiKAZ picture NabiKAZ  路  4Comments

sayjeyhi picture sayjeyhi  路  3Comments