243 Commits

Author SHA1 Message Date
Waket Zheng
4fc7f324d4
fix: add m2m field with custom m2m through generate duplicated table when migrating (#393)
* fix: m2m table duplicated when using custom model for through

* Add testcase

* docs: update changelog

* tests: add m2m custom through example test
2024-12-17 22:28:06 +08:00
Waket Zheng
d8addadb37
chore(deps): prefer to use tomllib/tomli and mark tomlkit/tomli_w as optional (#392)
* chore(deps): prefer to use tomllib and mark tomlkit as optional

* docs: add toml extra to install command

* docs: update changelog
2024-12-17 01:43:36 +08:00
Waket Zheng
0780919ef3
fix: migrate drop the wrong m2m field when model have multi m2m fields (#390)
* fix: migrate drop the wrong m2m field when model have multi m2m fields

* Make style and update changelog

* refactor: return new lists instead of change argument values in function

* refactor: use custom diff function instead of reorder lists

* docs: fix typo

* Fix hardcoded and rename custom diff function

* Update function doc
2024-12-17 01:20:02 +08:00
Waket Zheng
56da0e7e3c fix: KeyError raised when removing or renaming an existing model 2024-12-12 10:43:40 +08:00
Lance.Moe
6270c4781e
fix: error when there is __init__.py in the migration folder (#272)
* fix: error when there is __init__.py in the migration folder

* fix: check __init__.py in the migration folder

* refactor

* refactor & add test

* refactor

* Update changelog

---------

Co-authored-by: Waket Zheng <waketzheng@gmail.com>
2024-12-11 21:34:14 +08:00
Waket Zheng
12d0a5dad1
fix: setting null=false on m2m field causes migration to fail (#385)
* fix: setting null=false on m2m field causes migration to fail

* Update changelog
2024-12-11 21:12:04 +08:00
Waket Zheng
e4a3863f80
fix: aerich upgrade raises OperationalError when unique constraint dropped at migration 1_xxx.py with postgres (#383) 2024-12-11 15:15:29 +08:00
Waket Zheng
5572876714
fix: NonExistentKey when running aerich init without [tool] section in config file (#381)
* fix: NonExistentKey when running `aerich init` without `[tool]` section in config file

* docs: update changelog
2024-12-11 13:26:18 +08:00
Tuffy_
accceef24f
Fixed two problems when using under windows (#286)
* fix: Fixed an issue where an error would occur when using aerich in windows if the profile contained Chinese characters

* fix: Automatically delete the empty migration directory of the app if the init-db operation fails

* feat: generate migration file in empty directory instead of abort with warning

* tests: fix test fail in ci

---------

Co-authored-by: Waket Zheng <waketzheng@gmail.com>
2024-12-10 23:02:49 +08:00
Waket Zheng
9c81bc6036
Fix sqlite create/drop index (#379)
* Update add/drop index template for sqlite

* tests: add sqlite migrate/upgrade command test

* tests: add timeout for sqlite migrate command test

* tests: add test cases for add/drop unique field for sqlite

* fix: sqlite failed to add unique field
2024-12-10 16:37:30 +08:00
Waket Zheng
c2ebe9b5e4
Fix postgres fk rename (#378)
* Update postgres drop fk template

* fix test error

* docs: update changlog
2024-12-09 11:41:40 +08:00
Mykola Solodukha
8cefe68c9b
[BUG] Sort m2m fields before comparing them with diff(...) (#271)
* 🐛 Sort m2m fields before comparing them with `diff(...)`

* Add test case and upgrade changelog

---------

Co-authored-by: Waket Zheng <waketzheng@gmail.com>
2024-12-05 17:41:58 +08:00
Waket Zheng
44025823ee
chore: upgrade deps and fix ruff lint issues (#374)
* chore: upgrade deps and apply ruff lint for tests/

* style: fix ruff lint issues
2024-12-05 15:56:00 +08:00
Waket Zheng
252cb97767 Bump version to 0.8.0 and update changelog 2024-12-04 00:14:35 +08:00
Waket Zheng
b2f4029a4a
Improve type hints of inspectdb (#371) 2024-12-03 12:40:28 +08:00
xsillen
4e46d9d969
Fix the issue of parameter concatenation when generating ORM with inspectdb (#331)
Co-authored-by: floodpillar <165008032+floodpillar@users.noreply.github.com>
2024-12-03 11:44:36 +08:00
gck123
c0fd3ec63c
Fix KeyError when deleting a field with unqiue=True (#365)
* Fix KeyError when deleting a field with unqiue=True

* refactor: rename `old_data_unique` to `is_unique_field`

* Add testcases for remove unique field

---------

Co-authored-by: gongchangku <gongchangku@anban.tech>
Co-authored-by: Waket Zheng <waketzheng@gmail.com>
2024-12-03 10:16:44 +08:00
Waket Zheng
dc020358b6 chore: make style, upgrade deps, fix ci error and update changelog 2024-11-25 23:46:48 +08:00
Waket Zheng
095eb48196
Merge pull request #360 from ahmetveburak/fix-package
fix(package): correct the click import
2024-11-25 18:10:27 +08:00
ahmetveburak
e049fcee26
fix(package): correct the click import 2024-10-05 20:43:32 +03:00
Merlin
ee144d4a9b
update migrate output for consistency 2024-08-07 13:32:49 -04:00
Merlin
dbf96a17d3
Improve command-line descriptions
Changed CLI help texts for some of the options to make them clearer.
2024-08-07 13:31:07 -04:00
long2ice
15d56121ef fix: migrate 2024-08-06 22:46:50 +08:00
long2ice
4851ecfe82 refactor: use asyncclick 2024-08-06 22:41:39 +08:00
Waket Zheng
bceeb236c2 Checking cache action 2024-06-06 17:21:46 +08:00
Waket Zheng
ceb1e0ffef Activate type hint check in ci 2024-06-06 17:07:09 +08:00
long2ice
219633a926
Merge pull request #341 from waketzheng/type-hint-simple
Simple type hints for aerich/
2024-06-06 16:52:30 +08:00
long2ice
e6302a920a
Merge pull request #342 from waketzheng/type-hint-ddl
Improve type hints for ddl and inspectdb
2024-06-06 16:51:37 +08:00
Waket Zheng
c0c217392c Merge remote-tracking branch 'upstream/dev' into type-hint-simple 2024-06-06 16:32:00 +08:00
Waket Zheng
c7a3d164cb fix conflict 2024-06-06 16:31:24 +08:00
Waket Zheng
50add58981 merge dev 2024-06-06 16:27:06 +08:00
long2ice
f3b6f8f264
Merge pull request #345 from waketzheng/dev
Drop python3.7 support
2024-06-06 15:49:31 +08:00
Waket Zheng
e971653851 fix: mysql drop unique index migrate error 2024-06-05 23:37:30 +08:00
Waket Zheng
affffbdae3 Drop python3.7 support 2024-06-03 01:26:48 +08:00
Waket Zheng
6466a852c8 Add type hints for aerich.migrate 2024-06-02 18:09:34 +08:00
Waket Zheng
a917f253c9 Add type hints for inspectdb/sqlite 2024-06-02 17:56:54 +08:00
Waket Zheng
dd11bed5a0 Add type hints for ddl and inspectdb 2024-06-01 22:14:30 +08:00
Waket Zheng
8756f64e3f Simple type hints for aerich/ 2024-06-01 21:16:53 +08:00
artem.ulchenko
b25c7671bb try to fix "Add ManyToManyField will break migrate #150" issues 2024-01-18 11:40:59 +03:00
long2ice
b63fbcc7a4 style: fix 2024-01-18 09:50:41 +08:00
ar0ne
2b2e465362 missed changes that add new flag to cli 2023-12-27 12:56:46 +05:30
ar0ne
ad54b5e9dd remove redundant comma for empty migration 2023-12-26 23:12:11 +05:30
ar0ne
b1ff2418f5 added option to generate empty migration file 2023-12-26 22:55:51 +05:30
long2ice
01264f3f27 fix: pydantic v2. (#322) 2023-08-30 10:04:53 +08:00
long2ice
ea234a5799 fix: default empty str 2023-08-23 10:53:19 +08:00
strayge
6d83c370ad fix changed column descriptions in diffs 2023-08-21 10:58:43 +04:00
long2ice
8edd834da6 refactor: make in_transaction default True 2023-08-04 10:36:27 +08:00
Jorge Massih
fd4b9fe7d3
add char support for mysql 2023-06-15 00:40:29 -04:00
long2ice
f0bc3126e9 fix: generates two semicolons in a row. (#301) 2023-05-12 14:52:17 +08:00
Bogdan
818dd29991 fix styles 2023-05-05 17:29:34 +04:00