[Housekeeping] Store the upload event as a datetime rather than a date (#269)
* [WIP] renamed and migrated upload_date column * Refactored yt-dlp media module * Refactored parse_upload_date * Refactored media item upload_date_index * Got media tests running * Refactored media item table live * Cleaned up the stragglers * Fixed old oversight re: original_url
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user