You've already forked RekomenciBackend
Merge branch 'main' of gitlab.prodcontest.com:team-39/backend
This commit is contained in:
+36
-52
@@ -223,12 +223,13 @@ build-migrations:
|
|||||||
CONTAINERFILE: Containerfile
|
CONTAINERFILE: Containerfile
|
||||||
BUILDTARGET: migrations
|
BUILDTARGET: migrations
|
||||||
|
|
||||||
build-ml:
|
# build-ml:
|
||||||
<<: *build-config
|
# <<: *build-config
|
||||||
variables:
|
# when: manual
|
||||||
IMAGE_NAME: $BASE_IMAGE_NAME/ml
|
# variables:
|
||||||
CONTAINERFILE: Containerfile
|
# IMAGE_NAME: $BASE_IMAGE_NAME/ml
|
||||||
BUILDTARGET: ml
|
# CONTAINERFILE: Containerfile
|
||||||
|
# BUILDTARGET: ml
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
<<: *uv-job
|
<<: *uv-job
|
||||||
@@ -245,55 +246,37 @@ lint:
|
|||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
|
|
||||||
test:
|
test:
|
||||||
<<: *buildah-job
|
|
||||||
stage: test
|
stage: test
|
||||||
|
tags:
|
||||||
|
- self-hosted
|
||||||
variables:
|
variables:
|
||||||
COMPOSE_PROFILES: |
|
COMPOSE_PROFILES: |
|
||||||
--profile migrations
|
--profile migrations
|
||||||
--profile tests
|
--profile tests
|
||||||
PODMAN_IGNORE_CGROUPSV1_WARNING: True
|
before_script:
|
||||||
tags:
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
|
||||||
- self-hosted
|
|
||||||
script:
|
script:
|
||||||
- dnf -y install podman podman-compose
|
|
||||||
# - cp ./infrastructure/configs/podman/ci.conf /etc/containers/containers.conf
|
|
||||||
- cp "$TEST_STAGE_FIREBASE_CONF" ./infrastructure/configs/backend/firebase.json
|
|
||||||
- podman info --format '{{.Host.EventLogger}}'
|
|
||||||
- export PROFILES="$(printf '%s ' $COMPOSE_PROFILES)"
|
- export PROFILES="$(printf '%s ' $COMPOSE_PROFILES)"
|
||||||
|
- cp "$TEST_STAGE_FIREBASE_CONF" ./infrastructure/configs/backend/firebase.json
|
||||||
|
|
||||||
- |
|
- |
|
||||||
(
|
(
|
||||||
while true; do
|
while true; do
|
||||||
podman-compose -f compose.yaml $PROFILES logs 2>&1
|
docker compose -f compose.yaml $PROFILES logs -f 2>&1
|
||||||
sleep 30
|
sleep 1
|
||||||
done
|
done
|
||||||
) | grep "Error: no container" -v | tee -a compose.log &
|
) | tee -a compose.log &
|
||||||
- LOGS_PID=$!
|
- LOGS_PID=$!
|
||||||
- |
|
|
||||||
(
|
|
||||||
while true; do
|
|
||||||
echo "Containers $(date)"
|
|
||||||
podman ps -a
|
|
||||||
sleep 10
|
|
||||||
done
|
|
||||||
) &
|
|
||||||
- |
|
- |
|
||||||
REGISTRY_PREFIX=$CI_REGISTRY_IMAGE IMAGE_TAG=$CI_COMMIT_SHA \
|
REGISTRY_PREFIX=$CI_REGISTRY_IMAGE IMAGE_TAG=$CI_COMMIT_SHA \
|
||||||
podman-compose -f compose.yaml -f compose.prod.yaml \
|
docker compose -f compose.yaml -f compose.prod.yaml \
|
||||||
$PROFILES up -d --no-build --pull 2>&1 | tee compose.log
|
$PROFILES up -d --quiet-pull --quiet-build 2>&1 | tee compose.log
|
||||||
|
|
||||||
TEST_CONTAINER_ID=$(
|
- |
|
||||||
podman-compose ps --all --format json \
|
TEST_CONTAINER_ID=$(docker compose -f compose.yaml $PROFILES ps -q tests -a)
|
||||||
| jq -r '.[] | select(.Labels["io.podman.compose.service"] == "tests") | .Id'
|
timeout 600 docker wait "$TEST_CONTAINER_ID"
|
||||||
)
|
TEST_EXIT_CODE=$(docker inspect --format "{{.State.ExitCode}}" "$TEST_CONTAINER_ID")
|
||||||
|
|
||||||
if [ -z "$TEST_CONTAINER_ID" ]; then
|
|
||||||
echo "Tests container not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
timeout 600 podman wait "$TEST_CONTAINER_ID"
|
|
||||||
TEST_EXIT_CODE=$(podman inspect --format "{{.State.ExitCode}}" "$TEST_CONTAINER_ID")
|
|
||||||
|
|
||||||
if [ "$TEST_EXIT_CODE" -eq 0 ]; then
|
if [ "$TEST_EXIT_CODE" -eq 0 ]; then
|
||||||
echo "Tests passed."
|
echo "Tests passed."
|
||||||
@@ -301,8 +284,7 @@ test:
|
|||||||
echo "Tests failed with exit code $TEST_EXIT_CODE."
|
echo "Tests failed with exit code $TEST_EXIT_CODE."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- |
|
- docker compose -f compose.yaml $PROFILES down
|
||||||
podman-compose -f compose.yaml $PROFILES down
|
|
||||||
- cat .cov/coverage.txt
|
- cat .cov/coverage.txt
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
@@ -350,13 +332,14 @@ sast-image-migrations:
|
|||||||
dependencies:
|
dependencies:
|
||||||
- build-migrations
|
- build-migrations
|
||||||
|
|
||||||
sast-image-ml:
|
# sast-image-ml:
|
||||||
<<: *trivy-image-scan
|
# <<: *trivy-image-scan
|
||||||
variables:
|
# when: manual
|
||||||
IMAGE_NAME: $BASE_IMAGE_NAME/ml
|
# variables:
|
||||||
IMAGE_TYPE: ml
|
# IMAGE_NAME: $BASE_IMAGE_NAME/ml
|
||||||
dependencies:
|
# IMAGE_TYPE: ml
|
||||||
- build-ml
|
# dependencies:
|
||||||
|
# - build-ml
|
||||||
|
|
||||||
tag-runtime:
|
tag-runtime:
|
||||||
<<: *tag-config
|
<<: *tag-config
|
||||||
@@ -373,10 +356,11 @@ tag-migrations:
|
|||||||
variables:
|
variables:
|
||||||
IMAGE_NAME: $BASE_IMAGE_NAME/backend-migrations
|
IMAGE_NAME: $BASE_IMAGE_NAME/backend-migrations
|
||||||
|
|
||||||
tag-ml:
|
# tag-ml:
|
||||||
<<: *tag-config
|
# <<: *tag-config
|
||||||
variables:
|
# when: manual
|
||||||
IMAGE_NAME: $BASE_IMAGE_NAME/ml
|
# variables:
|
||||||
|
# IMAGE_NAME: $BASE_IMAGE_NAME/ml
|
||||||
|
|
||||||
webhook-migrations-deploy:
|
webhook-migrations-deploy:
|
||||||
<<: *webhook-config
|
<<: *webhook-config
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
"""add resume
|
|
||||||
|
|
||||||
Revision ID: 0d2e7755303c
|
|
||||||
Revises: 9140c6824ab8
|
|
||||||
Create Date: 2025-11-22 00:08:04.421819
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = '0d2e7755303c'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = '9140c6824ab8'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('resume',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.Column('user_id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('position', sa.String(), nullable=False),
|
|
||||||
sa.Column('about_me', sa.String(), nullable=False),
|
|
||||||
sa.Column('key_skills', sa.String(), nullable=False),
|
|
||||||
sa.Column('experience_type', sa.String(), nullable=False),
|
|
||||||
sa.Column('down_resume_id', sa.UUID(), nullable=True, default=None),
|
|
||||||
sa.ForeignKeyConstraint(['down_resume_id'], ['resume.id'], ondelete='CASCADE'),
|
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('resume_embedding',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.Column('resume_id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('vector', sa.ARRAY(sa.Numeric()), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['resume_id'], ['resume.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
op.create_table('resume_prediction',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.Column('resume_id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('from_salary', sa.Numeric(), nullable=False),
|
|
||||||
sa.Column('to_salary', sa.Numeric(), nullable=False),
|
|
||||||
sa.Column('recommended_skills', sa.ARRAY(sa.Numeric()), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['resume_id'], ['resume.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_table('resume_prediction')
|
|
||||||
op.drop_table('resume_embedding')
|
|
||||||
op.drop_table('resume')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
"""
|
|
||||||
|
|
||||||
Revision ID: 2b2091969d4c
|
|
||||||
Revises: 2ebcb2592cab
|
|
||||||
Create Date: 2025-11-22 11:24:36.215215
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = '2b2091969d4c'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = '2ebcb2592cab'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.add_column('resume', sa.Column('up_resume_id', sa.UUID(), nullable=True))
|
|
||||||
op.create_foreign_key(None, 'resume', 'resume', ['up_resume_id'], ['id'], ondelete='CASCADE')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_constraint(None, 'resume', type_='foreignkey')
|
|
||||||
op.drop_column('resume', 'up_resume_id')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
"""add key skills
|
|
||||||
|
|
||||||
Revision ID: 2ebcb2592cab
|
|
||||||
Revises: 5b7a1ca1f06b
|
|
||||||
Create Date: 2025-11-22 03:59:55.147083
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = '2ebcb2592cab'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = '5b7a1ca1f06b'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('key_skills',
|
|
||||||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
|
||||||
sa.Column('name', sa.String(), nullable=False),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('name')
|
|
||||||
)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_table('key_skills')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
"""fix resume types
|
|
||||||
|
|
||||||
Revision ID: 5b7a1ca1f06b
|
|
||||||
Revises: 0d2e7755303c
|
|
||||||
Create Date: 2025-11-22 01:12:18.097168
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
from sqlalchemy.dialects import postgresql
|
|
||||||
from pgvector.sqlalchemy import Vector
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = '5b7a1ca1f06b'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = '0d2e7755303c'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.alter_column('resume_embedding', 'vector',
|
|
||||||
existing_type=postgresql.ARRAY(sa.NUMERIC()),
|
|
||||||
type_=Vector(),
|
|
||||||
existing_nullable=False)
|
|
||||||
op.alter_column('resume_prediction', 'recommended_skills',
|
|
||||||
existing_type=postgresql.ARRAY(sa.NUMERIC()),
|
|
||||||
type_=sa.ARRAY(sa.String(), as_tuple=True),
|
|
||||||
existing_nullable=False)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.alter_column('resume_prediction', 'recommended_skills',
|
|
||||||
existing_type=sa.ARRAY(sa.String(), as_tuple=True),
|
|
||||||
type_=postgresql.ARRAY(sa.NUMERIC()),
|
|
||||||
existing_nullable=False)
|
|
||||||
op.alter_column('resume_embedding', 'vector',
|
|
||||||
existing_type=pgvector.sqlalchemy.vector.VECTOR(),
|
|
||||||
type_=postgresql.ARRAY(sa.NUMERIC()),
|
|
||||||
existing_nullable=False)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 892aba57b356
|
||||||
|
Revises:
|
||||||
|
Create Date: 2025-11-22 18:19:36.694430
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
import pgvector.sqlalchemy
|
||||||
|
from sqlalchemy import Text
|
||||||
|
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
||||||
|
import template_project.adapters.data_gateways.tables
|
||||||
|
from template_project.adapters.data_gateways.tables import StringArrayType
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = '892aba57b356'
|
||||||
|
down_revision: Union[str, Sequence[str], None] = None
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
"""Upgrade schema."""
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table('key_skills',
|
||||||
|
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
|
||||||
|
sa.Column('name', sa.String(), nullable=False),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('name')
|
||||||
|
)
|
||||||
|
op.create_table('users',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('access_token',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('user_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('revoked', sa.Boolean(), nullable=False),
|
||||||
|
sa.Column('expires_in', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('auth_identities',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('user_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('method', sa.Enum('EMAIL', 'YANDEX', name='auth_method'), nullable=False),
|
||||||
|
sa.Column('identifier', sa.String(), nullable=False),
|
||||||
|
sa.Column('secret_key', sa.String(), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('method', 'identifier', name='uq_auth_method_identifier')
|
||||||
|
)
|
||||||
|
op.create_table('notification_devices',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('user_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('device_id', sa.String(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('user_id', 'device_id', name='uq_user_device')
|
||||||
|
)
|
||||||
|
op.create_table('profiles',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('user_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('email', sa.String(), nullable=True),
|
||||||
|
sa.Column('display_name', sa.String(), nullable=True),
|
||||||
|
sa.Column('first_name', sa.String(), nullable=True),
|
||||||
|
sa.Column('last_name', sa.String(), nullable=True),
|
||||||
|
sa.Column('avatar_url', sa.String(), nullable=True),
|
||||||
|
sa.Column('phone', sa.String(), nullable=True),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id'),
|
||||||
|
sa.UniqueConstraint('user_id')
|
||||||
|
)
|
||||||
|
op.create_table('resume',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('user_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('position', sa.String(), nullable=False),
|
||||||
|
sa.Column('location', sa.String(), nullable=False),
|
||||||
|
sa.Column('about_me', sa.String(), nullable=False),
|
||||||
|
sa.Column('key_skills', StringArrayType(astext_type=Text()), server_default=sa.text("'[]'::jsonb"), nullable=False),
|
||||||
|
sa.Column('experience_type', sa.String(), nullable=False),
|
||||||
|
sa.Column('down_resume_id', sa.UUID(), nullable=True),
|
||||||
|
sa.Column('up_resume_id', sa.UUID(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['down_resume_id'], ['resume.id'], ondelete='CASCADE'),
|
||||||
|
sa.ForeignKeyConstraint(['up_resume_id'], ['resume.id'], ondelete='CASCADE'),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('resume_education',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('resume_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('place', sa.String(), nullable=False),
|
||||||
|
sa.Column('grade', sa.Enum('BASIC_GENERAL_EDUCATION', 'SECONDARY_GENERAL_EDUCATION', 'SECONDARY_PROFESSIONAL_EDUCATION', 'BACHELOR', 'SPECIALIST', 'MASTER', 'POSTGRADUATE_STUDIES', 'OTHER', name='education_grade'), nullable=False),
|
||||||
|
sa.Column('specialization', sa.String(), nullable=False),
|
||||||
|
sa.Column('description', sa.String(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['resume_id'], ['resume.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('resume_embedding',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('resume_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('vector', pgvector.sqlalchemy.vector.VECTOR(), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['resume_id'], ['resume.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('resume_experience',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('resume_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('place', sa.String(), nullable=False),
|
||||||
|
sa.Column('description', sa.String(), nullable=False),
|
||||||
|
sa.Column('months_duration', sa.Integer(), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['resume_id'], ['resume.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('resume_prediction',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('resume_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('from_salary', sa.Numeric(), nullable=False),
|
||||||
|
sa.Column('to_salary', sa.Numeric(), nullable=False),
|
||||||
|
sa.Column('recommended_skills', template_project.adapters.data_gateways.tables.StringArrayType(astext_type=Text()), server_default=sa.text("'[]'::jsonb"), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['resume_id'], ['resume.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table('resume_project',
|
||||||
|
sa.Column('id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('resume_id', sa.UUID(), nullable=False),
|
||||||
|
sa.Column('name', sa.String(), nullable=False),
|
||||||
|
sa.Column('description', sa.String(), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(['resume_id'], ['resume.id'], ondelete='CASCADE'),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
"""Downgrade schema."""
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_table('resume_project')
|
||||||
|
op.drop_table('resume_prediction')
|
||||||
|
op.drop_table('resume_experience')
|
||||||
|
op.drop_table('resume_embedding')
|
||||||
|
op.drop_table('resume_education')
|
||||||
|
op.drop_table('resume')
|
||||||
|
op.drop_table('profiles')
|
||||||
|
op.drop_table('notification_devices')
|
||||||
|
op.drop_table('auth_identities')
|
||||||
|
op.drop_table('access_token')
|
||||||
|
op.drop_table('users')
|
||||||
|
op.drop_table('key_skills')
|
||||||
|
# ### end Alembic commands ###
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: 9140c6824ab8
|
|
||||||
Revises: b5fa4f3e95c5
|
|
||||||
Create Date: 2025-11-20 20:57:31.722554
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = '9140c6824ab8'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = 'b5fa4f3e95c5'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('notification_devices',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('user_id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('device_id', sa.String(), nullable=False),
|
|
||||||
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('user_id', 'device_id', name='uq_user_device')
|
|
||||||
)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_table('notification_devices')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: ad80834713c3
|
|
||||||
Revises:
|
|
||||||
Create Date: 2025-11-12 00:03:31.080899
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = 'ad80834713c3'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = None
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('users',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('email', sa.String(), nullable=False),
|
|
||||||
sa.Column('hashed_password', sa.String(), nullable=False),
|
|
||||||
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('email')
|
|
||||||
)
|
|
||||||
op.create_table('access_token',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('user_id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('revoked', sa.Boolean(), nullable=False),
|
|
||||||
sa.Column('expires_in', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id')
|
|
||||||
)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_table('access_token')
|
|
||||||
op.drop_table('users')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: b5fa4f3e95c5
|
|
||||||
Revises: f29dccaa6356
|
|
||||||
Create Date: 2025-11-20 01:13:13.877236
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = 'b5fa4f3e95c5'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = 'f29dccaa6356'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('profiles',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('user_id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('email', sa.String(), nullable=True),
|
|
||||||
sa.Column('display_name', sa.String(), nullable=True),
|
|
||||||
sa.Column('first_name', sa.String(), nullable=True),
|
|
||||||
sa.Column('last_name', sa.String(), nullable=True),
|
|
||||||
sa.Column('avatar_url', sa.String(), nullable=True),
|
|
||||||
sa.Column('phone', sa.String(), nullable=True),
|
|
||||||
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('user_id')
|
|
||||||
)
|
|
||||||
op.drop_constraint(op.f('users_email_key'), 'users', type_='unique')
|
|
||||||
op.drop_column('users', 'hashed_password')
|
|
||||||
op.drop_column('users', 'email')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.add_column('users', sa.Column('email', sa.VARCHAR(), autoincrement=False, nullable=True))
|
|
||||||
op.add_column('users', sa.Column('hashed_password', sa.VARCHAR(), autoincrement=False, nullable=True))
|
|
||||||
op.create_unique_constraint(op.f('users_email_key'), 'users', ['email'], postgresql_nulls_not_distinct=False)
|
|
||||||
op.drop_table('profiles')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: f29dccaa6356
|
|
||||||
Revises: ad80834713c3
|
|
||||||
Create Date: 2025-11-18 00:14:48.550720
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = 'f29dccaa6356'
|
|
||||||
down_revision: Union[str, Sequence[str], None] = 'ad80834713c3'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Upgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.create_table('auth_identities',
|
|
||||||
sa.Column('id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('user_id', sa.UUID(), nullable=False),
|
|
||||||
sa.Column('method', sa.Enum('EMAIL', 'YANDEX', name='auth_method'), nullable=False),
|
|
||||||
sa.Column('identifier', sa.String(), nullable=False),
|
|
||||||
sa.Column('secret_key', sa.String(), nullable=True),
|
|
||||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('method', 'identifier', name='uq_auth_method_identifier')
|
|
||||||
)
|
|
||||||
op.alter_column('users', 'email',
|
|
||||||
existing_type=sa.VARCHAR(),
|
|
||||||
nullable=True)
|
|
||||||
op.alter_column('users', 'hashed_password',
|
|
||||||
existing_type=sa.VARCHAR(),
|
|
||||||
nullable=True)
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Downgrade schema."""
|
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.alter_column('users', 'hashed_password',
|
|
||||||
existing_type=sa.VARCHAR(),
|
|
||||||
nullable=False)
|
|
||||||
op.alter_column('users', 'email',
|
|
||||||
existing_type=sa.VARCHAR(),
|
|
||||||
nullable=False)
|
|
||||||
op.drop_table('auth_identities')
|
|
||||||
# ### end Alembic commands ###
|
|
||||||
Reference in New Issue
Block a user