Arex.Schema (arex v0.1.0)

Copy Markdown View Source

Schema, index, and bucket helpers.

Arex.Schema keeps common ArcadeDB schema operations close to the underlying SQL commands while normalizing return values for missing resources. Use it to inspect types, create or drop schema elements, and provision buckets.

The module aims to sit in the middle ground between raw SQL and a large DSL:

  • identifiers are validated before commands are sent
  • common missing-resource cases come back as {:ok, :missing}
  • the public API stays close to ArcadeDB terminology

That makes it suitable for migrations, application bootstrapping, and test setup without forcing callers to build schema SQL by hand.

Summary

Functions

Returns one bucket row by name or nil when the bucket does not exist.

Lists buckets in the target database.

Creates a document type.

Creates an edge type.

Creates an index on one or more fields.

Creates a property on a type using the given ArcadeDB property type.

Creates a vertex type.

Drops a bucket and returns {:ok, :missing} when the bucket does not exist.

Drops an index by name, returning {:ok, :missing} when absent.

Drops a property and returns {:ok, :missing} when the property does not exist.

Drops a type when it exists, returning {:ok, :missing} when absent.

Lists all indexes across all types in the target database.

Lists indexes for a single type.

Lists all properties for a type.

Returns one type row by name or nil when the type does not exist.

Lists all types in the target database.

Functions

bucket(name, opts \\ [])

Returns one bucket row by name or nil when the bucket does not exist.

buckets(opts \\ [])

Lists buckets in the target database.

create_bucket(name, opts \\ [])

Creates a bucket.

create_document_type(name, opts \\ [])

Creates a document type.

create_edge_type(name, opts \\ [])

Creates an edge type.

create_index(type_name, fields, opts \\ [])

Creates an index on one or more fields.

Pass unique: true for a unique index. Otherwise Arex emits ArcadeDB's explicit notunique type because that is the syntax required by the tested HTTP API.

create_property(type_name, property_name, property_type, opts \\ [])

Creates a property on a type using the given ArcadeDB property type.

create_vertex_type(name, opts \\ [])

Creates a vertex type.

drop_bucket(name, opts \\ [])

Drops a bucket and returns {:ok, :missing} when the bucket does not exist.

drop_index(index_name, opts \\ [])

Drops an index by name, returning {:ok, :missing} when absent.

drop_property(type_name, property_name, opts \\ [])

Drops a property and returns {:ok, :missing} when the property does not exist.

drop_type(name, opts \\ [])

Drops a type when it exists, returning {:ok, :missing} when absent.

indexes(opts \\ [])

Lists all indexes across all types in the target database.

indexes(type_name, opts)

Lists indexes for a single type.

properties(type_name, opts \\ [])

Lists all properties for a type.

type(name, opts \\ [])

Returns one type row by name or nil when the type does not exist.

types(opts \\ [])

Lists all types in the target database.