Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F627865
006_import_procedures.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
006_import_procedures.lua
View Options
--[[
Migration 006 - Import Procedures
Additional stored procedures needed for the import plugin.
These return columns not covered by the base stored procedures in 005.
]]
local
migration
=
{}
function
migration
.
up
()
return
[[
-- Get all settings for a chat (import needs key + value pairs)
CREATE OR REPLACE FUNCTION sp_get_all_chat_settings(
p_chat_id BIGINT
) RETURNS TABLE(key TEXT, value TEXT) AS $$
SELECT cs.key, cs.value FROM chat_settings cs
WHERE cs.chat_id = p_chat_id;
$$ LANGUAGE sql;
-- Get filters with response column (import needs pattern, action, and response)
CREATE OR REPLACE FUNCTION sp_get_filters_full(
p_chat_id BIGINT
) RETURNS TABLE(pattern TEXT, action VARCHAR(20), response TEXT) AS $$
SELECT f.pattern, f.action, f.response FROM filters f
WHERE f.chat_id = p_chat_id;
$$ LANGUAGE sql;
-- Get welcome message with parse_mode (import needs both columns)
CREATE OR REPLACE FUNCTION sp_get_welcome_message_full(
p_chat_id BIGINT
) RETURNS TABLE(message TEXT, parse_mode TEXT) AS $$
SELECT wm.message, wm.parse_mode FROM welcome_messages wm
WHERE wm.chat_id = p_chat_id;
$$ LANGUAGE sql;
]]
end
return
migration
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 2:53 AM (1 d, 22 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
131726
Default Alt Text
006_import_procedures.lua (1 KB)
Attached To
Mode
R69 mattata
Attached
Detach File
Event Timeline