summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshihaoyue <[email protected]>2024-09-03 17:03:31 +0800
committershihaoyue <[email protected]>2024-09-03 17:03:31 +0800
commitfa33d507f466724e94b8f4582ed1262888e80499 (patch)
treeb71ac25f0ab3e4847cc91c2dc849a4e22f588355
parenta904be14c7b992c99df367f2b79326a7807a13e9 (diff)
更新模型
-rw-r--r--server/migrations/versions/ebb046c926d6_.py65
-rw-r--r--server/migrations/versions/f2858e8ec05d_.py34
-rw-r--r--server/model.py2
3 files changed, 100 insertions, 1 deletions
diff --git a/server/migrations/versions/ebb046c926d6_.py b/server/migrations/versions/ebb046c926d6_.py
new file mode 100644
index 0000000..4e91cf1
--- /dev/null
+++ b/server/migrations/versions/ebb046c926d6_.py
@@ -0,0 +1,65 @@
+"""empty message
+
+Revision ID: ebb046c926d6
+Revises: 176af7a75d22
+Create Date: 2024-09-03 16:21:46.167447
+
+"""
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import mysql
+
+# revision identifiers, used by Alembic.
+revision = 'ebb046c926d6'
+down_revision = '176af7a75d22'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('TARGET_STATUS',
+ sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
+ sa.Column('time', sa.DateTime(), server_default=sa.text('now()'), nullable=True),
+ sa.Column('tp_id', sa.Integer(), nullable=True),
+ sa.Column('icmp', sa.Float(), nullable=True),
+ sa.Column('tcp', sa.Float(), nullable=True),
+ sa.Column('dns', sa.Float(), nullable=True),
+ sa.Column('recode', sa.String(length=255), nullable=True),
+ sa.ForeignKeyConstraint(['tp_id'], ['TASK_POLICY.tp_id'], ),
+ sa.PrimaryKeyConstraint('id')
+ )
+ op.drop_table('output_cleaned')
+ with op.batch_alter_table('TASK_LOG', schema=None) as batch_op:
+ batch_op.drop_constraint('TASK_LOG_ibfk_1', type_='foreignkey')
+ batch_op.drop_column('created_by_agent')
+
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('TASK_LOG', schema=None) as batch_op:
+ batch_op.add_column(sa.Column('created_by_agent', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True))
+ batch_op.create_foreign_key('TASK_LOG_ibfk_1', 'AGENT', ['created_by_agent'], ['agent_id'])
+
+ op.create_table('output_cleaned',
+ sa.Column('addrv4', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True),
+ sa.Column('ipv6', mysql.INTEGER(), autoincrement=False, nullable=True),
+ sa.Column('addrv6', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True),
+ sa.Column('dnssec', mysql.INTEGER(), autoincrement=False, nullable=True),
+ sa.Column('dot', mysql.INTEGER(), autoincrement=False, nullable=True),
+ sa.Column('doh', mysql.INTEGER(), autoincrement=False, nullable=True),
+ sa.Column('cou', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True),
+ sa.Column('isp', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True),
+ sa.Column('lat', mysql.DOUBLE(asdecimal=True), nullable=True),
+ sa.Column('lng', mysql.DOUBLE(asdecimal=True), nullable=True),
+ sa.Column('updated_time', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True),
+ sa.Column('protect', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True),
+ sa.Column('doh_domain', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True),
+ mysql_collate='utf8_unicode_ci',
+ mysql_default_charset='utf8mb3',
+ mysql_engine='InnoDB'
+ )
+ op.drop_table('TARGET_STATUS')
+ # ### end Alembic commands ###
diff --git a/server/migrations/versions/f2858e8ec05d_.py b/server/migrations/versions/f2858e8ec05d_.py
new file mode 100644
index 0000000..e7b9f06
--- /dev/null
+++ b/server/migrations/versions/f2858e8ec05d_.py
@@ -0,0 +1,34 @@
+"""empty message
+
+Revision ID: f2858e8ec05d
+Revises: ebb046c926d6
+Create Date: 2024-09-03 17:03:00.349337
+
+"""
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import mysql
+
+# revision identifiers, used by Alembic.
+revision = 'f2858e8ec05d'
+down_revision = 'ebb046c926d6'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('TARGET_STATUS', schema=None) as batch_op:
+ batch_op.add_column(sa.Column('recorde', sa.Boolean(), nullable=True))
+ batch_op.drop_column('recode')
+
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('TARGET_STATUS', schema=None) as batch_op:
+ batch_op.add_column(sa.Column('recode', mysql.VARCHAR(collation='utf8_unicode_ci', length=255), nullable=True))
+ batch_op.drop_column('recorde')
+
+ # ### end Alembic commands ###
diff --git a/server/model.py b/server/model.py
index ff56ec5..24ae35f 100644
--- a/server/model.py
+++ b/server/model.py
@@ -68,7 +68,7 @@ class TargetStatus(db.Model):
icmp = db.Column(db.Float)
tcp = db.Column(db.Float)
dns = db.Column(db.Float)
- recode = db.Column(db.String(255))
+ recorde = db.Column(db.Boolean)
class TaskLog(db.Model):
__tablename__ = MYSQL_TAB_TASK_LOG