analytics/priv/repo/migrations/20230925072840_plugins_api_tokens.exs
hq1 311d66b341
Implement Plugins API Token schema (#3370)
* Implement Plugins API Token schema

* Work with domain change grace period

* Do not cast internal data, extend schema with hints
2023-09-26 13:02:04 +02:00

17 lines
505 B
Elixir

defmodule Plausible.Repo.Migrations.PluginsAPITokens do
use Ecto.Migration
def change do
create table("plugins_api_tokens", primary_key: false) do
add(:id, :uuid, primary_key: true)
add(:site_id, references(:sites, on_delete: :delete_all), null: false)
add(:token_hash, :bytea, null: false)
add(:hint, :string, null: false)
add(:description, :string, null: false)
timestamps()
end
create(index(:plugins_api_tokens, [:site_id, :token_hash]))
end
end