39 Commits

Author SHA1 Message Date
Waket Zheng
a624d1b43b
fix: migrate does not recognise attribute changes for string primary key (#428)
* refactor: show warning for unsupported pk field changes

* fix: migrate does not recognise attribute changes for string primary key

* docs: update changelog

* refactor: reduce indents

* chore: update docs
2025-02-27 22:23:26 +08:00
Waket Zheng
91adf9334e
feat: support skip table migration by set managed=False (#397) 2025-02-21 17:08:03 +08:00
Waket Zheng
41df464e8b
fix: no migration occurs when adding unique true to indexed field (#414)
* feat: alter unique for indexed column

* chore: update docs and change some var names
2025-02-20 16:58:32 +08:00
程序猿过家家
c35282c2a3
fix: inspectdb not match data type 'DOUBLE' and 'CHAR' for MySQL
* increase:
1. Inspectdb adds DECIMAL, DOUBLE, CHAR, TIME data type matching;
2. Add exception handling, avoid the need to manually create the entire table because a certain data type is not supported.

* fix: aerich inspectdb raise KeyError for double in MySQL

* feat: support command `python -m aerich`

* docs: update changelog

* tests: verify mysql inspectdb for float field

* fix mysql uuid field inspect to be charfield

* refactor: use `db_index=True` instead of `index=True` for inspectdb

* docs: update changelog

---------

Co-authored-by: xiechen <xiechen@jinse.com>
Co-authored-by: Waket Zheng <waketzheng@gmail.com>
2025-02-19 16:04:15 +08:00
Waket Zheng
1793dab43d
refactor: apply future type hints style (#416)
* refactor: apply future style type hints

* chore: put cryptography out of dev dependencies
2025-02-17 11:42:56 +08:00
Waket Zheng
6bdfdfc6db
fix: aerich migrate raises tortoise.exceptions.FieldError when index.INDEX_TYPE is not empty (#415)
* fix: aerich migrate raises `tortoise.exceptions.FieldError` when `index.INDEX_TYPE` is not empty

* feat: add `IF NOT EXISTS` to postgres create index template

* chore: explicit declare type hints of function parameters
2025-02-13 18:48:45 +08:00
Waket Zheng
5e8a7c7e91
fix: migration with duplicate renaming of columns in some cases (#395)
* fix: migration with duplicate renaming of columns in some cases

* Update var name

* fix downgrade sql error

* fix test error

* docs: update changelog

* Add unittest

* Move not change line to origin position

* Update sort key to make it more frieldly interactive from multi fields rename

* refactor: remove puzzle vars

* docs: fix PR links in changelog

* fix sort key lambda error
2024-12-27 12:09:23 +08:00
Waket Zheng
7d22518c74
Fix create/drop indexes in every migration (#377)
* Add `__eq__` method for `Index`instances

* tests: add Index test case

* refactor: compare index instances before set hash and eq func to class

* fix: sort fields when generating index hash

* docs: update changlog

* fix style issue

* refactor: use CustomIndex instead of postgres special HashIndex

* Check tortoise version before patch Index

* Add comment

* Add comment for why > work

---------

Co-authored-by: dbf <somnium@riseup.net>
2024-12-22 00:24:18 +08:00
Waket Zheng
f93faa8afb
fix: add o2o field does not create constraint when migrating (#396)
* fix: add o2o field does not create constraint when migrating

* Add testcase and update changelog

* docs: update migrating list

* refactor: use `_handle_o2o_fields` instead of `is_o2o=True`

* Remove unused line
2024-12-22 00:23:47 +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
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
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
dc020358b6 chore: make style, upgrade deps, fix ci error and update changelog 2024-11-25 23:46:48 +08:00
long2ice
15d56121ef fix: migrate 2024-08-06 22:46:50 +08:00
Waket Zheng
7b733495fb fix conflict 2024-06-06 16:35:09 +08:00
Waket Zheng
e764bb56f7 Add new column for unique index remove test 2024-06-06 09:07:13 +08:00
Waket Zheng
1addda8178 Improve type hints for tests/ 2024-06-01 20:58:25 +08:00
long2ice
ab31445fb2 fix: test 2022-09-26 18:39:48 +08:00
long2ice
28d19a4b7b - Fix syntax error with python3.8.10. (#265)
- Fix sql generate error. (#263)
2022-09-26 18:36:57 +08:00
long2ice
75db7cea60 fix: test error 2022-09-23 10:35:33 +08:00
long2ice
e9b76bdd35 feat: use .py version files 2022-09-23 10:29:48 +08:00
long2ice
3c88833154 fix: decimal field change (#246) 2022-06-27 11:29:47 +08:00
long2ice
699b0321a4 Support indexes change. (#193) 2021-08-31 17:36:25 +08:00
Vovetta
aa9f40ae27 Fix: migrate doesn't use source_field in unique_together 2021-08-03 10:36:06 -07:00
long2ice
b147859960 Fix default function when migrate 2021-04-04 05:46:34 +00:00
long2ice
505d361597 Fix drop model in the downgrade. (#132) 2021-03-18 23:40:13 +08:00
long2ice
52151270e0 Fix bug for field change. (#119) 2021-03-03 20:36:54 +08:00
long2ice
38a3df9b5a add support m2m 2021-02-03 22:22:22 +08:00
long2ice
f1f0074255 Support rename field 2021-02-03 17:56:30 +08:00
long2ice
01e3de9522 basically completed 2021-02-03 15:43:04 +08:00
long2ice
c60bdd290e add fk and drop fk 2021-02-02 20:35:05 +08:00
long2ice
f443dc68db WIP 2021-02-01 16:54:35 +08:00
long2ice
36f84702b7 update 2021-02-01 14:00:12 +08:00
long2ice
ce8c0b1f06 Support db_constraint in fk 2020-09-28 10:40:04 +08:00
long2ice
23dd29644c fix dependency import 2020-05-21 13:44:09 +08:00
long2ice
a99a06e563 now alice is basic worked 2020-05-15 10:45:40 +08:00
long2ice
2da90ecca6 finish base cli 2020-05-14 18:46:17 +08:00
long2ice
4e7e1626aa add ddl 2020-05-12 19:33:21 +08:00