release: fix schemas
Build and Push Docker Image / build-and-push (push) Successful in 1m28s Details

This commit is contained in:
itqop 2025-11-12 21:19:45 +03:00
parent dac619dbdd
commit bafca0ed19
13 changed files with 24 additions and 22 deletions

View File

@ -17,7 +17,7 @@ jobs:
- name: Set release version manually
id: version
run: echo "version=0.2.0" >> "$GITHUB_OUTPUT"
run: echo "version=0.3.0" >> "$GITHUB_OUTPUT"
- name: Compute short SHA
id: gitvars

View File

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "hubgw"
version = "0.2.0"
version = "0.3.0"
description = "FastAPI Gateway for HubMC"
authors = ["itqop <leonkl32@gmail.com>"]
packages = [

View File

@ -45,6 +45,8 @@ class AppContext(metaclass=Singleton):
pool_recycle=True,
echo=self.settings.database.echo,
**engine_kwargs,
).execution_options(
schema_translate_map={None: self.settings.database.schema_}
)
Base.metadata.bind = self._engine
@ -80,6 +82,8 @@ class AppContext(metaclass=Singleton):
pool_recycle=True,
echo=self.settings.database.echo,
**engine_kwargs,
).execution_options(
schema_translate_map={None: self.settings.database.azuriom_schema}
)
Base.metadata.bind = self._azuriom_engine

View File

@ -43,6 +43,16 @@ class DatabaseSettings(BaseSettings):
validation_alias="DATABASE__AZURIOM_DATABASE",
description="Azuriom database name",
)
schema_: str = Field(
default="public",
validation_alias="DATABASE__SCHEMA",
description="Main database schema name",
)
azuriom_schema: str = Field(
default="public",
validation_alias="DATABASE__AZURIOM_SCHEMA",
description="Azuriom database schema name",
)
pool_size: int = Field(
default=10,
validation_alias="DATABASE__POOL_SIZE",

View File

@ -2,7 +2,7 @@
from sqlalchemy import Column, DateTime, func
from sqlalchemy.orm import DeclarativeBase, declared_attr
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
@ -12,8 +12,3 @@ class Base(DeclarativeBase):
updated_at = Column(
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
)
@declared_attr.directive
def __table_args__(cls):
"""Set default schema for all tables."""
return {"schema": "public"}

View File

@ -15,7 +15,6 @@ class Cooldown(Base):
UniqueConstraint(
"player_uuid", "cooldown_type", name="idx_hub_cooldowns_player_type"
),
{"schema": "public"},
)
id = Column(
@ -23,7 +22,7 @@ class Cooldown(Base):
)
player_uuid = Column(
String(36),
ForeignKey("hubmc.luckperms_players.uuid", ondelete="CASCADE"),
ForeignKey("luckperms_players.uuid", ondelete="CASCADE"),
nullable=False,
index=True,
)

View File

@ -13,7 +13,6 @@ class Home(Base):
__tablename__ = "hub_homes"
__table_args__ = (
UniqueConstraint("player_uuid", "name", name="idx_hub_homes_player_name"),
{"schema": "public"},
)
id = Column(
@ -21,7 +20,7 @@ class Home(Base):
)
player_uuid = Column(
String(36),
ForeignKey("hubmc.luckperms_players.uuid", ondelete="CASCADE"),
ForeignKey("luckperms_players.uuid", ondelete="CASCADE"),
nullable=False,
index=True,
)

View File

@ -41,13 +41,12 @@ class LuckPermsUserPermission(Base):
"server",
"world",
),
{"schema": "public"},
)
id = Column(Integer, primary_key=True, autoincrement=True)
uuid = Column(
String(36),
ForeignKey("hubmc.luckperms_players.uuid", ondelete="CASCADE"),
ForeignKey("luckperms_players.uuid", ondelete="CASCADE"),
nullable=False,
index=True,
)

View File

@ -33,7 +33,6 @@ class Punishment(Base):
"player_ip",
postgresql_where=Column("player_ip").is_not(None),
),
{"schema": "public"},
)
id = Column(
@ -41,7 +40,7 @@ class Punishment(Base):
)
player_uuid = Column(
String(36),
ForeignKey("hubmc.luckperms_players.uuid", ondelete="CASCADE"),
ForeignKey("luckperms_players.uuid", ondelete="CASCADE"),
nullable=False,
index=True,
)
@ -51,7 +50,7 @@ class Punishment(Base):
reason = Column(Text, nullable=False)
staff_uuid = Column(
String(36),
ForeignKey("hubmc.luckperms_players.uuid", ondelete="SET NULL"),
ForeignKey("luckperms_players.uuid", ondelete="SET NULL"),
nullable=False,
)
staff_name = Column(String(255), nullable=False)
@ -59,7 +58,7 @@ class Punishment(Base):
is_active = Column(Boolean, default=True)
revoked_at = Column(DateTime(timezone=True))
revoked_by = Column(
String(36), ForeignKey("hubmc.luckperms_players.uuid", ondelete="SET NULL")
String(36), ForeignKey("luckperms_players.uuid", ondelete="SET NULL")
)
revoked_reason = Column(Text)
evidence_url = Column(Text)

View File

@ -17,7 +17,7 @@ class TeleportHistory(Base):
)
player_uuid = Column(
String(36),
ForeignKey("hubmc.luckperms_players.uuid", ondelete="CASCADE"),
ForeignKey("luckperms_players.uuid", ondelete="CASCADE"),
nullable=False,
index=True,
)

View File

@ -34,5 +34,4 @@ class User(Base):
__table_args__ = (
Index("idx_users_email", "email", unique=True),
{"schema": "public"},
)

View File

@ -15,7 +15,6 @@ class Warp(Base):
Index(
"idx_hub_warps_public", "is_public", postgresql_where=Column("is_public")
),
{"schema": "public"},
)
id = Column(

View File

@ -21,7 +21,6 @@ class WhitelistEntry(Base):
"expires_at",
postgresql_where=Column("expires_at").is_not(None),
),
{"schema": "public"},
)
id = Column(