Gozargah / Marzban

Unified GUI Censorship Resistant Solution Powered by Xray
https://t.me/gozargah_marzban
GNU Affero General Public License v3.0
3.73k stars 517 forks source link

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "DROP": syntax errorBug title #705

Closed reza-kiani closed 10 months ago

reza-kiani commented 11 months ago

after running alembic upgrade head, I get the following error:

INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade 7a0dbb8a2f65 -> fe7796f840a4, remove certficiate from nodes Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: near "DROP": syntax error

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

Traceback (most recent call last): File "/usr/local/bin/alembic", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/site-packages/alembic/config.py", line 590, in main CommandLine(prog=prog).main(argv=argv) File "/usr/local/lib/python3.8/site-packages/alembic/config.py", line 584, in main self.run_cmd(cfg, options) File "/usr/local/lib/python3.8/site-packages/alembic/config.py", line 561, in run_cmd fn( File "/usr/local/lib/python3.8/site-packages/alembic/command.py", line 322, in upgrade script.run_env() File "/usr/local/lib/python3.8/site-packages/alembic/script/base.py", line 569, in run_env util.load_python_file(self.dir, "env.py") File "/usr/local/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 94, in load_python_file module = load_module_py(module_id, path) File "/usr/local/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 110, in load_module_py spec.loader.exec_module(module) # type: ignore File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "app/db/migrations/env.py", line 82, in run_migrations_online() File "app/db/migrations/env.py", line 76, in run_migrations_online context.run_migrations() File "", line 8, in run_migrations File "/usr/local/lib/python3.8/site-packages/alembic/runtime/environment.py", line 853, in run_migrations self.get_context().run_migrations(kw) File "/usr/local/lib/python3.8/site-packages/alembic/runtime/migration.py", line 623, in run_migrations step.migration_fn(kw) File "/root/Marzban/app/db/migrations/versions/fe7796f840a4_remove_certficiate_from_nodes.py", line 21, in upgrade op.drop_column('nodes', 'certificate') File "", line 8, in drop_column File "", line 3, in drop_column File "/usr/local/lib/python3.8/site-packages/alembic/operations/ops.py", line 2189, in drop_column return operations.invoke(op) File "/usr/local/lib/python3.8/site-packages/alembic/operations/base.py", line 399, in invoke return fn(self, operation) File "/usr/local/lib/python3.8/site-packages/alembic/operations/toimpl.py", line 89, in drop_column operations.impl.drop_column( File "/usr/local/lib/python3.8/site-packages/alembic/ddl/impl.py", line 331, in drop_column self._exec(base.DropColumn(table_name, column, schema=schema)) File "/usr/local/lib/python3.8/site-packages/alembic/ddl/impl.py", line 195, in _exec return conn.execute(construct, multiparams) File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1380, in execute return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS) File "/usr/local/lib/python3.8/site-packages/sqlalchemy/sql/ddl.py", line 80, in _execute_on_connection return connection._execute_ddl( File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1472, in _execute_ddl ret = self._execute_context( File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context self._handle_dbapi_exception( File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapiexception util.raise( File "/usr/local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 210, in raise_ raise exception File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "DROP": syntax error [SQL: ALTER TABLE nodes DROP COLUMN certificate] (Background on this error at: https://sqlalche.me/e/14/e3q8)

# xray version Xray 1.8.6 (Xray, Penetrates Everything.) Custom (go1.21.4 linux/amd64) A unified platform for anti-censorship.

# python3.8 --version Python 3.8.18

parhawm commented 11 months ago

sqlite doesn't support dropping a column until version 3.35 try upgrading libsqlite3-0 if you use ubuntu, or even better upgrade your whole system. good luck