Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
e2c45622
Commit
e2c45622
authored
Jun 15, 2016
by
Jack'lul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
constraint fix
parent
5d17ad12
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
DB.php
src/DB.php
+5
-2
structure.sql
structure.sql
+3
-1
No files found.
src/DB.php
View file @
e2c45622
...
...
@@ -596,10 +596,10 @@ class DB
try
{
$mysql_query
=
'INSERT IGNORE INTO `'
.
TB_CALLBACK_QUERY
.
'`
(
`id`, `user_id`, `message_id`, `inline_message_id`, `data`, `created_at`
`id`, `user_id`, `
chat_id`, `
message_id`, `inline_message_id`, `data`, `created_at`
)
VALUES (
:callback_query_id, :user_id, :message_id, :inline_message_id, :data, :created_at
:callback_query_id, :user_id, :
chat_id, :
message_id, :inline_message_id, :data, :created_at
)'
;
$sth_insert_callback_query
=
self
::
$pdo
->
prepare
(
$mysql_query
);
...
...
@@ -615,8 +615,10 @@ class DB
}
$message
=
$callback_query
->
getMessage
();
$chat_id
=
null
;
$message_id
=
null
;
if
(
$message
)
{
$chat_id
=
$callback_query
->
getMessage
()
->
getChat
()
->
getId
();
$message_id
=
$callback_query
->
getMessage
()
->
getMessageId
();
self
::
insertMessageRequest
(
$message
);
}
...
...
@@ -626,6 +628,7 @@ class DB
$sth_insert_callback_query
->
bindParam
(
':callback_query_id'
,
$callback_query_id
,
\PDO
::
PARAM_INT
);
$sth_insert_callback_query
->
bindParam
(
':user_id'
,
$user_id
,
\PDO
::
PARAM_INT
);
$sth_insert_callback_query
->
bindParam
(
':chat_id'
,
$chat_id
,
\PDO
::
PARAM_INT
);
$sth_insert_callback_query
->
bindParam
(
':message_id'
,
$message_id
,
\PDO
::
PARAM_INT
);
$sth_insert_callback_query
->
bindParam
(
':inline_message_id'
,
$inline_message_id
,
\PDO
::
PARAM_STR
);
$sth_insert_callback_query
->
bindParam
(
':data'
,
$data
,
\PDO
::
PARAM_STR
);
...
...
structure.sql
View file @
e2c45622
...
...
@@ -121,6 +121,7 @@ CREATE TABLE IF NOT EXISTS `message` (
CREATE
TABLE
IF
NOT
EXISTS
`callback_query`
(
`id`
bigint
UNSIGNED
COMMENT
'Unique identifier for this query'
,
`user_id`
bigint
NULL
COMMENT
'Unique user identifier'
,
`chat_id`
bigint
NULL
COMMENT
'Unique chat identifier'
,
`message_id`
bigint
UNSIGNED
COMMENT
'Unique message identifier'
,
`inline_message_id`
CHAR
(
255
)
NULL
DEFAULT
NULL
COMMENT
'Identifier of the message sent via the bot in inline mode, that originated the query'
,
`data`
CHAR
(
255
)
NOT
NULL
DEFAULT
''
COMMENT
'Data associated with the callback button'
,
...
...
@@ -128,10 +129,11 @@ CREATE TABLE IF NOT EXISTS `callback_query` (
PRIMARY
KEY
(
`id`
),
KEY
`user_id`
(
`user_id`
),
KEY
`chat_id`
(
`chat_id`
),
KEY
`message_id`
(
`message_id`
),
FOREIGN
KEY
(
`user_id`
)
REFERENCES
`user`
(
`id`
),
FOREIGN
KEY
(
`
user
_id`
,
`message_id`
)
REFERENCES
`message`
(
`chat_id`
,
`id`
)
FOREIGN
KEY
(
`
chat
_id`
,
`message_id`
)
REFERENCES
`message`
(
`chat_id`
,
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_unicode_520_ci
;
CREATE
TABLE
IF
NOT
EXISTS
`edited_message`
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment