Skip to main content

priv/repo/migrations/20260518211100_create_ai_prompt_templates.exs

defmodule Scoria.Repo.Migrations.CreateAiPromptTemplates do
  use Ecto.Migration

  def change do
    create table(:ai_prompt_templates, primary_key: false) do
      add :id, :binary_id, primary_key: true
      add :entity_id, :binary_id, null: false
      add :version, :integer, null: false, default: 1
      add :is_current, :boolean, null: false, default: true
      add :status, :string, null: false, default: "draft"
      add :system_message, :text
      add :few_shot_examples, :map
      add :user_template, :text
      add :estimated_tokens, :integer

      timestamps(type: :utc_datetime_usec)
    end

    create index(:ai_prompt_templates, [:entity_id, :version], unique: true)
    create index(:ai_prompt_templates, [:entity_id])
  end
end