-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more important settings to Web-UI to manage better and easiest (#53)
* Add some settings to Web-UI to manage better and easiest * Add SUBSCRIPTION_BASE_URL to DB settings
- Loading branch information
Showing
8 changed files
with
168 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/migration/alembic/versions/47010335de98_move_some_settings_to_db.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
"""Move some settings to DB | ||
Revision ID: 47010335de98 | ||
Revises: a00786a4da47 | ||
Create Date: 2024-11-30 22:17:52.510679 | ||
""" | ||
|
||
from datetime import datetime | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from src import config | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "47010335de98" | ||
down_revision = "a00786a4da47" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
config_settings_table = sa.table( | ||
"config_settings", | ||
sa.Column("key", sa.String(), nullable=False), | ||
sa.Column("value", sa.String(), nullable=True), | ||
sa.Column("value_type", sa.String(), nullable=True), | ||
sa.Column("updated_at", sa.DateTime(), nullable=True), | ||
# Add other columns as needed | ||
) | ||
op.bulk_insert( | ||
config_settings_table, | ||
[ | ||
{ | ||
"key": "TEST_SERVICE_ID", | ||
"value": config.TEST_SERVICE_ID, | ||
"value_type": "int", | ||
"updated_at": datetime.utcnow(), | ||
}, | ||
{ | ||
"key": "TELEGRAM_CHANNEL", | ||
"value": config.TELEGRAM_CHANNEL, | ||
"value_type": "str", | ||
"updated_at": datetime.utcnow(), | ||
}, | ||
{ | ||
"key": "BOT_USER_NAME", | ||
"value": config.BOT_USER_NAME, | ||
"value_type": "str", | ||
"updated_at": datetime.utcnow(), | ||
}, | ||
{ | ||
"key": "UVICORN_HOST", | ||
"value": config.UVICORN_HOST, | ||
"value_type": "str", | ||
"updated_at": datetime.utcnow(), | ||
}, | ||
{ | ||
"key": "UVICORN_PORT", | ||
"value": config.UVICORN_PORT, | ||
"value_type": "int", | ||
"updated_at": datetime.utcnow(), | ||
}, | ||
], | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f("ix_config_settings_key"), table_name="config_settings") | ||
op.create_index("ix_config_settings_key", "config_settings", ["key"], unique=False) | ||
# ### end Alembic commands ### |
50 changes: 50 additions & 0 deletions
50
src/migration/alembic/versions/b1bc7aad133f_add_subscription_base_url_settings_to_db.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Add SUBSCRIPTION_BASE_URL settings to DB | ||
Revision ID: b1bc7aad133f | ||
Revises: 47010335de98 | ||
Create Date: 2024-11-30 22:53:24.042474 | ||
""" | ||
from datetime import datetime | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from src import config | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'b1bc7aad133f' | ||
down_revision = '47010335de98' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
config_settings_table = sa.table( | ||
"config_settings", | ||
sa.Column("key", sa.String(), nullable=False), | ||
sa.Column("value", sa.String(), nullable=True), | ||
sa.Column("value_type", sa.String(), nullable=True), | ||
sa.Column("updated_at", sa.DateTime(), nullable=True), | ||
# Add other columns as needed | ||
) | ||
op.bulk_insert( | ||
config_settings_table, | ||
[ | ||
{ | ||
"key": "SUBSCRIPTION_BASE_URL", | ||
"value": config.SUBSCRIPTION_BASE_URL, | ||
"value_type": "str", | ||
"updated_at": datetime.utcnow(), | ||
} | ||
], | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f('ix_config_settings_key'), table_name='config_settings') | ||
op.create_index('ix_config_settings_key', 'config_settings', ['key'], unique=False) | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters