initial openlane project
This commit is contained in:
@@ -10,8 +10,8 @@ from sqlalchemy import engine_from_config, pool
|
||||
# Добавляем корень проекта в sys.path
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
from iaai_scraper.core.config import Settings
|
||||
from iaai_scraper.storage.models import Base
|
||||
from openlane_scraper.core.config import Settings
|
||||
from openlane_scraper.storage.models import Base
|
||||
|
||||
config = context.config
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Таблица cars — аукционные машины с IAAI
|
||||
# Таблица cars
|
||||
op.create_table(
|
||||
"cars",
|
||||
sa.Column("id", sa.BigInteger, primary_key=True, autoincrement=True),
|
||||
|
||||
@@ -10,12 +10,12 @@ depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Partial index для активных машин IAAI (is_sold = FALSE)
|
||||
# Partial index для активных машин OpenLane (is_sold = FALSE)
|
||||
# Ускоряет поиск при mark_sold операциях
|
||||
op.execute(
|
||||
"CREATE INDEX IF NOT EXISTS ix_cars_active_iaai "
|
||||
"CREATE INDEX IF NOT EXISTS ix_cars_active_openlane "
|
||||
"ON cars (origin_url) "
|
||||
"WHERE is_sold = FALSE AND origin_id LIKE 'iaai:%'"
|
||||
"WHERE is_sold = FALSE AND origin_id LIKE 'openlane:%'"
|
||||
)
|
||||
|
||||
# Composite index для проверки дубликатов изображений
|
||||
@@ -35,4 +35,4 @@ def upgrade() -> None:
|
||||
def downgrade() -> None:
|
||||
op.execute("DROP INDEX IF EXISTS ix_cars_origin_url_id")
|
||||
op.drop_index("ix_images_car_id_fullres", table_name="images")
|
||||
op.execute("DROP INDEX IF EXISTS ix_cars_active_iaai")
|
||||
op.execute("DROP INDEX IF EXISTS ix_cars_active_openlane")
|
||||
|
||||
Reference in New Issue
Block a user