From 7dbd25b89432a4745593ad8ab60d63d3a4aa5780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Mon, 28 Mar 2022 21:54:39 +0000 Subject: [PATCH] rollback tablename settings --- api/kiwi_vpn_api/db/device.py | 8 +++----- api/kiwi_vpn_api/db/user.py | 6 ++---- api/kiwi_vpn_api/db/user_capability.py | 8 +++----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/api/kiwi_vpn_api/db/device.py b/api/kiwi_vpn_api/db/device.py index 449b64a..ff791e0 100644 --- a/api/kiwi_vpn_api/db/device.py +++ b/api/kiwi_vpn_api/db/device.py @@ -1,5 +1,5 @@ """ -Python representation of `devices` table. +Python representation of `device` table. """ from __future__ import annotations @@ -44,18 +44,16 @@ class DeviceRead(DeviceBase): class Device(DeviceBase, table=True): """ - Representation of `devices` table + Representation of `device` table """ - __tablename__ = "devices" - __table_args__ = (UniqueConstraint( "owner_name", "name", ),) 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 # might be a future problem? diff --git a/api/kiwi_vpn_api/db/user.py b/api/kiwi_vpn_api/db/user.py index 2058cd6..d535a6f 100644 --- a/api/kiwi_vpn_api/db/user.py +++ b/api/kiwi_vpn_api/db/user.py @@ -1,5 +1,5 @@ """ -Python representation of `users` table. +Python representation of `user` table. """ from __future__ import annotations @@ -72,11 +72,9 @@ class UserRead(UserBase): class User(UserBase, table=True): """ - Representation of `users` table + Representation of `user` table """ - __tablename__ = "users" - password: str capabilities: list[UserCapability] = Relationship( diff --git a/api/kiwi_vpn_api/db/user_capability.py b/api/kiwi_vpn_api/db/user_capability.py index e41a0e8..479fec4 100644 --- a/api/kiwi_vpn_api/db/user_capability.py +++ b/api/kiwi_vpn_api/db/user_capability.py @@ -1,5 +1,5 @@ """ -Python representation of `user_capabilities` table. +Python representation of `user_capability` table. """ from enum import Enum @@ -46,12 +46,10 @@ class UserCapabilityBase(SQLModel): 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="users.name") + user_name: str = Field(primary_key=True, foreign_key="user.name") user: "User" = Relationship( back_populates="capabilities",