mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
5a35ef34ac
- Refactor channel manager with support for Sender/Receiver interfaces and hot-swappable adapters. - Implement identity routing and pre-authentication logic for inbound messages. - Update database schema to support bot pre-auth keys and extended channel session metadata. - Add Telegram and Feishu channel configuration and adapter enhancements. - Update Swagger documentation and internal handlers for channel management. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.1 KiB
SQL
37 lines
1.1 KiB
SQL
-- name: UpsertContainer :exec
|
|
INSERT INTO containers (
|
|
bot_id, container_id, container_name, image, status, namespace, auto_start,
|
|
host_path, container_path, last_started_at, last_stopped_at
|
|
)
|
|
VALUES (
|
|
sqlc.arg(bot_id),
|
|
sqlc.arg(container_id),
|
|
sqlc.arg(container_name),
|
|
sqlc.arg(image),
|
|
sqlc.arg(status),
|
|
sqlc.arg(namespace),
|
|
sqlc.arg(auto_start),
|
|
sqlc.arg(host_path),
|
|
sqlc.arg(container_path),
|
|
sqlc.arg(last_started_at),
|
|
sqlc.arg(last_stopped_at)
|
|
)
|
|
ON CONFLICT (container_id) DO UPDATE SET
|
|
bot_id = EXCLUDED.bot_id,
|
|
container_name = EXCLUDED.container_name,
|
|
image = EXCLUDED.image,
|
|
status = EXCLUDED.status,
|
|
namespace = EXCLUDED.namespace,
|
|
auto_start = EXCLUDED.auto_start,
|
|
host_path = EXCLUDED.host_path,
|
|
container_path = EXCLUDED.container_path,
|
|
last_started_at = EXCLUDED.last_started_at,
|
|
last_stopped_at = EXCLUDED.last_stopped_at,
|
|
updated_at = now();
|
|
|
|
-- name: GetContainerByContainerID :one
|
|
SELECT * FROM containers WHERE container_id = sqlc.arg(container_id);
|
|
|
|
-- name: GetContainerByBotID :one
|
|
SELECT * FROM containers WHERE bot_id = sqlc.arg(bot_id) ORDER BY updated_at DESC LIMIT 1;
|