walle-web icon indicating copy to clipboard operation
walle-web copied to clipboard

BUG admin.sh migration

Open freegodly opened this issue 4 years ago • 1 comments

问题描述 sh admin.sh migration 报错

问题描述

[root@localhost walle-web]# sh admin.sh migration

                                                      llllllllllllll                     
                                                       l::::l l::::l                     

wwwwwww wwwww wwwwww aaaaaaaaaaaaa l::::l l::::l eeeeeeeeeeee
w:::::w w:::::w w:::::w a::::::::::::a l::::l l::::l ee::::::::::::ee
w:::::w w:::::::w w:::::w aaaaaaaaa:::::a l::::l l::::l e::::::eeeee:::::ee w:::::w w:::::::::w w:::::w a::::a l::::l l::::l e::::::e e:::::e w:::::w w:::::w:::::w w:::::w aaaaaaa:::::a l::::l l::::l e:::::::eeeee::::::e w:::::w w:::::w w:::::w w:::::w aa::::::::::::a l::::l l::::l e:::::::::::::::::e w:::::w:::::w w:::::w:::::w a::::aaaa::::::a l::::l l::::l e::::::eeeeeeeeeee
w:::::::::w w:::::::::w a::::a a:::::a l::::l l::::l e:::::::e
w:::::::w w:::::::w a::::a a:::::a l::::l l::::l e::::::::e
w:::::w w:::::w a:::::aaaa::::::a l::::l l::::l e::::::::eeeeeeee
w:::w w:::w a::::::::::aa::a l::::: l:::::l ee:::::::::::::e
www www aaaaaaaaaa aaaa llllllllllllllll eeeeeeeeeeeeee

Migration walle

/opt/walle-web/walle/app.py:4: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['urllib3.util (/opt/walle-web/venv/lib/python3.6/site-packages/urllib3/util/init.py)', 'eventlet.green.ssl (/opt/walle-web/venv/lib/python3.6/site-packages/eventlet/green/ssl.py)', 'urllib3.util.ssl_ (/opt/walle-web/venv/lib/python3.6/site-packages/urllib3/util/ssl_.py)']. Subclasses (NOT patched): ["<class 'eventlet.green.ssl.GreenSSLContext'>"]. gevent.monkey.patch_all() INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade -> 2bca06a823a0, init walle database ERROR [alembic.env] (pymysql.err.InternalError) (1067, "Invalid default value for 'created_at'") [SQL: "CREATE TABLE environments (\n id int(10) NOT NULL AUTO_INCREMENT COMMENT '',\n name varchar(100) DEFAULT 'master' COMMENT '',\n space_id int(10) NOT NULL DEFAULT '0' COMMENT '',\n status tinyint(1) DEFAULT '1' COMMENT '',\n created_at datetime DEFAULT CURRENT_TIMESTAMP COMMENT '',\n updated_at datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',\n PRIMARY KEY (id)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='';"] (Background on this error at: http://sqlalche.me/e/2j85) Traceback (most recent call last): File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context context) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute cursor.execute(statement, parameters) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute result = self._query(query) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query conn.query(q) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result result.read() File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read first_packet = self.connection._read_packet() File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet packet.check_error() File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error err.raise_mysql_exception(self._data) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.InternalError: (1067, "Invalid default value for 'created_at'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/walle-web/venv/bin/flask", line 8, in sys.exit(main()) File "/opt/walle-web/venv/lib/python3.6/site-packages/flask/cli.py", line 894, in main cli.main(args=args, prog_name=name) File "/opt/walle-web/venv/lib/python3.6/site-packages/flask/cli.py", line 557, in main return super(FlaskGroup, self).main(*args, **kwargs) File "/opt/walle-web/venv/lib/python3.6/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/opt/walle-web/venv/lib/python3.6/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/walle-web/venv/lib/python3.6/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/walle-web/venv/lib/python3.6/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/opt/walle-web/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/opt/walle-web/venv/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/opt/walle-web/venv/lib/python3.6/site-packages/flask/cli.py", line 412, in decorator return __ctx.invoke(f, *args, **kwargs) File "/opt/walle-web/venv/lib/python3.6/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/opt/walle-web/venv/lib/python3.6/site-packages/flask_migrate/cli.py", line 134, in upgrade _upgrade(directory, revision, sql, tag, x_arg) File "/opt/walle-web/venv/lib/python3.6/site-packages/flask_migrate/init.py", line 95, in wrapped f(*args, **kwargs) File "/opt/walle-web/venv/lib/python3.6/site-packages/flask_migrate/init.py", line 280, in upgrade command.upgrade(config, revision, sql=sql, tag=tag) File "/opt/walle-web/venv/lib/python3.6/site-packages/alembic/command.py", line 298, in upgrade script.run_env() File "/opt/walle-web/venv/lib/python3.6/site-packages/alembic/script/base.py", line 489, in run_env util.load_python_file(self.dir, "env.py") File "/opt/walle-web/venv/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file module = load_module_py(module_id, path) File "/opt/walle-web/venv/lib/python3.6/site-packages/alembic/util/compat.py", line 173, in load_module_py spec.loader.exec_module(module) File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "migrations/env.py", line 90, in run_migrations_online() File "migrations/env.py", line 83, in run_migrations_online raise exception File "migrations/env.py", line 80, in run_migrations_online context.run_migrations() File "", line 8, in run_migrations File "/opt/walle-web/venv/lib/python3.6/site-packages/alembic/runtime/environment.py", line 846, in run_migrations self.get_context().run_migrations(**kw) File "/opt/walle-web/venv/lib/python3.6/site-packages/alembic/runtime/migration.py", line 518, in run_migrations step.migration_fn(**kw) File "/opt/walle-web/migrations/versions/2bca06a823a0_01_init_walle_database.py", line 24, in upgrade create_environments() File "/opt/walle-web/migrations/versions/2bca06a823a0_01_init_walle_database.py", line 53, in create_environments db.session.execute(sql) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/orm/scoping.py", line 153, in do return getattr(self.registry(), name)(*args, **kwargs) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 1187, in execute bind, close_with_result=True).execute(clause, params or {}) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute return meth(self, multiparams, params) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement compiled_sql, distilled_params File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context context) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception exc_info File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise raise value.with_traceback(tb) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context context) File "/opt/walle-web/venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute cursor.execute(statement, parameters) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute result = self._query(query) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query conn.query(q) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result result.read() File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read first_packet = self.connection._read_packet() File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet packet.check_error() File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error err.raise_mysql_exception(self._data) File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception raise errorclass(errno, errval) sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1067, "Invalid default value for 'created_at'") [SQL: "CREATE TABLE environments (\n id int(10) NOT NULL AUTO_INCREMENT COMMENT '',\n name varchar(100) DEFAULT 'master' COMMENT '',\n space_id int(10) NOT NULL DEFAULT '0' COMMENT '',\n status tinyint(1) DEFAULT '1' COMMENT '',\n created_at datetime DEFAULT CURRENT_TIMESTAMP COMMENT '',\n updated_at datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',\n PRIMARY KEY (id)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='';"] (Background on this error at: http://sqlalche.me/e/2j85) Fatal Python error: PyImport_GetModuleDict: no module dictionary!

Thread 0x00007fa49ebb2700 (most recent call first): File "/opt/walle-web/venv/lib/python3.6/site-packages/gevent/_threading.py", line 84 in wait File "/opt/walle-web/venv/lib/python3.6/site-packages/gevent/_threading.py", line 166 in get File "/opt/walle-web/venv/lib/python3.6/site-packages/gevent/threadpool.py", line 270 in _worker

Current thread 0x00007fa4b2eff740 (most recent call first): File "/opt/walle-web/venv/lib/python3.6/site-packages/pymysql/connections.py", line 379 in _force_close admin.sh: 行 137: 11686 已放弃 flask db upgrade Migration: [ fail ] [root@localhost walle-web]#

logs/runtime.log

runtime...

logs/error.log

error...

截图 拖拽到此处即可上传

运行环境

  • OS: [e.g. Centos 7.x]
  • 版本 [e.g. aba77b36] walle首页信息处显示

freegodly avatar Nov 08 '19 09:11 freegodly

MySQL 5.6.5以上,否则会在安装时报错

wangy8961 avatar Aug 27 '20 00:08 wangy8961