Skip to content

Conversation

@waketzheng
Copy link
Contributor

@waketzheng waketzheng commented Feb 7, 2025

Fixes tortoise-orm#1987

  1. Use Index.describe() to encode Index object instead of pickle for tortoise-orm>=0.24
  2. Only use pickle to load obj['val'] when obj.get('type') == 'index' for object_hook
  3. Add index_type and extra to ddl._ADD_INDEX_TEMPLATE
  4. Add IF EXISTS into ddl. _DROP_INDEX_TEMPLATE
  5. Add IF NOT EXISTS into postgres index create template
  6. Use load_index to convert dict to Index instance when comparing indexes
  7. New test case:
  • Index --> HashIndex for PostgreSQL
  • Index --> FullTextIndex for MySQL

@waketzheng waketzheng force-pushed the fix-hash-index-migrate branch from 5919909 to 3577481 Compare February 11, 2025 07:21
@waketzheng waketzheng changed the title fix: aerich migrate raises tortoise.exceptions.FieldError when index.INDEX_TYPE is not empty fix: aerich migrate raises tortoise.exceptions.FieldError when index.INDEX_TYPE is not empty Feb 11, 2025
@waketzheng waketzheng merged commit 6bdfdfc into tortoise:dev Feb 13, 2025
24 checks passed
@waketzheng waketzheng deleted the fix-hash-index-migrate branch February 13, 2025 10:49
@tgorham4 tgorham4 mentioned this pull request Feb 26, 2025
@waketzheng waketzheng mentioned this pull request Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tortoise.exceptions.FieldError: Value ... is invalid json value.

2 participants