port over some more

This commit is contained in:
ra
2026-02-14 23:58:01 -07:00
parent 0222be36c5
commit 61176cd416
107 changed files with 9124 additions and 375 deletions

View File

@@ -0,0 +1,29 @@
defmodule Odinsea.Database.Schema.Donation do
@moduledoc """
Ecto schema for the donation table.
Represents donation records.
"""
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :id, autogenerate: true}
@timestamps_opts [inserted_at: :date, updated_at: false]
schema "donation" do
field :date, :naive_datetime
field :ip, :string
field :username, :string
field :quantity, :integer
field :status, :integer, default: 0
end
@doc """
Changeset for donation records.
"""
def changeset(donation, attrs) do
donation
|> cast(attrs, [:ip, :username, :quantity, :status])
|> validate_required([:ip, :username])
end
end