Skip to content

Release v2.0.0

Choose a tag to compare

@TomGrozev TomGrozev released this 10 Jan 09:49
· 6 commits to master since this release
47d67e0

2.0.0

This is a big release with a lot of changes and has been over a year in the
making. I am so glad it is finally finished :)

There are many breaking changes and the API to lots of functions have changed.
Please make sure to check the changes in the docs.

Some of the commits were big and does not follow good commit practices. I know
some might say "why didn't you do this progressively?" and yes that is correct
it should have been done that way. However, I have been very busy over the past
year which is why it took so long to get this version out of the door. I also
got a new computer and moved house so sometimes rules go out of the window.

Static mode is now the default as it is more production ready. Dynamic mode can
now be set by setting :static to false in your config.

This release now requires Ecto 3.12 and Arangox 0.6.0 as a minimum.

Enhancements

Migrations improvements

Complete rework of migrations functionality to support full migrations including
using ArangoDB schemas for database level validation. (#73)

  • All database actions are done through migrations
    • This includes create, modify, rename and remove functions for Collections,
      Indexes, Views and Analyzers.
  • Add JSON schema generation from migrations for database level validation
  • Migrations are run in a transaction
  • Commands updated to not conflict with other database adapters
    • mix ecto.migrate.arango renamed to mix arango.migrate, same for other
      commands
    • Use the execute_ddl/3 function in the adapter to support other
      database adapters
  • Type of collection is set in options rather then a parameter
  • Migrations can be run as part of a supervision tree (for when doing
    releases)
  • Option to cast migration version to integer (default false)
  • Supports add, remove, modify, add_if_not_exists and remove_if_exists
    migration commands
  • Support embedded fields and an array of embedded fields
  • Supports reversing migrations, hence can use just the change/0 function in
    migrations rather than needing to use both up/0 and down/0

Graphing relations improvements

Complete rework of graph relationships (#39).

This replaces the many_to_many usage with a purpose build Ecto association.
The primary difference is that this allows for multiple different
schemas to be related, i.e. it is polymorphic. I.e. A User could have
a field called :my_content that could have either Posts or Comments
associated. This lines up better with how ArangoDB works.

To get this working it required a few tricks and in some cases it
required a copy and reimplementation of some of Ecto's functions. For
example, a new ArangoXEcto.Changeset module was created and must be
imported to use the cast_graph/3 and put_graph/4. These two
functions are essentially the same as the cast_assoc/3 and
put_assoc/4 functions that Ecto provide, except it will allow for
multiple types to be applied and supports the mapping by the fields in
attributes.

In addition to this the EdgeMany association was created so that it supports
multiple schemas being passed. This is so that edges can have multiple schemas
in the from and to, which lines up more closely with how ArangoDB functions.

  • ArangoXEcto.create_edge/4 supports a list of edge modules
  • Ensure that the from and to schemas exist in an edge definition
  • Add ArangoXEcto.Query.graph/5 macro to perform graph queries through Ecto
    queries
  • Added the ArangoXEcto.Changeset.cast_graph/3 and
    ArangoXEcto.Changeset.put_graph/4 functions
  • Add the ArangoXEcto.Association.EdgeMany and ArangoXEcto.Association.Graph
    association definitions
  • Add ArangoXEcto.preload/4 function to support preloading graph associations
  • Removed the one_outgoing/3, one_incoming/3 and build_foreign_key/1 functions
    since they were not used and essentially just reimplement Ecto functions.

Other Enhancements

  • Enhance transaction functionality and add rollback ability
  • Added the ability to stream queries using ArangoDB's cursors
  • Improve logging and telemetry (Based on the ecto_sql implementation)
    • Add logging and telemetry handlers to query, insert, update and delete
      functions
    • Supports transactions and AQL queries
  • Add caching of queries in Ecto
  • Improve connection handling with database between Ecto and adapter
  • View links validation is moved to after compile to improve validation checks
  • Static mode is now the default
    • Added checks for functions that can only be run in static/dynamic mode
  • Add support for typecasting in Ecto queries through Ecto.Query.API.type/2
  • Add ArangoXEcto.Sandbox for integration testing (similar to the ecto_sql
    implementation)
  • Supports running alongside other database adapters, such as ecto_sql
    • Added dummy implementation of functions that ecto_sql uses
  • Add support for fragments (and splicing) in queries that are then converted
    into AQL
  • Removed the already deprecated ArangoXEcto.raw_to_struct/2 function
  • Update to support Ecto 3.12 (now minimum required version)

Fixes

  • Fix typespec for t:mod/0 in ArangoXEcto
  • ArangoSearch type is forced to be "arangosearch"
  • Rename is_edge?/1, is_document?/1 and is_view?/1 to remove the is_
  • Type checking functions (the ones mentioned above) will ensure that the module
    being checked is loaded before checking
  • Fix type validation on analyzer creation
  • Resolve :database option passed to ArangoXEcto.query/4 not working
  • Allow nil to be passed to type loaders in adapter
  • Make prefix option work universally across all database functions
  • Update mix formatter configuration
  • Clean up ArangoXEcto.load/2 function
  • Move :fullCount property to the adapter so that it is used for all
    connections
  • Add check so that mix tasks are only run on ArangoXEcto repos
  • Remove ArangoXEcto.Utils module
  • Fix issue where collection indexes were not being created in dynamic mode
  • Removed some unused clauses in ArangoXEcto.Types.GeoJSON
  • Add missing tests for mix tasks (excluded by default)
  • Migrate formatting to preferred formatting for elixir 1.18 (using mix format
    --migrate)
  • Various cleanups of the codebase
  • Various test fixes

Doc changes

  • Add basic guides
  • Significant improvement to documentation and typespec coverage

Repo changes

  • Update dependencies
  • Improve test coverage to at least 80%
    • This was a big rework to include more tests and really ensuring
      functionality works
  • Update doctor configuration
  • Ignore tmp directory in git repo for when tests are run
  • Update CI pipeline
    • Update elixir and otp versions
    • Make arangodb version explicit to 3.11
  • Add coveralls for test coverage checking