migrations fix
This commit is contained in:
parent
865b5ff4f4
commit
e84111732e
60 changed files with 0 additions and 0 deletions
|
|
@ -0,0 +1,49 @@
|
|||
ALTER TABLE public.bot_api_updates
|
||||
ADD COLUMN callback_inline_dc_id integer NOT NULL DEFAULT 0,
|
||||
ADD COLUMN callback_inline_owner_id bigint NOT NULL DEFAULT 0,
|
||||
ADD COLUMN callback_inline_message_id integer NOT NULL DEFAULT 0,
|
||||
ADD COLUMN callback_inline_access_hash bigint NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE public.bot_api_updates
|
||||
DROP CONSTRAINT bot_api_updates_callback_shape_check,
|
||||
DROP CONSTRAINT bot_api_updates_peer_type_check,
|
||||
DROP CONSTRAINT bot_api_updates_peer_id_check,
|
||||
DROP CONSTRAINT bot_api_updates_message_id_check;
|
||||
|
||||
ALTER TABLE public.bot_api_updates
|
||||
ADD CONSTRAINT bot_api_updates_peer_type_check CHECK (
|
||||
peer_type IN ('user', 'channel')
|
||||
OR (update_kind = 'callback_query' AND peer_type = '')
|
||||
),
|
||||
ADD CONSTRAINT bot_api_updates_peer_id_check CHECK (
|
||||
peer_id > 0
|
||||
OR (update_kind = 'callback_query' AND peer_id = 0)
|
||||
),
|
||||
ADD CONSTRAINT bot_api_updates_message_id_check CHECK (
|
||||
message_id > 0
|
||||
OR (update_kind = 'callback_query' AND message_id = 0)
|
||||
),
|
||||
ADD CONSTRAINT bot_api_updates_callback_shape_check CHECK (
|
||||
(update_kind = 'callback_query'
|
||||
AND callback_query_id <> 0
|
||||
AND callback_user_id > 0
|
||||
AND callback_chat_instance <> 0
|
||||
AND COALESCE(octet_length(callback_data), 0) <= 64
|
||||
AND source_pts = 0
|
||||
AND (
|
||||
(peer_type IN ('user', 'channel') AND peer_id > 0 AND message_id > 0
|
||||
AND callback_inline_dc_id = 0 AND callback_inline_owner_id = 0
|
||||
AND callback_inline_message_id = 0 AND callback_inline_access_hash = 0)
|
||||
OR
|
||||
(peer_type = '' AND peer_id = 0 AND message_id = 0
|
||||
AND callback_inline_dc_id > 0 AND callback_inline_owner_id > 0
|
||||
AND callback_inline_message_id > 0 AND callback_inline_access_hash <> 0)
|
||||
))
|
||||
OR
|
||||
(update_kind IN ('message', 'edited_message')
|
||||
AND peer_type IN ('user', 'channel') AND peer_id > 0 AND message_id > 0
|
||||
AND callback_query_id = 0 AND callback_user_id = 0
|
||||
AND callback_chat_instance = 0 AND callback_data IS NULL
|
||||
AND callback_inline_dc_id = 0 AND callback_inline_owner_id = 0
|
||||
AND callback_inline_message_id = 0 AND callback_inline_access_hash = 0)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue