forked from mtusi2026/mtusi2026lab4
Carry over the lab 3 solution
Bring the application, own tests, Dockerfile, toolchain, compose stack, HAProxy and k6 configuration, migrations, hooks, evidence and level 4 scripts and the CI job from the lab 3 solution commit 61c0c28, merge the lab 3 Makefile targets into the lab 4 skeleton Makefile without touching its targets, and append the lab 3 solution variables to the skeleton .env.example. The package and the application follow the contract version 1.4.0, and the image and the throwaway test containers are tagged lab4 so they do not collide with a lab 3 stand on the same host. This is the starting point of the lab 4 cycle: lint, own tests and the offline skeleton check pass before any lab 4 change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b0f463ac5c
commit
bf8e4e3cd1
@@ -0,0 +1,40 @@
|
||||
\set ON_ERROR_STOP on
|
||||
\set author '''00000000-0000-7000-8000-00000000a001'''
|
||||
\set big '''00000000-0000-7000-8000-00000000c001'''
|
||||
\set epoch '''2026-01-01T00:00:00Z'''
|
||||
|
||||
INSERT INTO users (id, username, display_name, password_hash, created_at)
|
||||
VALUES (:author, 'seed_author', 'Синтетический автор', '$argon2id$v=19$m=19456,t=2,p=1$c2VlZA$c2VlZA', :epoch)
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
INSERT INTO chats (id, title, created_at)
|
||||
SELECT ('00000000-0000-7000-8000-00000000c' || lpad(to_hex(chat), 3, '0'))::uuid,
|
||||
'Синтетический чат ' || chat, :epoch
|
||||
FROM generate_series(1, 21) AS chat
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
INSERT INTO chat_members (chat_id, user_id, position, chat_created_at)
|
||||
SELECT id, :author, 1, created_at FROM chats WHERE title LIKE 'Синтетический чат %'
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
INSERT INTO messages (id, chat_id, sender_id, text, created_at)
|
||||
SELECT ('00000000-0000-7000-8001-' || lpad(to_hex(n), 12, '0'))::uuid, :big, :author,
|
||||
'синтетическое сообщение ' || n, :epoch::timestamptz + n * interval '1 second'
|
||||
FROM generate_series(1, 20000) AS n
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
INSERT INTO messages (id, chat_id, sender_id, text, created_at)
|
||||
SELECT ('00000000-0000-7000-8002-' || lpad(to_hex(chat * 1000 + n), 12, '0'))::uuid,
|
||||
('00000000-0000-7000-8000-00000000c' || lpad(to_hex(chat), 3, '0'))::uuid, :author,
|
||||
'фоновое сообщение ' || n, :epoch::timestamptz + n * interval '1 second'
|
||||
FROM generate_series(2, 21) AS chat, generate_series(1, 500) AS n
|
||||
ON CONFLICT DO NOTHING;
|
||||
|
||||
UPDATE chats
|
||||
SET last_message_at = (SELECT max(created_at) FROM messages WHERE messages.chat_id = chats.id)
|
||||
WHERE title LIKE 'Синтетический чат %';
|
||||
|
||||
ANALYZE;
|
||||
|
||||
SELECT count(*) FILTER (WHERE chat_id = :big) AS big_chat_messages, count(*) AS all_messages
|
||||
FROM messages;
|
||||
Reference in New Issue
Block a user