45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
|
|
#
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
"""Added webauthn
|
|
|
|
Revision ID: 25f2c34a69c8
|
|
Revises: 97144a8cf6b6
|
|
Create Date: 2022-12-17 16:53:28.909124
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import ormar
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "25f2c34a69c8"
|
|
down_revision = "97144a8cf6b6"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"fido_credentials",
|
|
sa.Column("pk", sa.Integer(), nullable=False),
|
|
sa.Column("id", sa.LargeBinary(length=256), nullable=False),
|
|
sa.Column("public_key", sa.LargeBinary(length=256), nullable=False),
|
|
sa.Column("sign_count", sa.Integer(), nullable=False),
|
|
sa.Column("user", ormar.fields.sqlalchemy_uuid.CHAR(32), nullable=True),
|
|
sa.ForeignKeyConstraint(["user"], ["users.id"], name="fk_fido_credentials_users_id_user"),
|
|
sa.PrimaryKeyConstraint("pk"),
|
|
)
|
|
op.add_column("users", sa.Column("require_password", sa.Boolean(), nullable=False, server_default="f"))
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_column("users", "require_password")
|
|
op.drop_table("fido_credentials")
|
|
# ### end Alembic commands ###
|