Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,8 @@ UUID
lexicographically
Lexicographically
backport
TTL
queryable
substring
NotFoundError
QueryNotSupportedError
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ help:
@echo " redis start a Redis instance with Docker"
@echo " sync generate modules redis_om, tests_sync from aredis_om, tests respectively"
@echo " dist build a redis-om package"
@echo " docs start the docs server locally for preview"
@echo " all equivalent to \"make lint format test\""
@echo ""
@echo "Check the Makefile to know exactly what each target is doing."
Expand Down Expand Up @@ -49,17 +50,16 @@ sync: $(INSTALL_STAMP)
$(UV) run python make_sync.py

.PHONY: lint
lint: $(INSTALL_STAMP) dist
$(UV) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME) $(SYNC_NAME)
$(UV) run black ./tests/ $(NAME)
$(UV) run flake8 --ignore=E231,E501,E712,E731,F401,W503 ./tests/ $(NAME) $(SYNC_NAME)
lint: $(INSTALL_STAMP) sync
$(UV) run ruff check ./tests/ $(NAME) $(SYNC_NAME)
$(UV) run ruff format --check ./tests/ $(NAME) $(SYNC_NAME)
$(UV) run mypy ./tests/ --ignore-missing-imports --exclude migrate.py --exclude _compat\.py$$
$(UV) run bandit -r $(NAME) $(SYNC_NAME) -s B608

.PHONY: format
format: $(INSTALL_STAMP) sync
$(UV) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME) $(SYNC_NAME)
$(UV) run black ./tests/ $(NAME) $(SYNC_NAME)
$(UV) run ruff check --fix ./tests/ $(NAME) $(SYNC_NAME)
$(UV) run ruff format ./tests/ $(NAME) $(SYNC_NAME)

.PHONY: test
test: $(INSTALL_STAMP) sync redis
Expand All @@ -77,5 +77,9 @@ test_oss: $(INSTALL_STAMP) sync redis
redis:
docker compose up -d

.PHONY: docs
docs: $(INSTALL_STAMP)
$(UV) run mkdocs serve

.PHONY: all
all: lint format test
1 change: 1 addition & 0 deletions aredis_om/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
)
from .model.types import Coordinates, GeoFilter


# Backward compatibility alias - deprecated, use SchemaDetector or SchemaMigrator
Migrator = SchemaDetector

Expand Down
4 changes: 3 additions & 1 deletion aredis_om/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
Union,
)
from typing import get_args as typing_get_args
from typing import no_type_check
from typing import (
no_type_check,
)

from more_itertools import ichunked
from pydantic import BaseModel
Expand Down
22 changes: 0 additions & 22 deletions docs/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ If you're upgrading from Redis OM Python 0.x to 1.0, see the **[0.x to 1.0 Migra
## CLI Commands

```bash
# Schema migrations (recommended)
om migrate # File-based schema migrations with rollback support
om migrate-data # Data migrations and transformations

# Legacy command (deprecated)
migrate # Automatic schema migrations (use om migrate instead)
```

## Schema Migrations
Expand Down Expand Up @@ -57,24 +53,6 @@ om migrate run
om migrate run --migrations-dir myapp/schema-migrations
```

> **Note**: The legacy `migrate` command performs automatic migrations without file tracking and is deprecated. Use `om migrate` for production deployments.

### Migration Approaches

Redis OM provides two approaches to schema migrations:

#### File-based Migrations (`om migrate`) - Recommended
- **Controlled**: Migrations are saved as versioned files
- **Rollback**: Previous schemas can be restored
- **Team-friendly**: Migration files can be committed to git
- **Production-safe**: Explicit migration approval workflow

#### Automatic Migrations (`migrate`) - Deprecated
- **Immediate**: Detects and applies changes instantly
- **No rollback**: Cannot undo schema changes
- **Development-only**: Suitable for rapid prototyping
- **⚠️ Deprecated**: Use `om migrate` for production

### How File-based Migration Works

1. **Detection**: Auto-migrator detects index changes from your models
Expand Down
Loading
Loading