登录注册收藏功能上线云服务器
This commit is contained in:
1
migrations/README
Normal file
1
migrations/README
Normal file
@@ -0,0 +1 @@
|
||||
Single-database configuration for Flask.
|
||||
BIN
migrations/__pycache__/env.cpython-312.pyc
Normal file
BIN
migrations/__pycache__/env.cpython-312.pyc
Normal file
Binary file not shown.
50
migrations/alembic.ini
Normal file
50
migrations/alembic.ini
Normal file
@@ -0,0 +1,50 @@
|
||||
# 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
|
||||
113
migrations/env.py
Normal file
113
migrations/env.py
Normal file
@@ -0,0 +1,113 @@
|
||||
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, AttributeError):
|
||||
# this works with Flask-SQLAlchemy>=3
|
||||
return current_app.extensions['migrate'].db.engine
|
||||
|
||||
|
||||
def get_engine_url():
|
||||
try:
|
||||
return get_engine().url.render_as_string(hide_password=False).replace(
|
||||
'%', '%%')
|
||||
except AttributeError:
|
||||
return str(get_engine().url).replace('%', '%%')
|
||||
|
||||
|
||||
# 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', get_engine_url())
|
||||
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.')
|
||||
|
||||
conf_args = current_app.extensions['migrate'].configure_args
|
||||
if conf_args.get("process_revision_directives") is None:
|
||||
conf_args["process_revision_directives"] = process_revision_directives
|
||||
|
||||
connectable = get_engine()
|
||||
|
||||
with connectable.connect() as connection:
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=get_metadata(),
|
||||
**conf_args
|
||||
)
|
||||
|
||||
with context.begin_transaction():
|
||||
context.run_migrations()
|
||||
|
||||
|
||||
if context.is_offline_mode():
|
||||
run_migrations_offline()
|
||||
else:
|
||||
run_migrations_online()
|
||||
24
migrations/script.py.mako
Normal file
24
migrations/script.py.mako
Normal file
@@ -0,0 +1,24 @@
|
||||
"""${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"}
|
||||
Binary file not shown.
568
migrations/versions/e1ec7bb6c8ec_add_favorites_table.py
Normal file
568
migrations/versions/e1ec7bb6c8ec_add_favorites_table.py
Normal file
@@ -0,0 +1,568 @@
|
||||
"""Add favorites table
|
||||
|
||||
Revision ID: e1ec7bb6c8ec
|
||||
Revises:
|
||||
Create Date: 2025-08-29 01:01:11.427346
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'e1ec7bb6c8ec'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('deviceinfo')
|
||||
with op.batch_alter_table('oauth_member_bind', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_type_openid'))
|
||||
|
||||
op.drop_table('oauth_member_bind')
|
||||
with op.batch_alter_table('food_stock_change_log', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_food_id'))
|
||||
|
||||
op.drop_table('food_stock_change_log')
|
||||
with op.batch_alter_table('oauth_access_token', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_expired_time'))
|
||||
|
||||
op.drop_table('oauth_access_token')
|
||||
with op.batch_alter_table('pay_order', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_member_id_status'))
|
||||
batch_op.drop_index(batch_op.f('idx_order_sn'))
|
||||
|
||||
op.drop_table('pay_order')
|
||||
op.drop_table('mendianusertwo')
|
||||
with op.batch_alter_table('member_comments', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_member_id'))
|
||||
|
||||
op.drop_table('member_comments')
|
||||
op.drop_table('food')
|
||||
with op.batch_alter_table('food_cat', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_name'))
|
||||
|
||||
op.drop_table('food_cat')
|
||||
with op.batch_alter_table('member', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_openid'))
|
||||
|
||||
op.drop_table('member')
|
||||
with op.batch_alter_table('app_access_log', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_uid'))
|
||||
|
||||
op.drop_table('app_access_log')
|
||||
with op.batch_alter_table('member_address', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_member_id_status'))
|
||||
|
||||
op.drop_table('member_address')
|
||||
with op.batch_alter_table('stat_daily_site', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_date'))
|
||||
|
||||
op.drop_table('stat_daily_site')
|
||||
with op.batch_alter_table('pay_order_callback_data', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('pay_order_id'))
|
||||
|
||||
op.drop_table('pay_order_callback_data')
|
||||
op.drop_table('images')
|
||||
with op.batch_alter_table('stat_daily_member', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_date_member_id'))
|
||||
|
||||
op.drop_table('stat_daily_member')
|
||||
op.drop_table('runoob_tbl')
|
||||
with op.batch_alter_table('food_sale_change_log', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_food_id_id'))
|
||||
|
||||
op.drop_table('food_sale_change_log')
|
||||
op.drop_table('dongtai_list')
|
||||
with op.batch_alter_table('stat_daily_food', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('date_food_id'))
|
||||
|
||||
op.drop_table('stat_daily_food')
|
||||
op.drop_table('app_error_log')
|
||||
op.drop_table('mendianuserinfo')
|
||||
op.drop_table('queue_list')
|
||||
op.drop_table('wx_share_history')
|
||||
with op.batch_alter_table('container_orchestration_assistant', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_category'))
|
||||
batch_op.drop_index(batch_op.f('idx_industry'))
|
||||
batch_op.drop_index(batch_op.f('idx_profession'))
|
||||
|
||||
op.drop_table('container_orchestration_assistant')
|
||||
with op.batch_alter_table('member_cart', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('idx_member_id'))
|
||||
|
||||
op.drop_table('member_cart')
|
||||
with op.batch_alter_table('pay_order_item', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('id_order_id'))
|
||||
batch_op.drop_index(batch_op.f('idx_food_id'))
|
||||
|
||||
op.drop_table('pay_order_item')
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('login_name'))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('login_name'), ['login_name'], unique=True)
|
||||
|
||||
op.create_table('pay_order_item',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('pay_order_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='订单id'),
|
||||
sa.Column('member_id', mysql.BIGINT(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('quantity', mysql.INTEGER(display_width=11), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='购买数量 默认1份'),
|
||||
sa.Column('price', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='商品总价格,售价 * 数量'),
|
||||
sa.Column('food_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='美食表id'),
|
||||
sa.Column('note', mysql.TEXT(), nullable=False, comment='备注信息'),
|
||||
sa.Column('status', mysql.TINYINT(display_width=1), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='状态:1:成功 0 失败'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最近一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='订单详情表',
|
||||
mysql_comment='订单详情表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('pay_order_item', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_food_id'), ['food_id'], unique=False)
|
||||
batch_op.create_index(batch_op.f('id_order_id'), ['pay_order_id'], unique=False)
|
||||
|
||||
op.create_table('member_cart',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('member_id', mysql.BIGINT(display_width=20), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('food_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='商品id'),
|
||||
sa.Column('quantity', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='数量'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='购物车',
|
||||
mysql_comment='购物车',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('member_cart', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_member_id'), ['member_id'], unique=False)
|
||||
|
||||
op.create_table('container_orchestration_assistant',
|
||||
sa.Column('id', mysql.BIGINT(display_width=20), autoincrement=True, nullable=False, comment='助手ID'),
|
||||
sa.Column('name', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='助手名称'),
|
||||
sa.Column('description', mysql.VARCHAR(length=255), server_default=sa.text("''"), nullable=False, comment='助手描述'),
|
||||
sa.Column('category', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='分类(架构设计)'),
|
||||
sa.Column('industry', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='行业(技术研发)'),
|
||||
sa.Column('profession', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='职业(高级工程师)'),
|
||||
sa.Column('sub_category', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='子分类(容器编排)'),
|
||||
sa.Column('system_prompt', mysql.TEXT(), nullable=False, comment='系统提示词(容器化需求转换规则)'),
|
||||
sa.Column('status', mysql.TINYINT(display_width=1), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='状态:1-有效,0-无效'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='创建时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='Python容器编排助手表',
|
||||
mysql_comment='Python容器编排助手表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('container_orchestration_assistant', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_profession'), ['profession'], unique=False)
|
||||
batch_op.create_index(batch_op.f('idx_industry'), ['industry'], unique=False)
|
||||
batch_op.create_index(batch_op.f('idx_category'), ['category'], unique=False)
|
||||
|
||||
op.create_table('wx_share_history',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('member_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('share_url', mysql.VARCHAR(length=200), server_default=sa.text("''"), nullable=False, comment='分享的页面url'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='创建时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='微信分享记录',
|
||||
mysql_comment='微信分享记录',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('queue_list',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('queue_name', mysql.VARCHAR(length=30), server_default=sa.text("''"), nullable=False, comment='队列名字'),
|
||||
sa.Column('data', mysql.VARCHAR(length=500), server_default=sa.text("''"), nullable=False, comment='队列数据'),
|
||||
sa.Column('status', mysql.TINYINT(display_width=1), server_default=sa.text("'-1'"), autoincrement=False, nullable=False, comment='状态 -1 待处理 1 已处理'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='事件队列表',
|
||||
mysql_comment='事件队列表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('mendianuserinfo',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('nickname', mysql.VARCHAR(length=20), server_default=sa.text("''"), nullable=False, comment='会员名'),
|
||||
sa.Column('mobile', mysql.VARCHAR(length=20), server_default=sa.text("''"), nullable=False, comment='会员手机号码'),
|
||||
sa.Column('storename', mysql.VARCHAR(length=20), server_default=sa.text("'0'"), nullable=False, comment='店铺名称'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='会员表',
|
||||
mysql_comment='会员表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('app_error_log',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('referer_url', mysql.VARCHAR(length=255), server_default=sa.text("''"), nullable=False, comment='当前访问的refer'),
|
||||
sa.Column('target_url', mysql.VARCHAR(length=255), server_default=sa.text("''"), nullable=False, comment='访问的url'),
|
||||
sa.Column('query_params', mysql.TEXT(), nullable=False, comment='get和post参数'),
|
||||
sa.Column('content', mysql.LONGTEXT(), nullable=False, comment='日志内容'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='app错误日表',
|
||||
mysql_comment='app错误日表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('stat_daily_food',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('date', sa.DATE(), nullable=False),
|
||||
sa.Column('food_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='菜品id'),
|
||||
sa.Column('total_count', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='售卖总数量'),
|
||||
sa.Column('total_pay_money', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='总售卖金额'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='书籍售卖日统计',
|
||||
mysql_comment='书籍售卖日统计',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('stat_daily_food', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('date_food_id'), ['date', 'food_id'], unique=False)
|
||||
|
||||
op.create_table('dongtai_list',
|
||||
sa.Column('listid', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('date', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('title', mysql.VARCHAR(length=40), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('imgSrc', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('avatar', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('content', mysql.VARCHAR(length=128), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('reading', mysql.VARCHAR(length=128), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('collection', mysql.VARCHAR(length=128), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('headImgSrc', mysql.VARCHAR(length=100), nullable=False),
|
||||
sa.Column('author', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('dateTime', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.Column('postId', mysql.INTEGER(display_width=10), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('listid'),
|
||||
mysql_default_charset='utf8',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('food_sale_change_log',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('food_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='商品id'),
|
||||
sa.Column('quantity', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='售卖数量'),
|
||||
sa.Column('price', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='售卖金额'),
|
||||
sa.Column('member_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='售卖时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='商品销售情况',
|
||||
mysql_comment='商品销售情况',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('food_sale_change_log', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_food_id_id'), ['food_id'], unique=False)
|
||||
|
||||
op.create_table('runoob_tbl',
|
||||
sa.Column('runoob_id', mysql.INTEGER(display_width=10, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('runoob_title', mysql.VARCHAR(length=100), nullable=False),
|
||||
sa.Column('runoob_author', mysql.VARCHAR(length=40), nullable=False),
|
||||
sa.Column('submission_date', sa.DATE(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('runoob_id'),
|
||||
mysql_default_charset='utf8',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('stat_daily_member',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('date', sa.DATE(), nullable=False, comment='日期'),
|
||||
sa.Column('member_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('total_shared_count', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='当日分享总次数'),
|
||||
sa.Column('total_pay_money', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='当日付款总金额'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='会员日统计',
|
||||
mysql_comment='会员日统计',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('stat_daily_member', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_date_member_id'), ['date', 'member_id'], unique=False)
|
||||
|
||||
op.create_table('images',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('file_key', mysql.VARCHAR(length=60), server_default=sa.text("''"), nullable=False, comment='文件名'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('pay_order_callback_data',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
||||
sa.Column('pay_order_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='支付订单id'),
|
||||
sa.Column('pay_data', mysql.TEXT(), nullable=False, comment='支付回调信息'),
|
||||
sa.Column('refund_data', mysql.TEXT(), nullable=False, comment='退款回调信息'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='创建时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('pay_order_callback_data', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('pay_order_id'), ['pay_order_id'], unique=True)
|
||||
|
||||
op.create_table('stat_daily_site',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('date', sa.DATE(), nullable=False, comment='日期'),
|
||||
sa.Column('total_pay_money', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='当日应收总金额'),
|
||||
sa.Column('total_member_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False, comment='会员总数'),
|
||||
sa.Column('total_new_member_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False, comment='当日新增会员数'),
|
||||
sa.Column('total_order_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False, comment='当日订单数'),
|
||||
sa.Column('total_shared_count', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='全站日统计',
|
||||
mysql_comment='全站日统计',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('stat_daily_site', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_date'), ['date'], unique=False)
|
||||
|
||||
op.create_table('member_address',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('member_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('nickname', mysql.VARCHAR(length=20), server_default=sa.text("''"), nullable=False, comment='收货人姓名'),
|
||||
sa.Column('mobile', mysql.VARCHAR(length=11), server_default=sa.text("''"), nullable=False, comment='收货人手机号码'),
|
||||
sa.Column('province_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='省id'),
|
||||
sa.Column('province_str', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='省名称'),
|
||||
sa.Column('city_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='城市id'),
|
||||
sa.Column('city_str', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='市名称'),
|
||||
sa.Column('area_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='区域id'),
|
||||
sa.Column('area_str', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='区域名称'),
|
||||
sa.Column('address', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='详细地址'),
|
||||
sa.Column('status', mysql.TINYINT(display_width=1), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='是否有效 1:有效 0:无效'),
|
||||
sa.Column('is_default', mysql.TINYINT(display_width=1), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='默认地址'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='会员收货地址',
|
||||
mysql_comment='会员收货地址',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('member_address', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_member_id_status'), ['member_id', 'status'], unique=False)
|
||||
|
||||
op.create_table('app_access_log',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
||||
sa.Column('uid', mysql.BIGINT(display_width=20), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='uid'),
|
||||
sa.Column('referer_url', mysql.VARCHAR(length=255), server_default=sa.text("''"), nullable=False, comment='当前访问的refer'),
|
||||
sa.Column('target_url', mysql.VARCHAR(length=255), server_default=sa.text("''"), nullable=False, comment='访问的url'),
|
||||
sa.Column('query_params', mysql.TEXT(), nullable=False, comment='get和post参数'),
|
||||
sa.Column('ua', mysql.VARCHAR(length=255), server_default=sa.text("''"), nullable=False, comment='访问ua'),
|
||||
sa.Column('ip', mysql.VARCHAR(length=32), server_default=sa.text("''"), nullable=False, comment='访问ip'),
|
||||
sa.Column('note', mysql.VARCHAR(length=1000), server_default=sa.text("''"), nullable=False, comment='json格式备注字段'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='用户访问记录表',
|
||||
mysql_comment='用户访问记录表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('app_access_log', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_uid'), ['uid'], unique=False)
|
||||
|
||||
op.create_table('member',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
||||
sa.Column('openid', mysql.VARCHAR(length=80), nullable=False, comment='微信openid'),
|
||||
sa.Column('nickname', mysql.VARCHAR(length=100), nullable=True, comment='用户昵称'),
|
||||
sa.Column('mobile', mysql.VARCHAR(length=11), nullable=True, comment='手机号码'),
|
||||
sa.Column('sex', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='性别 1:男 2:女'),
|
||||
sa.Column('avatar', mysql.VARCHAR(length=200), server_default=sa.text("''"), nullable=False, comment='头像'),
|
||||
sa.Column('salt', mysql.VARCHAR(length=32), nullable=False, comment='随机加密串'),
|
||||
sa.Column('reg_ip', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='注册IP'),
|
||||
sa.Column('status', mysql.INTEGER(display_width=11), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='状态 1:有效 0:无效'),
|
||||
sa.Column('updated_time', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='创建时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='会员表',
|
||||
mysql_comment='会员表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('member', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_openid'), ['openid'], unique=False)
|
||||
|
||||
op.create_table('food_cat',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('name', mysql.VARCHAR(length=50), server_default=sa.text("''"), nullable=False, comment='类别名称'),
|
||||
sa.Column('weight', mysql.TINYINT(display_width=4), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='权重'),
|
||||
sa.Column('status', mysql.TINYINT(display_width=1), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='状态 1:有效 0:无效'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='食品分类',
|
||||
mysql_comment='食品分类',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('food_cat', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_name'), ['id'], unique=True)
|
||||
|
||||
op.create_table('food',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('cat_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='分类id'),
|
||||
sa.Column('name', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='书籍名称'),
|
||||
sa.Column('price', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='售卖金额'),
|
||||
sa.Column('main_image', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='主图'),
|
||||
sa.Column('summary', mysql.VARCHAR(length=10000), server_default=sa.text("''"), nullable=False, comment='描述'),
|
||||
sa.Column('stock', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='库存量'),
|
||||
sa.Column('tags', mysql.VARCHAR(length=200), server_default=sa.text("''"), nullable=False, comment='tag关键字,以","连接'),
|
||||
sa.Column('status', mysql.TINYINT(display_width=1), server_default=sa.text("'1'"), autoincrement=False, nullable=False, comment='状态 1:有效 0:无效'),
|
||||
sa.Column('month_count', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='月销售数量'),
|
||||
sa.Column('total_count', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='总销售量'),
|
||||
sa.Column('view_count', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='总浏览次数'),
|
||||
sa.Column('comment_count', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='总评论量'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='食品表',
|
||||
mysql_comment='食品表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('member_comments',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('member_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('food_ids', mysql.VARCHAR(length=200), server_default=sa.text("''"), nullable=False, comment='商品ids'),
|
||||
sa.Column('pay_order_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='订单id'),
|
||||
sa.Column('score', mysql.TINYINT(display_width=4), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='评分'),
|
||||
sa.Column('content', mysql.VARCHAR(length=200), server_default=sa.text("''"), nullable=False, comment='评论内容'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='会员评论表',
|
||||
mysql_comment='会员评论表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('member_comments', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_member_id'), ['member_id'], unique=False)
|
||||
|
||||
op.create_table('mendianusertwo',
|
||||
sa.Column('id', mysql.INTEGER(display_width=100), server_default=sa.text("'0'"), autoincrement=False, nullable=False),
|
||||
sa.Column('name', mysql.VARCHAR(length=100), nullable=False),
|
||||
sa.Column('phone', mysql.VARCHAR(length=100), nullable=False),
|
||||
sa.Column('storename', mysql.VARCHAR(length=100), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
op.create_table('pay_order',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('order_sn', mysql.VARCHAR(length=40), server_default=sa.text("''"), nullable=False, comment='随机订单号'),
|
||||
sa.Column('member_id', mysql.BIGINT(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('total_price', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='订单应付金额'),
|
||||
sa.Column('yun_price', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='运费金额'),
|
||||
sa.Column('pay_price', mysql.DECIMAL(precision=10, scale=2), server_default=sa.text("'0.00'"), nullable=False, comment='订单实付金额'),
|
||||
sa.Column('pay_sn', mysql.VARCHAR(length=128), server_default=sa.text("''"), nullable=False, comment='第三方流水号'),
|
||||
sa.Column('prepay_id', mysql.VARCHAR(length=128), server_default=sa.text("''"), nullable=False, comment='第三方预付id'),
|
||||
sa.Column('note', mysql.TEXT(), nullable=False, comment='备注信息'),
|
||||
sa.Column('status', mysql.TINYINT(display_width=4), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='1:支付完成 0 无效 -1 申请退款 -2 退款中 -9 退款成功 -8 待支付 -7 完成支付待确认'),
|
||||
sa.Column('express_status', mysql.TINYINT(display_width=4), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='快递状态,-8 待支付 -7 已付款待发货 1:确认收货 0:失败'),
|
||||
sa.Column('express_address_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='快递地址id'),
|
||||
sa.Column('express_info', mysql.VARCHAR(length=1000), server_default=sa.text("''"), nullable=False, comment='快递信息'),
|
||||
sa.Column('comment_status', mysql.TINYINT(display_width=1), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='评论状态'),
|
||||
sa.Column('pay_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='付款到账时间'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最近一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='在线购买订单表',
|
||||
mysql_comment='在线购买订单表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('pay_order', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_order_sn'), ['order_sn'], unique=True)
|
||||
batch_op.create_index(batch_op.f('idx_member_id_status'), ['member_id', 'status'], unique=False)
|
||||
|
||||
op.create_table('oauth_access_token',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('access_token', mysql.VARCHAR(length=600), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('expired_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='过期时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='微信的access_token 用户调用其他接口的',
|
||||
mysql_comment='微信的access_token 用户调用其他接口的',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('oauth_access_token', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_expired_time'), ['expired_time'], unique=False)
|
||||
|
||||
op.create_table('food_stock_change_log',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('food_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False, comment='商品id'),
|
||||
sa.Column('unit', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='变更多少'),
|
||||
sa.Column('total_stock', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='变更之后总量'),
|
||||
sa.Column('note', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='备注字段'),
|
||||
sa.Column('created_time', mysql.DATETIME(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='数据库存变更表',
|
||||
mysql_comment='数据库存变更表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('food_stock_change_log', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_food_id'), ['food_id'], unique=False)
|
||||
|
||||
op.create_table('oauth_member_bind',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('member_id', mysql.INTEGER(display_width=11), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='会员id'),
|
||||
sa.Column('client_type', mysql.VARCHAR(length=20), server_default=sa.text("''"), nullable=False, comment='客户端来源类型。qq,weibo,weixin'),
|
||||
sa.Column('type', mysql.TINYINT(display_width=3), server_default=sa.text("'0'"), autoincrement=False, nullable=False, comment='类型 type 1:wechat '),
|
||||
sa.Column('openid', mysql.VARCHAR(length=80), server_default=sa.text("''"), nullable=False, comment='第三方id'),
|
||||
sa.Column('unionid', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False),
|
||||
sa.Column('extra', mysql.TEXT(), nullable=False, comment='额外字段'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='第三方登录绑定关系',
|
||||
mysql_comment='第三方登录绑定关系',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
with op.batch_alter_table('oauth_member_bind', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('idx_type_openid'), ['type', 'openid'], unique=False)
|
||||
|
||||
op.create_table('deviceinfo',
|
||||
sa.Column('id', mysql.INTEGER(display_width=11, unsigned=True), autoincrement=True, nullable=False),
|
||||
sa.Column('nickname', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='会员名'),
|
||||
sa.Column('jiguang', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='极光id'),
|
||||
sa.Column('version', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='版本号'),
|
||||
sa.Column('xiaoqu', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='小区'),
|
||||
sa.Column('louhao', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='楼号'),
|
||||
sa.Column('danyuan', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='单元号'),
|
||||
sa.Column('jingdu', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='经度'),
|
||||
sa.Column('weidu', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='纬度'),
|
||||
sa.Column('snnum', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='sn号'),
|
||||
sa.Column('mobile', mysql.VARCHAR(length=11), server_default=sa.text("''"), nullable=False, comment='会员手机号码'),
|
||||
sa.Column('reg_ip', mysql.VARCHAR(length=100), server_default=sa.text("''"), nullable=False, comment='注册ip'),
|
||||
sa.Column('updated_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='最后一次更新时间'),
|
||||
sa.Column('created_time', mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False, comment='插入时间'),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
comment='设备注册表',
|
||||
mysql_comment='设备注册表',
|
||||
mysql_default_charset='utf8mb4',
|
||||
mysql_engine='InnoDB'
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user