Closed oxpaoff closed 1 year ago
@oxpaoff I'am sorry, this is a bug. I have made an uncompatiable change, the minor version should be changed too!
for now, you can fix this by add deleted
column manually.
connect to your clickhouse server and run:
ALTER table django_migrations ADD COLUMN deleted Bool;
Excuse me, I also seem to have encountered a problem about 'deleted', I thought it was my own code problem at first, but then I directly created a new djangorestframework project, just did the operation of configuring the clickhouse database, and found that the error was the same as the test project I wrote, I suspected it was a version update problem, the following is my error message: (I also found that when executing python manage.py makemigrations, there are no files generated in the migrations directory, I want to try to test the user functionality built into DjangorestFramework, I think there should be no need to build models, so I don't have a configuration models.py file.)
(venv) PS D:\source\djangoProject1> python manage.py makemigrations
No changes detected
(venv) PS D:\source\djangoProject1> python manage.py migrate
Traceback (most recent call last):
File "D:\source\djangoProject1\manage.py", line 22, in
@oxpaoff I'am sorry, this is a bug. I have made an uncompatiable change, the minor version should be changed too!
for now, you can fix this by add column manually.
deleted
connect to your clickhouse server and run:
ALTER table django_migrations ADD COLUMN deleted Bool;
By the way, even if I executed this SQL, it still didn't work.
@oxpaoff I'am sorry, this is a bug. I have made an uncompatiable change, the minor version should be changed too! for now, you can fix this by add column manually.
deleted
connect to your clickhouse server and run:ALTER table django_migrations ADD COLUMN deleted Bool;
By the way, even if I executed this SQL, it still didn't work.
show create table django_migrations;
? I'm using v1.1.2 in my own project and adding deleted
column have solved this problem.Sure!
CREATE TABLE django_data.django_migrations
(
id
Int64,
app
FixedString(255),
name
FixedString(255),
applied
DateTime64(6, 'UTC'),
deleted
Bool
)
ENGINE = MergeTree
ORDER BY id
SETTINGS index_granularity = 8192
@Song-yes I guess this is another bug, when you don't import clickhouse_backend.models
in project, then clickhouse_backend.patch.patch_all
is not called at the right time. I haven't tested without using ClickhouseModel
.
For now, your can:
python manage.py startapp stub
stub/models.py
, add this line
import clickhouse_backend.models
stub
to INSTALLED_APPS
in your django settings fileOh, I didn't take into account, for models files without configuration, also need to import modules, thank you very much for your answer。
Describe the bug i have such error while python manage.py migrate --database clickhouse -
DB::Exception: There's no column 'django_migrations.deleted' in table 'django_migrations': While processing django_migrations.deleted: While processing SELECT django_migrations.id, django_migrations.app, django_migrations.name, django_migrations.applied, django_migrations.deleted FROM django_migrations WHERE NOT django_migrations.deleted. Stack trace:
.To Reproduce I do not know what changed by i just run
python manage.py migrate --database clickhouse
Expected behavior No errors.
Versions
SELECT version()
query.