[WIP] renamed and migrated upload_date column
This commit is contained in:
parent
7603ba017f
commit
5b1c285670
3 changed files with 22 additions and 1 deletions
|
|
@ -69,7 +69,7 @@ defmodule Pinchflat.Media.MediaItem do
|
||||||
field :short_form_content, :boolean, default: false
|
field :short_form_content, :boolean, default: false
|
||||||
field :media_downloaded_at, :utc_datetime
|
field :media_downloaded_at, :utc_datetime
|
||||||
field :media_redownloaded_at, :utc_datetime
|
field :media_redownloaded_at, :utc_datetime
|
||||||
field :upload_date, :date
|
field :uploaded_at, :utc_datetime
|
||||||
field :upload_date_index, :integer, default: 0
|
field :upload_date_index, :integer, default: 0
|
||||||
field :duration_seconds, :integer
|
field :duration_seconds, :integer
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 449 KiB After Width: | Height: | Size: 448 KiB |
|
|
@ -0,0 +1,21 @@
|
||||||
|
defmodule Pinchflat.Repo.Migrations.RenameUploadDateToUploadedAt do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
rename table(:media_items), :upload_date, to: :uploaded_at
|
||||||
|
|
||||||
|
execute """
|
||||||
|
UPDATE media_items
|
||||||
|
SET uploaded_at = uploaded_at || 'T00:00:00'
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
rename table(:media_items), :uploaded_at, to: :upload_date
|
||||||
|
|
||||||
|
execute """
|
||||||
|
UPDATE media_items
|
||||||
|
SET upload_date = DATE(upload_date)
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue