67 lines
2.1 KiB
Plaintext
67 lines
2.1 KiB
Plaintext
Дата: 2026-10-09.
|
|
Рабочий каталог: lab2/mtusi2026lab2.
|
|
Индикаторы прогресса Docker сокращены; результаты SQL сохранены.
|
|
|
|
> docker compose up -d --wait postgres
|
|
postgres Pulled
|
|
Network messenger-lab2_default Created
|
|
Volume messenger-lab2_postgres_data Created
|
|
Container messenger-lab2-postgres-1 Healthy
|
|
|
|
> docker compose exec -T postgres psql -X -U messenger -d messenger -f /migrations/apply.psql
|
|
BEGIN
|
|
SET
|
|
SET
|
|
pg_advisory_xact_lock
|
|
-----------------------
|
|
|
|
(1 row)
|
|
|
|
CREATE TABLE
|
|
CREATE TABLE
|
|
CREATE TABLE
|
|
CREATE TABLE
|
|
CREATE INDEX
|
|
CREATE TABLE
|
|
CREATE INDEX
|
|
CREATE TABLE
|
|
CREATE INDEX
|
|
INSERT 0 1
|
|
Migration 000001 applied (commit follows).
|
|
COMMIT
|
|
|
|
> docker compose exec -T postgres psql -X -U messenger -d messenger -f /migrations/apply.psql
|
|
BEGIN
|
|
SET
|
|
SET
|
|
pg_advisory_xact_lock
|
|
-----------------------
|
|
|
|
(1 row)
|
|
|
|
CREATE TABLE
|
|
psql:/migrations/apply.psql:13: NOTICE: relation "schema_migrations" already exists, skipping
|
|
Migration 000001 already applied; skipping.
|
|
COMMIT
|
|
|
|
> docker compose exec -T postgres psql -X -U messenger -d messenger -c '\dt'
|
|
List of relations
|
|
Schema | Name | Type | Owner
|
|
--------+-------------------+-------+-----------
|
|
public | chat_members | table | messenger
|
|
public | chats | table | messenger
|
|
public | messages | table | messenger
|
|
public | schema_migrations | table | messenger
|
|
public | sessions | table | messenger
|
|
public | users | table | messenger
|
|
(6 rows)
|
|
|
|
> docker compose exec -T postgres psql -X -U messenger -d messenger -c 'TABLE schema_migrations;'
|
|
version | applied_at
|
|
---------+-------------------------------
|
|
1 | 2026-10-09 12:44:06.729345+00
|
|
(1 row)
|
|
|
|
Подтверждены запуск PostgreSQL на новом volume, применение версии 1 и её пропуск при повторном запуске.
|
|
Не проверены: сохранность бизнес-данных и сессий после рестарта, конкурентный запуск миграций, rollback при ошибке.
|