Skip to content

Commit

Permalink
Merge pull request #168 from mekanix/abstract-roles
Browse files Browse the repository at this point in the history
Make BaseRole abstract
  • Loading branch information
mekanix authored Feb 1, 2025
2 parents d86a51c + eae099c commit f323d63
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""initial
Revision ID: baf1dd67f3ed
Revision ID: f2a9191e9157
Revises:
Create Date: 2025-01-27 17:11:10.217492
Create Date: 2025-02-01 13:43:38.485626
"""

Expand All @@ -11,7 +11,7 @@


# revision identifiers, used by Alembic.
revision = "baf1dd67f3ed"
revision = "f2a9191e9157"
down_revision = None
branch_labels = None
depends_on = None
Expand All @@ -24,8 +24,8 @@ def upgrade():
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sa.Text(), nullable=False),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("name"),
)
op.create_index(op.f("ix_roles_name"), "roles", ["name"], unique=True)
op.create_table(
"themes",
sa.Column("id", sa.Integer(), nullable=False),
Expand All @@ -51,7 +51,7 @@ def upgrade():
"users",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("email", sa.Text(), nullable=False),
sa.Column("password", sa.Text(), nullable=True),
sa.Column("password", sa.Text(), nullable=False),
sa.Column("fullname", sa.Text(), nullable=True),
sa.Column("active", sa.Boolean(), nullable=True),
sa.Column("admin", sa.Boolean(), nullable=True),
Expand Down Expand Up @@ -87,5 +87,6 @@ def downgrade():
op.drop_table("users_roles")
op.drop_table("users")
op.drop_table("themes")
op.drop_index(op.f("ix_roles_name"), table_name="roles")
op.drop_table("roles")
# ### end Alembic commands ###
2 changes: 1 addition & 1 deletion freenit/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.12"
__version__ = "0.3.13"
2 changes: 1 addition & 1 deletion freenit/models/sql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ def make_optional(OptionalModel):


class BaseRole(OrmarBaseModel, OrmarRoleMixin):
ormar_config = ormar_config.copy()
ormar_config = ormar_config.copy(abstract=True)
2 changes: 1 addition & 1 deletion freenit/models/sql/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Role(BaseRole):
ormar_config = ormar_config.copy()


class RoleOptional(BaseRole):
class RoleOptional(BaseRole.get_pydantic()):
pass


Expand Down

0 comments on commit f323d63

Please sign in to comment.