hhyo / hhyo/Archery

v1.9.1升级v1.10.0 migrate失败

Open
#2,248 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.1k
Forks
1.9k
Avg merge
2d 11h
Merged PRs (30d)
6

Description

### 重现步骤

1、按升级步骤执行src/init_sql/v1.10.0.sql
2、执行python manage.py migrate 报错
Running migrations:
No migrations to apply.
Your models in app(s): 'sql' have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
3、按提示执行python manage.py makemigrations
It is impossible to add a non-nullable field 'id' to config without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Quit and manually define a default value in models.py.

### 预期外的结果

数据库合并失败,前台用户无法查询到已授权的数据库实例

### 日志文本

_No response_

### 版本

1.10.0

### 部署方式

Docker

### 是否还有其他可以辅助定位问题的信息?比如数据库版本等

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing src/init_sql/v1.10.0.sql and reproduce the upgrade with python manage.py migrate, then run python manage.py makemigrations to inspect the reported config.id change. Trace the migration state for the sql app and verify that the upgrade completes without prompting for a default and that authorized database instances become queryable.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.