Added upload date index field to media_items

This commit is contained in:
Kieran Eglin 2024-05-02 09:22:36 -07:00
parent 112c6a4f14
commit 0c71501e51
No known key found for this signature in database
GPG key ID: 193984967FCF432D
2 changed files with 13 additions and 0 deletions

View file

@ -24,6 +24,7 @@ defmodule Pinchflat.Media.MediaItem do
:source_id,
:short_form_content,
:upload_date,
:upload_date_index,
:duration_seconds,
# these fields are captured only on download
:media_downloaded_at,
@ -66,6 +67,7 @@ defmodule Pinchflat.Media.MediaItem do
field :media_downloaded_at, :utc_datetime
field :media_redownloaded_at, :utc_datetime
field :upload_date, :date
field :upload_date_index, :integer, default: 0
field :duration_seconds, :integer
field :media_filepath, :string

View file

@ -0,0 +1,11 @@
defmodule Pinchflat.Repo.Migrations.AddUploadDateIndexToMediaItems do
use Ecto.Migration
def change do
alter table(:media_items) do
add :upload_date_index, :integer, null: false, default: 0
end
create index("media_items", [:upload_date])
end
end