# `ExDataSketch.Storage.Ecto.Schema`
[🔗](https://github.com/thanos/ex_data_sketch/blob/main/lib/ex_data_sketch/storage/ecto/schema.ex#L2)

Ecto schema for the `ex_data_sketch_sketches` table.

This schema maps the persistence table used by `ExDataSketch.Storage.Ecto`.
The table stores serialized EXSK v2 binary frames with the following columns:

- `id` -- auto-incrementing primary key
- `key` -- unique key for the sketch (string)
- `sketch_type` -- the sketch family name (e.g., "hll", "cms")
- `data` -- the serialized EXSK v2 binary frame
- `inserted_at` -- timestamp of insertion
- `updated_at` -- timestamp of last update

## Dependency

This module requires the `:ecto_sql` package. If Ecto is not available,
this module will not be compiled.

## Usage

This module is used internally by `ExDataSketch.Storage.Ecto`. You should
not need to interact with it directly. To create the table, use the
migration generator:

    mix ex_data_sketch.gen.migration --repo MyApp.Repo

# `t`

```elixir
@type t() :: %ExDataSketch.Storage.Ecto.Schema{
  __meta__: term(),
  data: binary() | nil,
  id: integer() | nil,
  inserted_at: NaiveDateTime.t() | nil,
  key: String.t() | nil,
  sketch_type: String.t() | nil,
  updated_at: NaiveDateTime.t() | nil
}
```

# `changeset`

```elixir
@spec changeset(t(), map()) :: Ecto.Changeset.t()
```

Creates a changeset for a sketch record.

## Arguments

- `schema` -- an existing schema struct or `%Schema{}`.
- `attrs` -- a map of attributes.

## Returns

An `Ecto.Changeset`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
