mirror of
https://github.com/MCMi460/3DS-RPC.git
synced 2025-06-18 21:45:37 -04:00
Rename columns to match model
This additionally introduces a unique constraint over `site_session_token` which was somehow missing from databases previously.
This commit is contained in:
parent
06745ec069
commit
cf30aff113
@ -44,15 +44,15 @@ class Friend(Base):
|
|||||||
friend_code: Mapped[str] = mapped_column("friend_code", primary_key=True, nullable=False, unique=True)
|
friend_code: Mapped[str] = mapped_column("friend_code", primary_key=True, nullable=False, unique=True)
|
||||||
network: Mapped[NetworkType] = mapped_column("network", NetworkTypeValue(), index=True)
|
network: Mapped[NetworkType] = mapped_column("network", NetworkTypeValue(), index=True)
|
||||||
online: Mapped[bool]
|
online: Mapped[bool]
|
||||||
title_id: Mapped[str] = mapped_column("title_id", nullable=False)
|
title_id: Mapped[str]
|
||||||
upd_id: Mapped[str] = mapped_column("upd_id", nullable=False)
|
upd_id: Mapped[str]
|
||||||
last_accessed: Mapped[int] = mapped_column("last_accessed", BigInteger(), nullable=False)
|
last_accessed: Mapped[int] = mapped_column("last_accessed", BigInteger(), nullable=False)
|
||||||
account_creation: Mapped[int] = mapped_column("account_creation", BigInteger(), nullable=False)
|
account_creation: Mapped[int] = mapped_column("account_creation", BigInteger(), nullable=False)
|
||||||
username: Mapped[Optional[str]]
|
username: Mapped[Optional[str]]
|
||||||
message: Mapped[Optional[str]]
|
message: Mapped[Optional[str]]
|
||||||
mii: Mapped[Optional[str]]
|
mii: Mapped[Optional[str]]
|
||||||
joinable: Mapped[Optional[bool]]
|
joinable: Mapped[Optional[bool]]
|
||||||
game_description: Mapped[Optional[str]] = mapped_column("game_description")
|
game_description: Mapped[Optional[str]]
|
||||||
last_online: Mapped[int] = mapped_column("last_online", BigInteger(), nullable=False)
|
last_online: Mapped[int] = mapped_column("last_online", BigInteger(), nullable=False)
|
||||||
favorite_game: Mapped[int] = mapped_column("favorite_game", BigInteger(), nullable=False)
|
favorite_game: Mapped[int] = mapped_column("favorite_game", BigInteger(), nullable=False)
|
||||||
|
|
||||||
@ -63,17 +63,17 @@ class DiscordFriends(Base):
|
|||||||
id: Mapped[int] = mapped_column(BigInteger(), primary_key=True)
|
id: Mapped[int] = mapped_column(BigInteger(), primary_key=True)
|
||||||
friend_code: Mapped[str] = mapped_column("friend_code", primary_key=True, nullable=False)
|
friend_code: Mapped[str] = mapped_column("friend_code", primary_key=True, nullable=False)
|
||||||
network: Mapped[NetworkType] = mapped_column("network", NetworkTypeValue())
|
network: Mapped[NetworkType] = mapped_column("network", NetworkTypeValue())
|
||||||
active: Mapped[bool] = mapped_column(nullable=False)
|
active: Mapped[bool]
|
||||||
|
|
||||||
|
|
||||||
class Discord(Base):
|
class Discord(Base):
|
||||||
__tablename__ = "discord"
|
__tablename__ = "discord"
|
||||||
|
|
||||||
id: Mapped[int] = mapped_column("id", BigInteger(), primary_key=True, nullable=False, unique=True)
|
id: Mapped[int] = mapped_column("id", BigInteger(), primary_key=True, nullable=False, unique=True)
|
||||||
refresh_token: Mapped[str] = mapped_column("refresh", nullable=False)
|
refresh_token: Mapped[str]
|
||||||
bearer_token: Mapped[str] = mapped_column("bearer", nullable=False)
|
bearer_token: Mapped[str]
|
||||||
rpc_session_token: Mapped[Optional[str]] = mapped_column("session")
|
rpc_session_token: Mapped[Optional[str]]
|
||||||
site_session_token: Mapped[Optional[str]] = mapped_column("token", unique=True)
|
site_session_token: Mapped[Optional[str]] = mapped_column("site_session_token", unique=True)
|
||||||
last_accessed: Mapped[int] = mapped_column("last_accessed", BigInteger(), nullable=False)
|
last_accessed: Mapped[int] = mapped_column("last_accessed", BigInteger(), nullable=False)
|
||||||
generation_date: Mapped[int] = mapped_column("generation_date", BigInteger(), nullable=False)
|
generation_date: Mapped[int] = mapped_column("generation_date", BigInteger(), nullable=False)
|
||||||
show_profile_button: Mapped[bool] = mapped_column("show_profile_button", nullable=False, default=True)
|
show_profile_button: Mapped[bool] = mapped_column("show_profile_button", nullable=False, default=True)
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
"""Rename columns to match model
|
||||||
|
|
||||||
|
Revision ID: 054789972051
|
||||||
|
Revises: ed39a1af1115
|
||||||
|
Create Date: 2024-09-24 13:12:12.075111
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '054789972051'
|
||||||
|
down_revision = 'ed39a1af1115'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
with op.batch_alter_table('discord', schema=None) as batch_op:
|
||||||
|
batch_op.alter_column('refresh', new_column_name='refresh_token')
|
||||||
|
batch_op.alter_column('bearer', new_column_name='bearer_token')
|
||||||
|
batch_op.alter_column('session', new_column_name='rpc_session_token')
|
||||||
|
batch_op.alter_column('token', new_column_name='site_session_token')
|
||||||
|
batch_op.create_unique_constraint('discord_pk', ['site_session_token'])
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
with op.batch_alter_table('discord', schema=None) as batch_op:
|
||||||
|
batch_op.alter_column('refresh_token', new_column_name='refresh')
|
||||||
|
batch_op.alter_column('bearer_token', new_column_name='bearer')
|
||||||
|
batch_op.alter_column('rpc_session_token', new_column_name='session')
|
||||||
|
batch_op.alter_column('site_session_token', new_column_name='token')
|
||||||
|
batch_op.drop_constraint('discord_pk', type_='unique')
|
Loading…
Reference in New Issue
Block a user