python -m src.infrastructure.database.migration_runnerpython -m src.infrastructure.database.migration_runner statuscat > src/infrastructure/database/migrations/002_create_products.sql << EOF
create table if not exists products (
id serial primary key,
name varchar(255) not null,
price decimal(10, 2) not null,
created_at timestamp default current_timestamp
);
create index idx_products_name on products(name);
EOFpython -m src.infrastructure.database.migration_runnercreate table if not exists orders (
id serial primary key,
user_id integer references users(id) on delete cascade,
total_amount decimal(10, 2) not null
);alter table users add column if not exists phone varchar(20);create index if not exists idx_users_phone on users(phone);- ✅ Формат:
{номер}_{описание}.sql(001, 002, 003) - ✅ Используй
if not exists/if exists - ✅ Одна миграция = одно изменение
- ✅ Не редактируй применённые миграции
📖 Полное руководство: docs/MIGRATIONS_GUIDE.md