1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00
Files
AdministrationItDepartmens/backend/alembic/versions/add_admin_user.py
MoonTestUse1 c90ca5394a base7
2025-01-03 23:46:44 +06:00

27 lines
763 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""add admin user
Revision ID: add_admin_user
Revises: initial_schema
Create Date: 2024-01-03 21:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
from datetime import datetime
# revision identifiers, used by Alembic.
revision = 'add_admin_user'
down_revision = 'initial_schema'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Добавляем админа с id = -1
op.execute("""
INSERT INTO employees (id, first_name, last_name, department, office, hashed_password)
VALUES (-1, 'Admin', 'Admin', 'IT', 'HQ', '$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewKyNiAYEPFr.6Ja')
ON CONFLICT (id) DO NOTHING;
""")
def downgrade() -> None:
op.execute("DELETE FROM employees WHERE id = -1;")