From b0092bb0c1587e32a6bd371934257d6ee0305191 Mon Sep 17 00:00:00 2001 From: zhangsan <646228430@qq.com> Date: Mon, 29 Jul 2024 17:26:18 +0800 Subject: [PATCH] second --- README.md | 22 +++++- flask_app/__init__.py | 34 +++++---- flask_app/detect/ct_dataset.py | 2 - flask_app/models.py | 3 +- flaskapp.py | 18 +++-- migrations/README | 1 - migrations/alembic.ini | 50 ------------- migrations/env.py | 105 --------------------------- migrations/script.py.mako | 24 ------ migrations/versions/0232292c96ab_.py | 35 --------- migrations/versions/02b3b778cb77_.py | 36 --------- migrations/versions/0dde8306cfab_.py | 51 ------------- migrations/versions/0df253550689_.py | 50 ------------- migrations/versions/169f586b8369_.py | 48 ------------ migrations/versions/1a574337293a_.py | 37 ---------- migrations/versions/1c5ef9475969_.py | 35 --------- migrations/versions/279578d46236_.py | 32 -------- migrations/versions/2961517be887_.py | 32 -------- migrations/versions/2a6772c55c55_.py | 32 -------- migrations/versions/31222bff99e8_.py | 32 -------- migrations/versions/31f169c37c61_.py | 34 --------- migrations/versions/36b005d8e480_.py | 79 -------------------- migrations/versions/39e44c8af34c_.py | 32 -------- migrations/versions/411a1d0b9294_.py | 57 --------------- migrations/versions/49aeda2e2b80_.py | 36 --------- migrations/versions/4a9d1ba8736e_.py | 35 --------- migrations/versions/5bcae7b12e80_.py | 54 -------------- migrations/versions/5f6e19ecdbaf_.py | 32 -------- migrations/versions/60bd7995263a_.py | 34 --------- migrations/versions/6419f62abd69_.py | 43 ----------- migrations/versions/6630335c7b63_.py | 52 ------------- migrations/versions/688e06991331_.py | 37 ---------- migrations/versions/698ff838fb8e_.py | 40 ---------- migrations/versions/72bce1509968_.py | 36 --------- migrations/versions/7738309ad0d0_.py | 34 --------- migrations/versions/8a31f809b808_.py | 34 --------- migrations/versions/98fe9675245a_.py | 32 -------- migrations/versions/990cd6f0472e_.py | 32 -------- migrations/versions/a6858c0553e9_.py | 34 --------- migrations/versions/a89a0dc536df_.py | 34 --------- migrations/versions/bad91e69ca34_.py | 32 -------- migrations/versions/bb3518c7dc22_.py | 38 ---------- migrations/versions/bd0f2e72956b_.py | 38 ---------- migrations/versions/c47fdd1a45f9_.py | 38 ---------- migrations/versions/c9210e82abc5_.py | 36 --------- migrations/versions/d270947beff6_.py | 43 ----------- migrations/versions/d46f10b87507_.py | 32 -------- migrations/versions/d4aafb947dc3_.py | 36 --------- migrations/versions/d5b377434283_.py | 34 --------- migrations/versions/dfa6be070d7e_.py | 46 ------------ migrations/versions/e0b52571de61_.py | 43 ----------- migrations/versions/e345198c92d5_.py | 34 --------- migrations/versions/e559de4fd2c3_.py | 34 --------- migrations/versions/ef4643db2b6e_.py | 96 ------------------------ migrations/versions/f5bf87849ce2_.py | 32 -------- migrations/versions/f7a9296b6817_.py | 40 ---------- migrations/versions/fa9fad0a40c3_.py | 61 ---------------- migrations/versions/ffde36a65d1a_.py | 32 -------- requirements.txt | 12 ++- 59 files changed, 59 insertions(+), 2178 deletions(-) delete mode 100644 migrations/README delete mode 100644 migrations/alembic.ini delete mode 100644 migrations/env.py delete mode 100644 migrations/script.py.mako delete mode 100644 migrations/versions/0232292c96ab_.py delete mode 100644 migrations/versions/02b3b778cb77_.py delete mode 100644 migrations/versions/0dde8306cfab_.py delete mode 100644 migrations/versions/0df253550689_.py delete mode 100644 migrations/versions/169f586b8369_.py delete mode 100644 migrations/versions/1a574337293a_.py delete mode 100644 migrations/versions/1c5ef9475969_.py delete mode 100644 migrations/versions/279578d46236_.py delete mode 100644 migrations/versions/2961517be887_.py delete mode 100644 migrations/versions/2a6772c55c55_.py delete mode 100644 migrations/versions/31222bff99e8_.py delete mode 100644 migrations/versions/31f169c37c61_.py delete mode 100644 migrations/versions/36b005d8e480_.py delete mode 100644 migrations/versions/39e44c8af34c_.py delete mode 100644 migrations/versions/411a1d0b9294_.py delete mode 100644 migrations/versions/49aeda2e2b80_.py delete mode 100644 migrations/versions/4a9d1ba8736e_.py delete mode 100644 migrations/versions/5bcae7b12e80_.py delete mode 100644 migrations/versions/5f6e19ecdbaf_.py delete mode 100644 migrations/versions/60bd7995263a_.py delete mode 100644 migrations/versions/6419f62abd69_.py delete mode 100644 migrations/versions/6630335c7b63_.py delete mode 100644 migrations/versions/688e06991331_.py delete mode 100644 migrations/versions/698ff838fb8e_.py delete mode 100644 migrations/versions/72bce1509968_.py delete mode 100644 migrations/versions/7738309ad0d0_.py delete mode 100644 migrations/versions/8a31f809b808_.py delete mode 100644 migrations/versions/98fe9675245a_.py delete mode 100644 migrations/versions/990cd6f0472e_.py delete mode 100644 migrations/versions/a6858c0553e9_.py delete mode 100644 migrations/versions/a89a0dc536df_.py delete mode 100644 migrations/versions/bad91e69ca34_.py delete mode 100644 migrations/versions/bb3518c7dc22_.py delete mode 100644 migrations/versions/bd0f2e72956b_.py delete mode 100644 migrations/versions/c47fdd1a45f9_.py delete mode 100644 migrations/versions/c9210e82abc5_.py delete mode 100644 migrations/versions/d270947beff6_.py delete mode 100644 migrations/versions/d46f10b87507_.py delete mode 100644 migrations/versions/d4aafb947dc3_.py delete mode 100644 migrations/versions/d5b377434283_.py delete mode 100644 migrations/versions/dfa6be070d7e_.py delete mode 100644 migrations/versions/e0b52571de61_.py delete mode 100644 migrations/versions/e345198c92d5_.py delete mode 100644 migrations/versions/e559de4fd2c3_.py delete mode 100644 migrations/versions/ef4643db2b6e_.py delete mode 100644 migrations/versions/f5bf87849ce2_.py delete mode 100644 migrations/versions/f7a9296b6817_.py delete mode 100644 migrations/versions/fa9fad0a40c3_.py delete mode 100644 migrations/versions/ffde36a65d1a_.py diff --git a/README.md b/README.md index fb107f0..2e6d9d3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,19 @@ ## 如何运行? - 1.pip install -r requirements.txt - 2.配置数据库,在config.py文件中(项目根目录下),SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:123456@localhost/covid_detector' - 2.命令行输入 run.bat - 3.浏览器输入http://127.0.0.1:5000/ +1.pip install -r requirements.txt +2.配置数据库,在config.py文件中(项目根目录下),SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:123456@localhost/covid_detector' + +默认mysql的端口为3306 root:123456 分别是用户名 密码 ,covid_detector 是数据库 + +3.使用navicat创建covid_detector数据库(与代码中保持一致) + +4.可以先删除migrations文件夹,然后conda activate激活环境,在命令行输入: + +1. set FLASK_APP=flaskapp.py +2. flask db init +3. flask db upgrade + +以上步骤结束会在数据库中创建若干空表 + +2.命令行输入 run.bat + +3.浏览器输入http://127.0.0.1:5000/即可访问主页。 diff --git a/flask_app/__init__.py b/flask_app/__init__.py index fa41b36..d8ce9c1 100644 --- a/flask_app/__init__.py +++ b/flask_app/__init__.py @@ -1,45 +1,51 @@ -from flask import Flask,session +from flask import Flask from flask_mail import Mail from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager +from flask_migrate import Migrate from config import config from flask_moment import Moment from flask_bootstrap import Bootstrap -# 创建 Flask 应用对象 ;app -# 通过配置文件或环境变量加载应用配置; -# 初始化扩展对象,如数据库、邮件等; -# 注册蓝图(Blueprint)对象,将不同模块的视图函数注册到应用中; -# 返回 Flask 应用对象 。app + mail = Mail() db = SQLAlchemy() moment = Moment() -bootstrap=Bootstrap() +bootstrap = Bootstrap() login_manager = LoginManager() login_manager.login_view = 'auth.login' + + def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) config[config_name].init_app(app) - mail.init_app(app) #将 Flask 应用程序与 Flask-Mail 扩展库绑定 + + mail.init_app(app) db.init_app(app) moment.init_app(app) login_manager.init_app(app) bootstrap.init_app(app) + + migrate = Migrate(app, db) # Initialize Flask-Migrate + + # 确保在此处导入模型,以便 Flask-SQLAlchemy 能够识别 + from . import models + from .main import main as main_blueprint app.register_blueprint(main_blueprint) from .auth import auth as auth_blueprint - app.register_blueprint(auth_blueprint) + app.register_blueprint(auth_blueprint, url_prefix='/auth') from .user import user as user_blueprint - app.register_blueprint(user_blueprint) + app.register_blueprint(user_blueprint, url_prefix='/user') from .appointment import appointment as appointment_blueprint - app.register_blueprint(appointment_blueprint) + app.register_blueprint(appointment_blueprint, url_prefix='/appointment') from .faqs import faqs as faqs_blueprint - app.register_blueprint(faqs_blueprint) + app.register_blueprint(faqs_blueprint, url_prefix='/faqs') - # from .detect import detect as detect_blueprint - # app.register_blueprint(detect_blueprint) + from .detect import detect as detect_blueprint + app.register_blueprint(detect_blueprint) return app diff --git a/flask_app/detect/ct_dataset.py b/flask_app/detect/ct_dataset.py index 241f008..06019d6 100644 --- a/flask_app/detect/ct_dataset.py +++ b/flask_app/detect/ct_dataset.py @@ -1,5 +1,3 @@ -import os -import numpy as np import tensorflow as tf class COVIDxCTDataset: diff --git a/flask_app/models.py b/flask_app/models.py index 8db43e7..d568804 100644 --- a/flask_app/models.py +++ b/flask_app/models.py @@ -3,8 +3,7 @@ import random from werkzeug.security import generate_password_hash, check_password_hash from flask_login import UserMixin,AnonymousUserMixin from . import db, login_manager -from itsdangerous import TimedJSONWebSignatureSerializer as Serializer -from flask import current_app + class Permission: FOLLOW = 1 diff --git a/flaskapp.py b/flaskapp.py index 5a99bd7..3c70d92 100644 --- a/flaskapp.py +++ b/flaskapp.py @@ -1,7 +1,13 @@ import os -import click -from flask_migrate import Migrate -from flask_app import create_app,db -from flask_app.models import User, Role -app = create_app(os.getenv('FLASK_CONFIG') or 'default') #默认开发模式 -migrate = Migrate(app, db) \ No newline at end of file +from flask_script import Manager +from flask_migrate import Migrate, MigrateCommand +from flask_app import create_app, db + +app = create_app(os.getenv('FLASK_CONFIG') or 'default') +migrate = Migrate(app, db) +manager = Manager(app) + +manager.add_command('db', MigrateCommand) + +if __name__ == '__main__': + manager.run() diff --git a/migrations/README b/migrations/README deleted file mode 100644 index 0e04844..0000000 --- a/migrations/README +++ /dev/null @@ -1 +0,0 @@ -Single-database configuration for Flask. diff --git a/migrations/alembic.ini b/migrations/alembic.ini deleted file mode 100644 index ec9d45c..0000000 --- a/migrations/alembic.ini +++ /dev/null @@ -1,50 +0,0 @@ -# A generic, single database configuration. - -[alembic] -# template used to generate migration files -# file_template = %%(rev)s_%%(slug)s - -# set to 'true' to run the environment during -# the 'revision' command, regardless of autogenerate -# revision_environment = false - - -# Logging configuration -[loggers] -keys = root,sqlalchemy,alembic,flask_migrate - -[handlers] -keys = console - -[formatters] -keys = generic - -[logger_root] -level = WARN -handlers = console -qualname = - -[logger_sqlalchemy] -level = WARN -handlers = -qualname = sqlalchemy.engine - -[logger_alembic] -level = INFO -handlers = -qualname = alembic - -[logger_flask_migrate] -level = INFO -handlers = -qualname = flask_migrate - -[handler_console] -class = StreamHandler -args = (sys.stderr,) -level = NOTSET -formatter = generic - -[formatter_generic] -format = %(levelname)-5.5s [%(name)s] %(message)s -datefmt = %H:%M:%S diff --git a/migrations/env.py b/migrations/env.py deleted file mode 100644 index fa412e8..0000000 --- a/migrations/env.py +++ /dev/null @@ -1,105 +0,0 @@ -from __future__ import with_statement - -import logging -from logging.config import fileConfig - -from flask import current_app - -from alembic import context - -# this is the Alembic Config object, which provides -# access to the values within the .ini file in use. -config = context.config - -# Interpret the config file for Python logging. -# This line sets up loggers basically. -fileConfig(config.config_file_name) -logger = logging.getLogger('alembic.env') - - -def get_engine(): - try: - # this works with Flask-SQLAlchemy<3 and Alchemical - return current_app.extensions['migrate'].db.get_engine() - except TypeError: - # this works with Flask-SQLAlchemy>=3 - return current_app.extensions['migrate'].db.engine - - -# add your model's MetaData object here -# for 'autogenerate' support -# from myapp import mymodel -# target_metadata = mymodel.Base.metadata -config.set_main_option( - 'sqlalchemy.url', str(get_engine().url).replace('%', '%%')) -target_db = current_app.extensions['migrate'].db - -# other values from the config, defined by the needs of env.py, -# can be acquired: -# my_important_option = config.get_main_option("my_important_option") -# ... etc. - - -def get_metadata(): - if hasattr(target_db, 'metadatas'): - return target_db.metadatas[None] - return target_db.metadata - - -def run_migrations_offline(): - """Run migrations in 'offline' mode. - - This configures the context with just a URL - and not an Engine, though an Engine is acceptable - here as well. By skipping the Engine creation - we don't even need a DBAPI to be available. - - Calls to context.execute() here emit the given string to the - script output. - - """ - url = config.get_main_option("sqlalchemy.url") - context.configure( - url=url, target_metadata=get_metadata(), literal_binds=True - ) - - with context.begin_transaction(): - context.run_migrations() - - -def run_migrations_online(): - """Run migrations in 'online' mode. - - In this scenario we need to create an Engine - and associate a connection with the context. - - """ - - # this callback is used to prevent an auto-migration from being generated - # when there are no changes to the schema - # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html - def process_revision_directives(context, revision, directives): - if getattr(config.cmd_opts, 'autogenerate', False): - script = directives[0] - if script.upgrade_ops.is_empty(): - directives[:] = [] - logger.info('No changes in schema detected.') - - connectable = get_engine() - - with connectable.connect() as connection: - context.configure( - connection=connection, - target_metadata=get_metadata(), - process_revision_directives=process_revision_directives, - **current_app.extensions['migrate'].configure_args - ) - - with context.begin_transaction(): - context.run_migrations() - - -if context.is_offline_mode(): - run_migrations_offline() -else: - run_migrations_online() diff --git a/migrations/script.py.mako b/migrations/script.py.mako deleted file mode 100644 index 715b001..0000000 --- a/migrations/script.py.mako +++ /dev/null @@ -1,24 +0,0 @@ - """${message} - -Revision ID: ${up_revision} -Revises: ${down_revision | comma,n} -Create Date: ${create_date} - -""" -from alembic import op -import sqlalchemy as sa -${imports if imports else ""} - -# revision identifiers, used by Alembic. -revision = ${repr(up_revision)} -down_revision = ${repr(down_revision)} -branch_labels = ${repr(branch_labels)} -depends_on = ${repr(depends_on)} - - -def upgrade(): - ${upgrades if upgrades else "pass"} - - -def downgrade(): - ${downgrades if downgrades else "pass"} diff --git a/migrations/versions/0232292c96ab_.py b/migrations/versions/0232292c96ab_.py deleted file mode 100644 index 41d1eda..0000000 --- a/migrations/versions/0232292c96ab_.py +++ /dev/null @@ -1,35 +0,0 @@ -"""empty message - -Revision ID: 0232292c96ab -Revises: e0b52571de61 -Create Date: 2023-04-20 19:52:09.265045 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '0232292c96ab' -down_revision = 'e0b52571de61' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('call_numbers', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('appointment_id', sa.Integer(), nullable=True), - sa.Column('notified', sa.Boolean(), nullable=True), - sa.Column('call_time', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['appointment_id'], ['appointment.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('call_numbers') - # ### end Alembic commands ### diff --git a/migrations/versions/02b3b778cb77_.py b/migrations/versions/02b3b778cb77_.py deleted file mode 100644 index eabb3ed..0000000 --- a/migrations/versions/02b3b778cb77_.py +++ /dev/null @@ -1,36 +0,0 @@ -"""empty message - -Revision ID: 02b3b778cb77 -Revises: 990cd6f0472e -Create Date: 2023-04-20 19:32:12.155188 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '02b3b778cb77' -down_revision = '990cd6f0472e' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('status', sa.String(length=20), nullable=True)) - batch_op.add_column(sa.Column('notified', sa.Boolean(), nullable=True)) - batch_op.drop_column('has_called') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('has_called', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True)) - batch_op.drop_column('notified') - batch_op.drop_column('status') - - # ### end Alembic commands ### diff --git a/migrations/versions/0dde8306cfab_.py b/migrations/versions/0dde8306cfab_.py deleted file mode 100644 index 5fe8f51..0000000 --- a/migrations/versions/0dde8306cfab_.py +++ /dev/null @@ -1,51 +0,0 @@ -"""empty message - -Revision ID: 0dde8306cfab -Revises: -Create Date: 2023-04-02 15:09:09.251414 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '0dde8306cfab' -down_revision = None -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('roles', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=True), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('name') - ) - op.create_table('users', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('email', sa.String(length=64), nullable=True), - sa.Column('username', sa.String(length=64), nullable=True), - sa.Column('role_id', sa.Integer(), nullable=True), - sa.Column('password_hash', sa.String(length=128), nullable=True), - sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_users_email'), ['email'], unique=True) - batch_op.create_index(batch_op.f('ix_users_username'), ['username'], unique=True) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_users_username')) - batch_op.drop_index(batch_op.f('ix_users_email')) - - op.drop_table('users') - op.drop_table('roles') - # ### end Alembic commands ### diff --git a/migrations/versions/0df253550689_.py b/migrations/versions/0df253550689_.py deleted file mode 100644 index c6fd33e..0000000 --- a/migrations/versions/0df253550689_.py +++ /dev/null @@ -1,50 +0,0 @@ -"""empty message - -Revision ID: 0df253550689 -Revises: 1a574337293a -Create Date: 2023-04-22 10:33:01.833957 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '0df253550689' -down_revision = '1a574337293a' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('private_messages', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('sender_id', sa.Integer(), nullable=True), - sa.Column('recipient_id', sa.Integer(), nullable=True), - sa.Column('body', sa.Text(), nullable=True), - sa.Column('time', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['recipient_id'], ['users.id'], ), - sa.ForeignKeyConstraint(['sender_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - op.drop_table('messages') - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('messages', - sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), - sa.Column('sender_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('recipient_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('body', mysql.TEXT(), nullable=True), - sa.Column('time', mysql.DATETIME(), nullable=True), - sa.ForeignKeyConstraint(['recipient_id'], ['users.id'], name='messages_ibfk_1'), - sa.ForeignKeyConstraint(['sender_id'], ['users.id'], name='messages_ibfk_2'), - sa.PrimaryKeyConstraint('id'), - mysql_default_charset='utf8', - mysql_engine='InnoDB' - ) - op.drop_table('private_messages') - # ### end Alembic commands ### diff --git a/migrations/versions/169f586b8369_.py b/migrations/versions/169f586b8369_.py deleted file mode 100644 index 2f06563..0000000 --- a/migrations/versions/169f586b8369_.py +++ /dev/null @@ -1,48 +0,0 @@ -"""empty message - -Revision ID: 169f586b8369 -Revises: a6858c0553e9 -Create Date: 2023-04-14 14:31:04.633225 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '169f586b8369' -down_revision = 'a6858c0553e9' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('email', sa.String(length=64), nullable=True)) - batch_op.add_column(sa.Column('name', sa.String(length=64), nullable=True)) - batch_op.add_column(sa.Column('location', sa.String(length=64), nullable=True)) - batch_op.add_column(sa.Column('gender', sa.String(length=5), nullable=True)) - batch_op.add_column(sa.Column('address', sa.String(length=256), nullable=True)) - batch_op.add_column(sa.Column('phone', sa.String(length=15), nullable=True)) - batch_op.add_column(sa.Column('age', sa.Integer(), nullable=True)) - batch_op.add_column(sa.Column('id_number', sa.String(length=64), nullable=True)) - batch_op.create_index(batch_op.f('ix_appointment_email'), ['email'], unique=True) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_appointment_email')) - batch_op.drop_column('id_number') - batch_op.drop_column('age') - batch_op.drop_column('phone') - batch_op.drop_column('address') - batch_op.drop_column('gender') - batch_op.drop_column('location') - batch_op.drop_column('name') - batch_op.drop_column('email') - - # ### end Alembic commands ### diff --git a/migrations/versions/1a574337293a_.py b/migrations/versions/1a574337293a_.py deleted file mode 100644 index 4b3d2e6..0000000 --- a/migrations/versions/1a574337293a_.py +++ /dev/null @@ -1,37 +0,0 @@ -"""empty message - -Revision ID: 1a574337293a -Revises: 0232292c96ab -Create Date: 2023-04-22 10:28:36.617214 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '1a574337293a' -down_revision = '0232292c96ab' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('messages', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('sender_id', sa.Integer(), nullable=True), - sa.Column('recipient_id', sa.Integer(), nullable=True), - sa.Column('body', sa.Text(), nullable=True), - sa.Column('time', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['recipient_id'], ['users.id'], ), - sa.ForeignKeyConstraint(['sender_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('messages') - # ### end Alembic commands ### diff --git a/migrations/versions/1c5ef9475969_.py b/migrations/versions/1c5ef9475969_.py deleted file mode 100644 index 1b94ef9..0000000 --- a/migrations/versions/1c5ef9475969_.py +++ /dev/null @@ -1,35 +0,0 @@ -"""empty message - -Revision ID: 1c5ef9475969 -Revises: 6419f62abd69 -Create Date: 2023-04-11 12:38:22.601185 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '1c5ef9475969' -down_revision = '6419f62abd69' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('likes', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=True), - sa.Column('post_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('likes') - # ### end Alembic commands ### diff --git a/migrations/versions/279578d46236_.py b/migrations/versions/279578d46236_.py deleted file mode 100644 index 4f53a4e..0000000 --- a/migrations/versions/279578d46236_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 279578d46236 -Revises: 2a6772c55c55 -Create Date: 2023-04-15 15:00:54.859894 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '279578d46236' -down_revision = '2a6772c55c55' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('num', sa.Integer(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_column('num') - - # ### end Alembic commands ### diff --git a/migrations/versions/2961517be887_.py b/migrations/versions/2961517be887_.py deleted file mode 100644 index 8987599..0000000 --- a/migrations/versions/2961517be887_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 2961517be887 -Revises: 8a31f809b808 -Create Date: 2023-04-15 18:23:26.756873 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '2961517be887' -down_revision = '8a31f809b808' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('id_number', sa.String(length=64), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('id_number') - - # ### end Alembic commands ### diff --git a/migrations/versions/2a6772c55c55_.py b/migrations/versions/2a6772c55c55_.py deleted file mode 100644 index 50ad544..0000000 --- a/migrations/versions/2a6772c55c55_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 2a6772c55c55 -Revises: 60bd7995263a -Create Date: 2023-04-15 14:38:43.754851 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '2a6772c55c55' -down_revision = '60bd7995263a' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('cost', sa.Integer(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_column('cost') - - # ### end Alembic commands ### diff --git a/migrations/versions/31222bff99e8_.py b/migrations/versions/31222bff99e8_.py deleted file mode 100644 index 8621de3..0000000 --- a/migrations/versions/31222bff99e8_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 31222bff99e8 -Revises: 0dde8306cfab -Create Date: 2023-04-03 09:55:34.224070 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '31222bff99e8' -down_revision = '0dde8306cfab' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('confirmed', sa.Boolean(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('confirmed') - - # ### end Alembic commands ### diff --git a/migrations/versions/31f169c37c61_.py b/migrations/versions/31f169c37c61_.py deleted file mode 100644 index a426fbc..0000000 --- a/migrations/versions/31f169c37c61_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: 31f169c37c61 -Revises: dfa6be070d7e -Create Date: 2023-04-07 14:08:34.257702 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '31f169c37c61' -down_revision = 'dfa6be070d7e' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('has_avatar', sa.Boolean(), nullable=True)) - batch_op.drop_column('avatar_path') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('avatar_path', mysql.VARCHAR(length=256), nullable=True)) - batch_op.drop_column('has_avatar') - - # ### end Alembic commands ### diff --git a/migrations/versions/36b005d8e480_.py b/migrations/versions/36b005d8e480_.py deleted file mode 100644 index 217a17a..0000000 --- a/migrations/versions/36b005d8e480_.py +++ /dev/null @@ -1,79 +0,0 @@ -"""empty message - -Revision ID: 36b005d8e480 -Revises: ef4643db2b6e -Create Date: 2023-04-23 21:24:19.183397 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '36b005d8e480' -down_revision = 'ef4643db2b6e' -branch_labels = None -depends_on = None - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.drop_constraint(None, type_='foreignkey') - batch_op.create_foreign_key('reports_ibfk_1', 'appointment_info', ['appointment_id'], ['id']) - - with op.batch_alter_table('call_numbers', schema=None) as batch_op: - batch_op.drop_constraint(None, type_='foreignkey') - batch_op.create_foreign_key('call_numbers_ibfk_1', 'appointment_info', ['appointment_id'], ['id']) - - op.create_table('comment_fordoc', - sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), - sa.Column('body', mysql.TEXT(), nullable=True), - sa.Column('timestamp', mysql.DATETIME(), nullable=True), - sa.Column('author_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('doc_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('star_num', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.ForeignKeyConstraint(['author_id'], ['users.id'], name='comment_fordoc_ibfk_1'), - sa.ForeignKeyConstraint(['doc_id'], ['users.id'], name='comment_fordoc_ibfk_2'), - sa.PrimaryKeyConstraint('id'), - mysql_default_charset='utf8', - mysql_engine='InnoDB' - ) - with op.batch_alter_table('comment_fordoc', schema=None) as batch_op: - batch_op.create_index('ix_doccomments_timestamp', ['timestamp'], unique=False) - - op.create_table('appointment_info', - sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), - sa.Column('patient_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('doc_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('date', sa.DATE(), nullable=True), - sa.Column('email', mysql.VARCHAR(length=256), nullable=True), - sa.Column('name', mysql.VARCHAR(length=256), nullable=True), - sa.Column('gender', mysql.VARCHAR(length=256), nullable=True), - sa.Column('phone', mysql.VARCHAR(length=256), nullable=True), - sa.Column('age', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('id_number', mysql.VARCHAR(length=256), nullable=True), - sa.Column('time', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('location', mysql.VARCHAR(length=256), nullable=True), - sa.Column('cost', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('num', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.ForeignKeyConstraint(['doc_id'], ['users.id'], name='appointment_info_ibfk_1'), - sa.ForeignKeyConstraint(['patient_id'], ['users.id'], name='appointment_info_ibfk_2'), - sa.PrimaryKeyConstraint('id'), - mysql_default_charset='utf8', - mysql_engine='InnoDB' - ) - with op.batch_alter_table('appointment_info', schema=None) as batch_op: - batch_op.create_index('ix_appointment_email', ['email'], unique=False) - batch_op.create_index('ix_appointment_date', ['date'], unique=False) - - with op.batch_alter_table('doccomments', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_doccomments_timestamp')) - - op.drop_table('doccomments') - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_appointment_email')) - batch_op.drop_index(batch_op.f('ix_appointment_date')) - - op.drop_table('appointment') - # ### end Alembic commands ### diff --git a/migrations/versions/39e44c8af34c_.py b/migrations/versions/39e44c8af34c_.py deleted file mode 100644 index 84df429..0000000 --- a/migrations/versions/39e44c8af34c_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 39e44c8af34c -Revises: 7738309ad0d0 -Create Date: 2023-04-06 16:45:14.509974 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '39e44c8af34c' -down_revision = '7738309ad0d0' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('age', sa.Integer(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('age') - - # ### end Alembic commands ### diff --git a/migrations/versions/411a1d0b9294_.py b/migrations/versions/411a1d0b9294_.py deleted file mode 100644 index be8dcae..0000000 --- a/migrations/versions/411a1d0b9294_.py +++ /dev/null @@ -1,57 +0,0 @@ -"""empty message - -Revision ID: 411a1d0b9294 -Revises: bad91e69ca34 -Create Date: 2023-04-13 20:14:04.733864 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '411a1d0b9294' -down_revision = 'bad91e69ca34' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('appointment', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('patient_id', sa.Integer(), nullable=True), - sa.Column('doc_id', sa.Integer(), nullable=True), - sa.Column('date', sa.Date(), nullable=True), - sa.ForeignKeyConstraint(['doc_id'], ['users.id'], ), - sa.ForeignKeyConstraint(['patient_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_appointment_date'), ['date'], unique=False) - - op.create_table('workday', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('doc_id', sa.Integer(), nullable=True), - sa.Column('date', sa.Date(), nullable=True), - sa.Column('num', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['doc_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_workday_date'), ['date'], unique=False) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_workday_date')) - - op.drop_table('workday') - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_appointment_date')) - - op.drop_table('appointment') - # ### end Alembic commands ### diff --git a/migrations/versions/49aeda2e2b80_.py b/migrations/versions/49aeda2e2b80_.py deleted file mode 100644 index adb7fd0..0000000 --- a/migrations/versions/49aeda2e2b80_.py +++ /dev/null @@ -1,36 +0,0 @@ -"""empty message - -Revision ID: 49aeda2e2b80 -Revises: d46f10b87507 -Create Date: 2023-04-14 14:38:38.730728 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '49aeda2e2b80' -down_revision = 'd46f10b87507' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('time', sa.Integer(), nullable=True)) - batch_op.drop_column('is_morning') - batch_op.drop_column('is_afternoon') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('is_afternoon', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - batch_op.add_column(sa.Column('is_morning', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - batch_op.drop_column('time') - - # ### end Alembic commands ### diff --git a/migrations/versions/4a9d1ba8736e_.py b/migrations/versions/4a9d1ba8736e_.py deleted file mode 100644 index 6b78d96..0000000 --- a/migrations/versions/4a9d1ba8736e_.py +++ /dev/null @@ -1,35 +0,0 @@ -"""empty message - -Revision ID: 4a9d1ba8736e -Revises: 1c5ef9475969 -Create Date: 2023-04-11 13:55:44.332479 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '4a9d1ba8736e' -down_revision = '1c5ef9475969' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('collects', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=True), - sa.Column('post_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ), - sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('collects') - # ### end Alembic commands ### diff --git a/migrations/versions/5bcae7b12e80_.py b/migrations/versions/5bcae7b12e80_.py deleted file mode 100644 index 17f1261..0000000 --- a/migrations/versions/5bcae7b12e80_.py +++ /dev/null @@ -1,54 +0,0 @@ -"""empty message - -Revision ID: 5bcae7b12e80 -Revises: c47fdd1a45f9 -Create Date: 2023-04-15 12:36:16.564662 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '5bcae7b12e80' -down_revision = 'c47fdd1a45f9' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.alter_column('name', - existing_type=mysql.VARCHAR(length=64), - type_=sa.String(length=256), - existing_nullable=True) - batch_op.alter_column('gender', - existing_type=mysql.VARCHAR(length=5), - type_=sa.String(length=256), - existing_nullable=True) - batch_op.alter_column('phone', - existing_type=mysql.VARCHAR(length=15), - type_=sa.String(length=256), - existing_nullable=True) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.alter_column('phone', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=15), - existing_nullable=True) - batch_op.alter_column('gender', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=5), - existing_nullable=True) - batch_op.alter_column('name', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=64), - existing_nullable=True) - - # ### end Alembic commands ### diff --git a/migrations/versions/5f6e19ecdbaf_.py b/migrations/versions/5f6e19ecdbaf_.py deleted file mode 100644 index 780ecd8..0000000 --- a/migrations/versions/5f6e19ecdbaf_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 5f6e19ecdbaf -Revises: e345198c92d5 -Create Date: 2023-04-13 09:49:14.466038 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '5f6e19ecdbaf' -down_revision = 'e345198c92d5' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('department', sa.String(length=128), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('department') - - # ### end Alembic commands ### diff --git a/migrations/versions/60bd7995263a_.py b/migrations/versions/60bd7995263a_.py deleted file mode 100644 index a370c54..0000000 --- a/migrations/versions/60bd7995263a_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: 60bd7995263a -Revises: 5bcae7b12e80 -Create Date: 2023-04-15 13:12:17.315378 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '60bd7995263a' -down_revision = '5bcae7b12e80' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('location', sa.String(length=256), nullable=True)) - batch_op.drop_column('address') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('address', mysql.VARCHAR(length=256), nullable=True)) - batch_op.drop_column('location') - - # ### end Alembic commands ### diff --git a/migrations/versions/6419f62abd69_.py b/migrations/versions/6419f62abd69_.py deleted file mode 100644 index 7b236dd..0000000 --- a/migrations/versions/6419f62abd69_.py +++ /dev/null @@ -1,43 +0,0 @@ -"""empty message - -Revision ID: 6419f62abd69 -Revises: 688e06991331 -Create Date: 2023-04-09 19:03:09.833527 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '6419f62abd69' -down_revision = '688e06991331' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('comments', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('body', sa.Text(), nullable=True), - sa.Column('timestamp', sa.DateTime(), nullable=True), - sa.Column('author_id', sa.Integer(), nullable=True), - sa.Column('post_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), - sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('comments', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_comments_timestamp'), ['timestamp'], unique=False) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('comments', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_comments_timestamp')) - - op.drop_table('comments') - # ### end Alembic commands ### diff --git a/migrations/versions/6630335c7b63_.py b/migrations/versions/6630335c7b63_.py deleted file mode 100644 index 44ccb2a..0000000 --- a/migrations/versions/6630335c7b63_.py +++ /dev/null @@ -1,52 +0,0 @@ -"""empty message - -Revision ID: 6630335c7b63 -Revises: 39e44c8af34c -Create Date: 2023-04-06 20:56:08.891686 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '6630335c7b63' -down_revision = '39e44c8af34c' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('posts', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('title', sa.Text(), nullable=True), - sa.Column('content', sa.Text(), nullable=True), - sa.Column('img_path', sa.String(length=64), nullable=True), - sa.Column('collect_num', sa.Integer(), nullable=True), - sa.Column('comment_num', sa.Integer(), nullable=True), - sa.Column('like_num', sa.Integer(), nullable=True), - sa.Column('timestamp', sa.DateTime(), nullable=True), - sa.Column('author_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('posts', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_posts_timestamp'), ['timestamp'], unique=False) - - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('avatar_path', sa.String(length=128), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('avatar_path') - - with op.batch_alter_table('posts', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_posts_timestamp')) - - op.drop_table('posts') - # ### end Alembic commands ### diff --git a/migrations/versions/688e06991331_.py b/migrations/versions/688e06991331_.py deleted file mode 100644 index 773087f..0000000 --- a/migrations/versions/688e06991331_.py +++ /dev/null @@ -1,37 +0,0 @@ -"""empty message - -Revision ID: 688e06991331 -Revises: fa9fad0a40c3 -Create Date: 2023-04-07 21:02:53.426656 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '688e06991331' -down_revision = 'fa9fad0a40c3' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('img_attrs') - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('img_attrs', - sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), - sa.Column('name', mysql.VARCHAR(length=128), nullable=True), - sa.Column('path', mysql.VARCHAR(length=128), nullable=True), - sa.Column('post_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.ForeignKeyConstraint(['post_id'], ['posts.id'], name='img_attrs_ibfk_1'), - sa.PrimaryKeyConstraint('id'), - mysql_default_charset='utf8', - mysql_engine='InnoDB' - ) - # ### end Alembic commands ### diff --git a/migrations/versions/698ff838fb8e_.py b/migrations/versions/698ff838fb8e_.py deleted file mode 100644 index c301149..0000000 --- a/migrations/versions/698ff838fb8e_.py +++ /dev/null @@ -1,40 +0,0 @@ -"""empty message - -Revision ID: 698ff838fb8e -Revises: 49aeda2e2b80 -Create Date: 2023-04-15 09:11:10.273475 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '698ff838fb8e' -down_revision = '49aeda2e2b80' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.alter_column('location', - existing_type=mysql.VARCHAR(length=64), - type_=sa.String(length=256), - existing_nullable=True) - batch_op.drop_column('address') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('address', mysql.VARCHAR(length=256), nullable=True)) - batch_op.alter_column('location', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=64), - existing_nullable=True) - - # ### end Alembic commands ### diff --git a/migrations/versions/72bce1509968_.py b/migrations/versions/72bce1509968_.py deleted file mode 100644 index 284fc75..0000000 --- a/migrations/versions/72bce1509968_.py +++ /dev/null @@ -1,36 +0,0 @@ -"""empty message - -Revision ID: 72bce1509968 -Revises: 411a1d0b9294 -Create Date: 2023-04-14 10:35:25.887068 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = '72bce1509968' -down_revision = '411a1d0b9294' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.add_column(sa.Column('morning_num', sa.Integer(), nullable=True)) - batch_op.add_column(sa.Column('afternoon_num', sa.Integer(), nullable=True)) - batch_op.drop_column('num') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.add_column(sa.Column('num', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - batch_op.drop_column('afternoon_num') - batch_op.drop_column('morning_num') - - # ### end Alembic commands ### diff --git a/migrations/versions/7738309ad0d0_.py b/migrations/versions/7738309ad0d0_.py deleted file mode 100644 index ff3678e..0000000 --- a/migrations/versions/7738309ad0d0_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: 7738309ad0d0 -Revises: d5b377434283 -Create Date: 2023-04-06 15:19:58.457148 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '7738309ad0d0' -down_revision = 'd5b377434283' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('address', sa.String(length=128), nullable=True)) - batch_op.add_column(sa.Column('phone', sa.String(length=15), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('phone') - batch_op.drop_column('address') - - # ### end Alembic commands ### diff --git a/migrations/versions/8a31f809b808_.py b/migrations/versions/8a31f809b808_.py deleted file mode 100644 index 948f6e1..0000000 --- a/migrations/versions/8a31f809b808_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: 8a31f809b808 -Revises: 279578d46236 -Create Date: 2023-04-15 16:35:19.380617 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '8a31f809b808' -down_revision = '279578d46236' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_index('ix_appointment_email') - batch_op.create_index(batch_op.f('ix_appointment_email'), ['email'], unique=False) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_appointment_email')) - batch_op.create_index('ix_appointment_email', ['email'], unique=False) - - # ### end Alembic commands ### diff --git a/migrations/versions/98fe9675245a_.py b/migrations/versions/98fe9675245a_.py deleted file mode 100644 index 5814d39..0000000 --- a/migrations/versions/98fe9675245a_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 98fe9675245a -Revises: d4aafb947dc3 -Create Date: 2023-04-17 16:15:22.010836 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '98fe9675245a' -down_revision = 'd4aafb947dc3' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.add_column(sa.Column('diagnosis_sign', sa.String(length=64), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.drop_column('diagnosis_sign') - - # ### end Alembic commands ### diff --git a/migrations/versions/990cd6f0472e_.py b/migrations/versions/990cd6f0472e_.py deleted file mode 100644 index 644bda8..0000000 --- a/migrations/versions/990cd6f0472e_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: 990cd6f0472e -Revises: 98fe9675245a -Create Date: 2023-04-20 17:22:11.061461 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = '990cd6f0472e' -down_revision = '98fe9675245a' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('has_called', sa.Boolean(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_column('has_called') - - # ### end Alembic commands ### diff --git a/migrations/versions/a6858c0553e9_.py b/migrations/versions/a6858c0553e9_.py deleted file mode 100644 index 104cccf..0000000 --- a/migrations/versions/a6858c0553e9_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: a6858c0553e9 -Revises: a89a0dc536df -Create Date: 2023-04-14 13:57:47.242732 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'a6858c0553e9' -down_revision = 'a89a0dc536df' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('is_morning', sa.Integer(), nullable=True)) - batch_op.add_column(sa.Column('is_afternoon', sa.Integer(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_column('is_afternoon') - batch_op.drop_column('is_morning') - - # ### end Alembic commands ### diff --git a/migrations/versions/a89a0dc536df_.py b/migrations/versions/a89a0dc536df_.py deleted file mode 100644 index a4ba3aa..0000000 --- a/migrations/versions/a89a0dc536df_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: a89a0dc536df -Revises: ffde36a65d1a -Create Date: 2023-04-14 13:27:27.199624 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'a89a0dc536df' -down_revision = 'ffde36a65d1a' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.add_column(sa.Column('temp_morning', sa.Integer(), nullable=True)) - batch_op.add_column(sa.Column('temp_afternoon', sa.Integer(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.drop_column('temp_afternoon') - batch_op.drop_column('temp_morning') - - # ### end Alembic commands ### diff --git a/migrations/versions/bad91e69ca34_.py b/migrations/versions/bad91e69ca34_.py deleted file mode 100644 index d554c83..0000000 --- a/migrations/versions/bad91e69ca34_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: bad91e69ca34 -Revises: d270947beff6 -Create Date: 2023-04-13 16:38:37.237482 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'bad91e69ca34' -down_revision = 'd270947beff6' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('doccomments', schema=None) as batch_op: - batch_op.add_column(sa.Column('star_num', sa.Integer(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('doccomments', schema=None) as batch_op: - batch_op.drop_column('star_num') - - # ### end Alembic commands ### diff --git a/migrations/versions/bb3518c7dc22_.py b/migrations/versions/bb3518c7dc22_.py deleted file mode 100644 index 1f75059..0000000 --- a/migrations/versions/bb3518c7dc22_.py +++ /dev/null @@ -1,38 +0,0 @@ -"""empty message - -Revision ID: bb3518c7dc22 -Revises: 0df253550689 -Create Date: 2023-04-23 19:42:48.812186 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'bb3518c7dc22' -down_revision = '0df253550689' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('feedbacks', schema=None) as batch_op: - batch_op.add_column(sa.Column('user_id', sa.Integer(), nullable=True)) - batch_op.drop_index('name') - batch_op.create_foreign_key(None, 'users', ['user_id'], ['id']) - batch_op.drop_column('name') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('feedbacks', schema=None) as batch_op: - batch_op.add_column(sa.Column('name', mysql.VARCHAR(length=64), nullable=True)) - batch_op.drop_constraint(None, type_='foreignkey') - batch_op.create_index('name', ['name'], unique=False) - batch_op.drop_column('user_id') - - # ### end Alembic commands ### diff --git a/migrations/versions/bd0f2e72956b_.py b/migrations/versions/bd0f2e72956b_.py deleted file mode 100644 index 9dd3dc0..0000000 --- a/migrations/versions/bd0f2e72956b_.py +++ /dev/null @@ -1,38 +0,0 @@ -"""empty message - -Revision ID: bd0f2e72956b -Revises: 698ff838fb8e -Create Date: 2023-04-15 12:27:24.563859 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'bd0f2e72956b' -down_revision = '698ff838fb8e' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.alter_column('email', - existing_type=mysql.VARCHAR(length=64), - type_=sa.String(length=256), - existing_nullable=True) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.alter_column('email', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=64), - existing_nullable=True) - - # ### end Alembic commands ### diff --git a/migrations/versions/c47fdd1a45f9_.py b/migrations/versions/c47fdd1a45f9_.py deleted file mode 100644 index ce04664..0000000 --- a/migrations/versions/c47fdd1a45f9_.py +++ /dev/null @@ -1,38 +0,0 @@ -"""empty message - -Revision ID: c47fdd1a45f9 -Revises: bd0f2e72956b -Create Date: 2023-04-15 12:35:09.615442 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'c47fdd1a45f9' -down_revision = 'bd0f2e72956b' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.alter_column('id_number', - existing_type=mysql.VARCHAR(length=64), - type_=sa.String(length=256), - existing_nullable=True) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.alter_column('id_number', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=64), - existing_nullable=True) - - # ### end Alembic commands ### diff --git a/migrations/versions/c9210e82abc5_.py b/migrations/versions/c9210e82abc5_.py deleted file mode 100644 index 6d2a16d..0000000 --- a/migrations/versions/c9210e82abc5_.py +++ /dev/null @@ -1,36 +0,0 @@ -"""empty message - -Revision ID: c9210e82abc5 -Revises: 31222bff99e8 -Create Date: 2023-04-03 13:43:14.596028 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'c9210e82abc5' -down_revision = '31222bff99e8' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('roles', schema=None) as batch_op: - batch_op.add_column(sa.Column('default', sa.Boolean(), nullable=True)) - batch_op.add_column(sa.Column('permissions', sa.Integer(), nullable=True)) - batch_op.create_index(batch_op.f('ix_roles_default'), ['default'], unique=False) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('roles', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_roles_default')) - batch_op.drop_column('permissions') - batch_op.drop_column('default') - - # ### end Alembic commands ### diff --git a/migrations/versions/d270947beff6_.py b/migrations/versions/d270947beff6_.py deleted file mode 100644 index b4c7267..0000000 --- a/migrations/versions/d270947beff6_.py +++ /dev/null @@ -1,43 +0,0 @@ -"""empty message - -Revision ID: d270947beff6 -Revises: 5f6e19ecdbaf -Create Date: 2023-04-13 15:28:37.094758 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'd270947beff6' -down_revision = '5f6e19ecdbaf' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('doccomments', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('body', sa.Text(), nullable=True), - sa.Column('timestamp', sa.DateTime(), nullable=True), - sa.Column('author_id', sa.Integer(), nullable=True), - sa.Column('doc_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), - sa.ForeignKeyConstraint(['doc_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('doccomments', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_doccomments_timestamp'), ['timestamp'], unique=False) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('doccomments', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_doccomments_timestamp')) - - op.drop_table('doccomments') - # ### end Alembic commands ### diff --git a/migrations/versions/d46f10b87507_.py b/migrations/versions/d46f10b87507_.py deleted file mode 100644 index 9a825a0..0000000 --- a/migrations/versions/d46f10b87507_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: d46f10b87507 -Revises: 169f586b8369 -Create Date: 2023-04-14 14:35:38.469465 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'd46f10b87507' -down_revision = '169f586b8369' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_column('location') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('location', mysql.VARCHAR(length=64), nullable=True)) - - # ### end Alembic commands ### diff --git a/migrations/versions/d4aafb947dc3_.py b/migrations/versions/d4aafb947dc3_.py deleted file mode 100644 index e0dd17c..0000000 --- a/migrations/versions/d4aafb947dc3_.py +++ /dev/null @@ -1,36 +0,0 @@ -"""empty message - -Revision ID: d4aafb947dc3 -Revises: 2961517be887 -Create Date: 2023-04-17 16:12:19.482973 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'd4aafb947dc3' -down_revision = '2961517be887' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('reports', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('appointment_id', sa.Integer(), nullable=True), - sa.Column('diagnosis_result', sa.String(length=256), nullable=True), - sa.Column('diagnosis_advice', sa.Text(), nullable=False), - sa.Column('diagnosis_date', sa.String(length=64), nullable=True), - sa.ForeignKeyConstraint(['appointment_id'], ['appointment.id'], ), - sa.PrimaryKeyConstraint('id') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('reports') - # ### end Alembic commands ### diff --git a/migrations/versions/d5b377434283_.py b/migrations/versions/d5b377434283_.py deleted file mode 100644 index 638df5d..0000000 --- a/migrations/versions/d5b377434283_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: d5b377434283 -Revises: f5bf87849ce2 -Create Date: 2023-04-04 20:14:14.910103 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'd5b377434283' -down_revision = 'f5bf87849ce2' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('sex', sa.String(length=5), nullable=True)) - batch_op.drop_column('member_since') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('member_since', mysql.DATETIME(), nullable=True)) - batch_op.drop_column('sex') - - # ### end Alembic commands ### diff --git a/migrations/versions/dfa6be070d7e_.py b/migrations/versions/dfa6be070d7e_.py deleted file mode 100644 index d798456..0000000 --- a/migrations/versions/dfa6be070d7e_.py +++ /dev/null @@ -1,46 +0,0 @@ -"""empty message - -Revision ID: dfa6be070d7e -Revises: 6630335c7b63 -Create Date: 2023-04-07 12:23:19.867038 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'dfa6be070d7e' -down_revision = '6630335c7b63' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.alter_column('avatar_path', - existing_type=mysql.VARCHAR(length=128), - type_=sa.String(length=256), - existing_nullable=True) - batch_op.alter_column('address', - existing_type=mysql.VARCHAR(length=128), - type_=sa.String(length=256), - existing_nullable=True) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.alter_column('address', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=128), - existing_nullable=True) - batch_op.alter_column('avatar_path', - existing_type=sa.String(length=256), - type_=mysql.VARCHAR(length=128), - existing_nullable=True) - - # ### end Alembic commands ### diff --git a/migrations/versions/e0b52571de61_.py b/migrations/versions/e0b52571de61_.py deleted file mode 100644 index 2cfffa2..0000000 --- a/migrations/versions/e0b52571de61_.py +++ /dev/null @@ -1,43 +0,0 @@ -"""empty message - -Revision ID: e0b52571de61 -Revises: 02b3b778cb77 -Create Date: 2023-04-20 19:49:52.091246 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'e0b52571de61' -down_revision = '02b3b778cb77' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('call_number', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('appointment_id', sa.Integer(), nullable=True), - sa.Column('notified', sa.Boolean(), nullable=True), - sa.Column('call_time', sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint(['appointment_id'], ['appointment.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_column('notified') - batch_op.drop_column('status') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.add_column(sa.Column('status', mysql.VARCHAR(length=20), nullable=True)) - batch_op.add_column(sa.Column('notified', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True)) - - op.drop_table('call_number') - # ### end Alembic commands ### diff --git a/migrations/versions/e345198c92d5_.py b/migrations/versions/e345198c92d5_.py deleted file mode 100644 index cca2c3d..0000000 --- a/migrations/versions/e345198c92d5_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: e345198c92d5 -Revises: 4a9d1ba8736e -Create Date: 2023-04-12 15:57:57.258269 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'e345198c92d5' -down_revision = '4a9d1ba8736e' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('feedbacks', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=64), nullable=True), - sa.Column('feedback', sa.Text(), nullable=False), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('name') - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('feedbacks') - # ### end Alembic commands ### diff --git a/migrations/versions/e559de4fd2c3_.py b/migrations/versions/e559de4fd2c3_.py deleted file mode 100644 index 2fdae0f..0000000 --- a/migrations/versions/e559de4fd2c3_.py +++ /dev/null @@ -1,34 +0,0 @@ -"""empty message - -Revision ID: e559de4fd2c3 -Revises: 36b005d8e480 -Create Date: 2023-05-04 17:25:33.005500 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'e559de4fd2c3' -down_revision = '36b005d8e480' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_appointment_date'), ['date'], unique=False) - batch_op.create_index(batch_op.f('ix_appointment_email'), ['email'], unique=False) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_appointment_email')) - batch_op.drop_index(batch_op.f('ix_appointment_date')) - - # ### end Alembic commands ### diff --git a/migrations/versions/ef4643db2b6e_.py b/migrations/versions/ef4643db2b6e_.py deleted file mode 100644 index f7b2445..0000000 --- a/migrations/versions/ef4643db2b6e_.py +++ /dev/null @@ -1,96 +0,0 @@ -"""empty message - -Revision ID: ef4643db2b6e -Revises: bb3518c7dc22 -Create Date: 2023-04-23 21:19:56.976825 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'ef4643db2b6e' -down_revision = 'bb3518c7dc22' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('appointment_info', schema=None) as batch_op: - batch_op.drop_index('ix_appointment_info_date') - batch_op.drop_index('ix_appointment_info_email') - - op.drop_table('appointment_info') - with op.batch_alter_table('comment_fordoc', schema=None) as batch_op: - batch_op.drop_index('ix_comment_fordoc_timestamp') - - op.drop_table('comment_fordoc') - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.create_index(batch_op.f('ix_appointment_date'), ['date'], unique=False) - batch_op.create_index(batch_op.f('ix_appointment_email'), ['email'], unique=False) - - with op.batch_alter_table('call_numbers', schema=None) as batch_op: - batch_op.create_unique_constraint(None, ['appointment_id']) - - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.create_unique_constraint(None, ['appointment_id']) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('reports', schema=None) as batch_op: - batch_op.drop_constraint(None, type_='unique') - - with op.batch_alter_table('call_numbers', schema=None) as batch_op: - batch_op.drop_constraint(None, type_='unique') - - with op.batch_alter_table('appointment', schema=None) as batch_op: - batch_op.drop_index(batch_op.f('ix_appointment_email')) - batch_op.drop_index(batch_op.f('ix_appointment_date')) - - op.create_table('comment_fordoc', - sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), - sa.Column('body', mysql.TEXT(), nullable=True), - sa.Column('timestamp', mysql.DATETIME(), nullable=True), - sa.Column('author_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('doc_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('star_num', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.ForeignKeyConstraint(['author_id'], ['users.id'], name='comment_fordoc_ibfk_1'), - sa.ForeignKeyConstraint(['doc_id'], ['users.id'], name='comment_fordoc_ibfk_2'), - sa.PrimaryKeyConstraint('id'), - mysql_default_charset='utf8', - mysql_engine='InnoDB' - ) - with op.batch_alter_table('comment_fordoc', schema=None) as batch_op: - batch_op.create_index('ix_comment_fordoc_timestamp', ['timestamp'], unique=False) - - op.create_table('appointment_info', - sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False), - sa.Column('patient_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('doc_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('date', sa.DATE(), nullable=True), - sa.Column('time', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('email', mysql.VARCHAR(length=256), nullable=True), - sa.Column('id_number', mysql.VARCHAR(length=256), nullable=True), - sa.Column('name', mysql.VARCHAR(length=256), nullable=True), - sa.Column('gender', mysql.VARCHAR(length=256), nullable=True), - sa.Column('location', mysql.VARCHAR(length=256), nullable=True), - sa.Column('phone', mysql.VARCHAR(length=256), nullable=True), - sa.Column('age', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('cost', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.Column('num', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True), - sa.ForeignKeyConstraint(['doc_id'], ['users.id'], name='appointment_info_ibfk_1'), - sa.ForeignKeyConstraint(['patient_id'], ['users.id'], name='appointment_info_ibfk_2'), - sa.PrimaryKeyConstraint('id'), - mysql_default_charset='utf8', - mysql_engine='InnoDB' - ) - with op.batch_alter_table('appointment_info', schema=None) as batch_op: - batch_op.create_index('ix_appointment_info_email', ['email'], unique=False) - batch_op.create_index('ix_appointment_info_date', ['date'], unique=False) - - # ### end Alembic commands ### diff --git a/migrations/versions/f5bf87849ce2_.py b/migrations/versions/f5bf87849ce2_.py deleted file mode 100644 index a7606be..0000000 --- a/migrations/versions/f5bf87849ce2_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: f5bf87849ce2 -Revises: f7a9296b6817 -Create Date: 2023-04-04 09:59:40.714568 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'f5bf87849ce2' -down_revision = 'f7a9296b6817' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('avatar_color', sa.String(length=10), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('avatar_color') - - # ### end Alembic commands ### diff --git a/migrations/versions/f7a9296b6817_.py b/migrations/versions/f7a9296b6817_.py deleted file mode 100644 index ff88be9..0000000 --- a/migrations/versions/f7a9296b6817_.py +++ /dev/null @@ -1,40 +0,0 @@ -"""empty message - -Revision ID: f7a9296b6817 -Revises: c9210e82abc5 -Create Date: 2023-04-03 18:58:41.344794 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'f7a9296b6817' -down_revision = 'c9210e82abc5' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.add_column(sa.Column('name', sa.String(length=64), nullable=True)) - batch_op.add_column(sa.Column('location', sa.String(length=64), nullable=True)) - batch_op.add_column(sa.Column('about_me', sa.Text(), nullable=True)) - batch_op.add_column(sa.Column('member_since', sa.DateTime(), nullable=True)) - batch_op.add_column(sa.Column('last_seen', sa.DateTime(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('users', schema=None) as batch_op: - batch_op.drop_column('last_seen') - batch_op.drop_column('member_since') - batch_op.drop_column('about_me') - batch_op.drop_column('location') - batch_op.drop_column('name') - - # ### end Alembic commands ### diff --git a/migrations/versions/fa9fad0a40c3_.py b/migrations/versions/fa9fad0a40c3_.py deleted file mode 100644 index 8fb3df1..0000000 --- a/migrations/versions/fa9fad0a40c3_.py +++ /dev/null @@ -1,61 +0,0 @@ -"""empty message - -Revision ID: fa9fad0a40c3 -Revises: 31f169c37c61 -Create Date: 2023-04-07 18:05:59.713134 - -""" -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import mysql - -# revision identifiers, used by Alembic. -revision = 'fa9fad0a40c3' -down_revision = '31f169c37c61' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table('img_attrs', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('name', sa.String(length=128), nullable=True), - sa.Column('path', sa.String(length=128), nullable=True), - sa.Column('post_id', sa.Integer(), nullable=True), - sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ), - sa.PrimaryKeyConstraint('id') - ) - with op.batch_alter_table('posts', schema=None) as batch_op: - batch_op.add_column(sa.Column('img_count', sa.Integer(), nullable=True)) - batch_op.alter_column('title', - existing_type=mysql.TEXT(), - nullable=False) - batch_op.alter_column('content', - existing_type=mysql.TEXT(), - nullable=False) - batch_op.alter_column('author_id', - existing_type=mysql.INTEGER(display_width=11), - nullable=False) - batch_op.drop_column('img_path') - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('posts', schema=None) as batch_op: - batch_op.add_column(sa.Column('img_path', mysql.VARCHAR(length=64), nullable=True)) - batch_op.alter_column('author_id', - existing_type=mysql.INTEGER(display_width=11), - nullable=True) - batch_op.alter_column('content', - existing_type=mysql.TEXT(), - nullable=True) - batch_op.alter_column('title', - existing_type=mysql.TEXT(), - nullable=True) - batch_op.drop_column('img_count') - - op.drop_table('img_attrs') - # ### end Alembic commands ### diff --git a/migrations/versions/ffde36a65d1a_.py b/migrations/versions/ffde36a65d1a_.py deleted file mode 100644 index ef986b5..0000000 --- a/migrations/versions/ffde36a65d1a_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""empty message - -Revision ID: ffde36a65d1a -Revises: 72bce1509968 -Create Date: 2023-04-14 10:41:44.158147 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'ffde36a65d1a' -down_revision = '72bce1509968' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.add_column(sa.Column('cost', sa.Integer(), nullable=True)) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('workday', schema=None) as batch_op: - batch_op.drop_column('cost') - - # ### end Alembic commands ### diff --git a/requirements.txt b/requirements.txt index 29df084..a2b041c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,10 @@ alembic==1.12.1 astor==0.8.1 blinker==1.6.3 certifi @ file:///C:/b/abs_85o_6fm0se/croot/certifi_1671487778835/work/certifi +cffi==1.15.1 click==8.0.1 colorama==0.4.6 +cryptography==43.0.0 dnspython==2.3.0 dominate==2.9.1 email-validator==1.3.1 @@ -12,9 +14,10 @@ Flask==1.1.2 Flask-Bootstrap==3.3.7.1 Flask-Login==0.5.0 Flask-Mail==0.9.1 -Flask-Migrate==4.0.7 +Flask-Migrate==2.5.3 Flask-Moment==1.0.5 Flask-PageDown==0.2.0 +Flask-Script==2.0.6 Flask-SQLAlchemy==2.4.4 Flask-WTF==1.0.1 gast==0.2.2 @@ -26,7 +29,7 @@ idna==3.6 importlib-metadata==6.7.0 importlib-resources==5.12.0 itsdangerous==2.0.1 -Jinja2==2.11.3 +Jinja2==3.0.2 Keras-Applications==1.0.8 Keras-Preprocessing==1.1.2 Mako==1.2.4 @@ -36,10 +39,11 @@ numpy==1.19.5 opencv-python==4.5.1.48 opt-einsum==3.3.0 packaging==24.0 -protobuf==4.24.4 +protobuf==3.20.3 +pycparser==2.21 PyMySQL==1.0.2 six==1.16.0 -SQLAlchemy==1.4.47 +SQLAlchemy==1.3.23 tensorboard==1.15.0 tensorflow==1.15.0 tensorflow-estimator==1.15.1