rollback tablename settings
This commit is contained in:
parent
21b85d7cfa
commit
7dbd25b894
3 changed files with 8 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Python representation of `devices` table.
|
Python representation of `device` table.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
@ -44,18 +44,16 @@ class DeviceRead(DeviceBase):
|
||||||
|
|
||||||
class Device(DeviceBase, table=True):
|
class Device(DeviceBase, table=True):
|
||||||
"""
|
"""
|
||||||
Representation of `devices` table
|
Representation of `device` table
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = "devices"
|
|
||||||
|
|
||||||
__table_args__ = (UniqueConstraint(
|
__table_args__ = (UniqueConstraint(
|
||||||
"owner_name",
|
"owner_name",
|
||||||
"name",
|
"name",
|
||||||
),)
|
),)
|
||||||
|
|
||||||
id: int | None = Field(primary_key=True)
|
id: int | None = Field(primary_key=True)
|
||||||
owner_name: str | None = Field(foreign_key="users.name")
|
owner_name: str | None = Field(foreign_key="user.name")
|
||||||
|
|
||||||
# no idea, but "User" (in quotes) doesn't work here
|
# no idea, but "User" (in quotes) doesn't work here
|
||||||
# might be a future problem?
|
# might be a future problem?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Python representation of `users` table.
|
Python representation of `user` table.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
@ -72,11 +72,9 @@ class UserRead(UserBase):
|
||||||
|
|
||||||
class User(UserBase, table=True):
|
class User(UserBase, table=True):
|
||||||
"""
|
"""
|
||||||
Representation of `users` table
|
Representation of `user` table
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = "users"
|
|
||||||
|
|
||||||
password: str
|
password: str
|
||||||
|
|
||||||
capabilities: list[UserCapability] = Relationship(
|
capabilities: list[UserCapability] = Relationship(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Python representation of `user_capabilities` table.
|
Python representation of `user_capability` table.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
@ -46,12 +46,10 @@ class UserCapabilityBase(SQLModel):
|
||||||
|
|
||||||
class UserCapability(UserCapabilityBase, table=True):
|
class UserCapability(UserCapabilityBase, table=True):
|
||||||
"""
|
"""
|
||||||
Representation of `user_capabilities` table
|
Representation of `user_capability` table
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = "user_capabilities"
|
user_name: str = Field(primary_key=True, foreign_key="user.name")
|
||||||
|
|
||||||
user_name: str = Field(primary_key=True, foreign_key="users.name")
|
|
||||||
|
|
||||||
user: "User" = Relationship(
|
user: "User" = Relationship(
|
||||||
back_populates="capabilities",
|
back_populates="capabilities",
|
||||||
|
|
Loading…
Reference in a new issue