php-telegram-bot / telegram-bot-manager

PHP Telegram Bot Manager
MIT License
208 stars 65 forks source link

Schema is not created by default and provided structure is incomplete #62

Closed eqMFqfFd closed 3 years ago

eqMFqfFd commented 3 years ago

Hello, when I try to install the php-telegram-bot/example-bot and try to run the example script with a MySQL database, I get a lot of "table or view not found" errors. Effectively, tables do not exist. I found this structure.sql file in your repo that should apparently create everything. However, more errors are raised:

PHP Warning:  PDOStatement::execute(): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' in /home/bot/vendor/longman/telegram-bot/src/DB.php on 
line 224
PHP Warning:  PDOStatement::execute(): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' in /home/bot/vendor/longman/telegram-bot/src/DB.php on 
line 224
PHP Warning:  PDOStatement::execute(): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' in /home/bot/vendor/longman/telegram-bot/src/DB.php on 
line 372
noplanman commented 3 years ago

Hi @kenygamer, the structure.sql file needs to be imported to the database manually, to create all necessary tables. Are those errors popping up even after importing it?

Are you using a custom table prefix when enabling the MySQL connection? If yes, the table names when importing need to be adjusted as well in the structure.sql file.

eqMFqfFd commented 3 years ago

@noplanman I'm not using any table prefix, and I already imported the structure.sql file, manually. The errors I get are the ones you see.

eqMFqfFd commented 3 years ago

After importing the structure file, the schema looks like:

  | callback_query |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 80 KB | -
-- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 1 | InnoDB | utf8mb4_unicode_520_ci | 32 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 32 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 64 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 80 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 32 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 1 | InnoDB | utf8mb4_unicode_520_ci | 176 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 16 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 16 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 32 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 16 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8mb4_unicode_520_ci | 32 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8_general_ci | 16 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 0 | InnoDB | utf8_general_ci | 16 KB | -
  |   | Examinar | Estructura | Buscar | Insertar | Vaciar | Eliminar | 1 | InnoDB | utf8mb4_unicode_520_ci | 32 KB | -
 
noplanman commented 3 years ago

@kenygamer I don't understand that output 🤔 So it basically only has the callback_query table?

eqMFqfFd commented 3 years ago

@noplanman These tables are present:

callback_query, chat, chosen_inline_result, conversation, edited_message, inline_query, message, poll, poll_answer, pre_checkout_query, request_limiter, shipping_query, telegram.telegram_update, user, user_chat
noplanman commented 3 years ago

Ok, looks good 👍

So where is the problem exactly?

eqMFqfFd commented 3 years ago

@noplanman I think all is good now. It was erroring before.