fix: update default value for expires_at in DatasourceProvider model

This commit is contained in:
Harry 2025-08-11 11:40:51 +08:00
parent 6b07e0e8d6
commit ada0875ac4
3 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,33 @@
"""datasource_oauth_refresh
Revision ID: 17d4db47800c
Revises: 223c3f882c69
Create Date: 2025-08-11 11:38:03.662874
"""
from alembic import op
import models as models
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '17d4db47800c'
down_revision = '223c3f882c69'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('datasource_providers', schema=None) as batch_op:
batch_op.add_column(sa.Column('expires_at', sa.Integer(), nullable=False, server_default='-1'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('datasource_providers', schema=None) as batch_op:
batch_op.drop_column('expires_at')
# ### end Alembic commands ###

View File

@ -37,7 +37,7 @@ class DatasourceProvider(Base):
encrypted_credentials: Mapped[dict] = db.Column(JSONB, nullable=False)
avatar_url: Mapped[str] = db.Column(db.String(255), nullable=True, default="default")
is_default: Mapped[bool] = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
expires_at: Mapped[int] = db.Column(db.Integer, nullable=False, default=-1)
expires_at: Mapped[int] = db.Column(db.Integer, nullable=False, server_default='-1')
created_at: Mapped[datetime] = db.Column(db.DateTime, nullable=False, default=datetime.now)
updated_at: Mapped[datetime] = db.Column(db.DateTime, nullable=False, default=datetime.now)

15
web/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}