diff --git a/migrations/versions/898f00ea481e_add_mint_currency_refund_details.py b/migrations/versions/898f00ea481e_add_mint_currency_refund_details.py new file mode 100644 index 00000000..9730a2cc --- /dev/null +++ b/migrations/versions/898f00ea481e_add_mint_currency_refund_details.py @@ -0,0 +1,38 @@ +"""add mint+currency refund details + +Revision ID: 898f00ea481e +Revises: 7bc4e8b02b9d +Create Date: 2025-08-13 16:45:42.148314 +""" + +import sqlalchemy as sa +import sqlmodel +from alembic import op + +# revision identifiers, used by Alembic. +revision = "898f00ea481e" +down_revision = "7bc4e8b02b9d" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column( + "api_keys", + sa.Column("refund_mint_url", sqlmodel.sql.sqltypes.AutoString(), nullable=True), + ) + op.add_column( + "api_keys", + sa.Column("refund_currency", sqlmodel.sql.sqltypes.AutoString(), nullable=True), + ) + op.drop_column("api_keys", "mint_url") + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column("api_keys", sa.Column("mint_url", sa.VARCHAR(), nullable=True)) + op.drop_column("api_keys", "refund_currency") + op.drop_column("api_keys", "refund_mint_url") + # ### end Alembic commands ### diff --git a/routstr/core/db.py b/routstr/core/db.py index ac94b291..0b1db704 100644 --- a/routstr/core/db.py +++ b/routstr/core/db.py @@ -35,10 +35,14 @@ class ApiKey(SQLModel, table=True): # type: ignore default=0, description="Total spent in millisatoshis (msats)" ) total_requests: int = Field(default=0) - mint_url: str | None = Field( + refund_mint_url: str | None = Field( default=None, description="URL of the mint used to create the cashu-token", ) + refund_currency: str | None = Field( + default=None, + description="Currency of the cashu-token", + ) async def init_db() -> None: