Skip to content

Make map encoding configurable #162

Closed
@a-nassim

Description

@a-nassim

I wanted to try the SQLite JSONB format, i.e. JSON stored as a BLOB instead of a TEXT.
I was able to do so by specifying the :blob type instead of :map in a migration.

defmodule Migration do
  @moduledoc """
  Updates resources based on their most recent snapshots.

  This file was autogenerated with `mix ash_sqlite.generate_migrations`
  """

  use Ecto.Migration

  def up do
    create table(:resources, primary_key: false) do
      # add :my_map, :map, null: false <- generated line
      add :my_map, :blob, null: false #  <- edited line
      add :id, :bigserial, null: false, primary_key: true
    end
  end

  def down do
    drop table(:resources)
  end
end

It would be convenient if we could use :map in migrations, configuring :blob just once for the adapter, similar to how it is done in the Postgres adapter. TEXT could still be the default.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions