Skip to main content

Module relation_has_many_composite_key

Module relation_has_many_composite_key 

Source
Expand description

Tests for has_many / belongs_to relationships whose foreign key spans multiple columns. These parallel the single-key relation tests so we can make sure composite-key behavior matches.

Two scenarios are used:

  • crate::scenarios::composite_has_many_belongs_toUser with a single-column auto PK and a Todo whose PK is #[key(partition = user_id, local = id)]. The FK column is part of the child’s identity, so reassignment isn’t supported on backends that can’t mutate primary-key columns (DynamoDB).
  • crate::scenarios::composite_fk_has_many_belongs_toUser with a composite PK (id, revision), and Todo with single PK and a two-column indexed FK. Used by the reassignment tests, which need the FK to be a plain updatable column.

See: https://github.com/tokio-rs/toasty/discussions/904

Modules§

composite_add_remove_multiple_relation_option_belongs_to
composite_add_remove_single_relation_required_belongs_to
composite_assign_todo_to_user_on_update_query
composite_basic_has_many_and_belongs_to_preload
composite_belongs_to_required
composite_crud_has_one_required
composite_crud_user_todos
composite_delete_when_belongs_to_optional
composite_filter_by_belongs_to_field
composite_filter_parent_by_child_field
composite_has_many_insert_on_update
composite_nested_has_many_then_belongs_to_required
composite_preload_has_many_with_optional_belongs_to
composite_preload_on_empty_query
composite_remove_add_single_relation_option_belongs_to
composite_scoped_find_by_id
composite_select_belongs_to_basic
composite_user_batch_create_todos_one_level
composite_user_batch_create_todos_with_optional_field
composite_user_batch_create_two_todos_simple

Functions§

composite_assign_existing_user_to_todo
composite_assign_todo_that_already_has_user_on_create
composite_assign_todo_that_already_has_user_on_update
composite_associate_new_user_with_todo_on_update_query_via_creation
composite_associate_new_user_with_todo_on_update_via_creation
composite_belongs_to_missing_index_is_error
When a composite-key belongs_to has no covering index on the parent side, schema verification must return a helpful invalid-schema error rather than panicking with failed to find relation index.
composite_reassign_relation_required_belongs_to