24 lines
779 B
Elixir
24 lines
779 B
Elixir
defmodule Towerops.Repo.Migrations.CreateIntegrations do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:integrations, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true
|
|
|
|
add :organization_id, references(:organizations, type: :binary_id, on_delete: :delete_all),
|
|
null: false
|
|
|
|
add :provider, :string, null: false
|
|
add :enabled, :boolean, default: false, null: false
|
|
add :credentials, :binary
|
|
add :sync_interval_minutes, :integer, default: 10
|
|
add :last_synced_at, :utc_datetime
|
|
add :last_sync_status, :string, default: "never"
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create unique_index(:integrations, [:organization_id, :provider])
|
|
create index(:integrations, [:organization_id])
|
|
end
|
|
end
|