Giter Site home page Giter Site logo

Comments (6)

BaiJiangJie avatar BaiJiangJie commented on June 2, 2024

回滚数据库,重新升级,升级过程中不要中断。(因为进行数据表结构迁移是一个完整的操作,不能断开)。

from jumpserver.

linzehai0801 avatar linzehai0801 commented on June 2, 2024

试过回滚数据库,重新升级,结果还是一样的哦,过程没有中断过

from jumpserver.

linzehai0801 avatar linzehai0801 commented on June 2, 2024

Traceback (most recent call last):
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 87 , in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/mysql/base.py", li ne 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in exe cute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _qu ery
db.query(q)
File "/opt/py3/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1050, "Table 'assets_custom' already exists")

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

Traceback (most recent call last):
File "/opt/jumpserver/./jms", line 88, in perform_db_migrate
management.call_command('migrate')
File "/opt/py3/lib/python3.11/site-packages/django/core/management/init.py", line 198, in call_command
return command.execute(*args, **defaults)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/core/management/base.py", line 448, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/core/management/base.py", line 96, in wrapped
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/core/management/commands/migra te.py", line 349, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/migrations/executor.py", li ne 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/migrations/executor.py", li ne 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/migrations/executor.py", li ne 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/migrations/migration.py", l ine 130, in apply
operation.database_forwards(
File "/opt/py3/lib/python3.11/site-packages/django/db/migrations/operations/model s.py", line 96, in database_forwards
schema_editor.create_model(model)
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/base/schema.py", l ine 447, in create_model
self.execute(sql, params or None)
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/base/schema.py", l ine 199, in execute
cursor.execute(sql, params)
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 67 , in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 80 , in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 84 , in _execute
with self.db.wrap_database_errors:
File "/opt/py3/lib/python3.11/site-packages/django/db/utils.py", line 91, in ex it
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/utils.py", line 87 , in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/django/db/backends/mysql/base.py", li ne 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/MySQLdb/cursors.py", line 179, in exe cute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/py3/lib/python3.11/site-packages/MySQLdb/cursors.py", line 330, in _qu ery
db.query(q)
File "/opt/py3/lib/python3.11/site-packages/MySQLdb/connections.py", line 255, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1050, "Table 'assets_custom' already exists")
这个步骤是我再一次尝试的结果

from jumpserver.

BaiJiangJie avatar BaiJiangJie commented on June 2, 2024

我看和第一次执行的报错不一样了。
多尝试几次,创建数据库时编码要保持一致。

from jumpserver.

linzehai0801 avatar linzehai0801 commented on June 2, 2024

抱歉忘记说了,最开始是报错Table 'assets_custom' already exists",然后我手动把这个表删除了,接着就有了第一个报错(3780, "Referencing column 'asset_ptr_id' and referenced column 'id' in foreign key constraint 'assets_custom_asset_ptr_id_c9ab0d9d_fk_assets_asset_id' are incompatible."),现在无论怎么尝试都是这两个报错

from jumpserver.

BaiJiangJie avatar BaiJiangJie commented on June 2, 2024

#11047 (comment)

看下这个回复。主要是字符集问题。

from jumpserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.