uploads: make upload_media_assets.media_asset_id nullable.
Make upload_media_assets.media_asset_id nullable in order to support multi-file uploads. The media asset will be null while the image is still being downloaded from the source.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class UploadMediaAsset < ApplicationRecord
|
class UploadMediaAsset < ApplicationRecord
|
||||||
belongs_to :upload
|
belongs_to :upload
|
||||||
belongs_to :media_asset
|
belongs_to :media_asset, optional: true
|
||||||
|
|
||||||
enum status: {
|
enum status: {
|
||||||
pending: 0,
|
pending: 0,
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class SetMediaAssetToNullableOnUploadMediaAssets < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
change_column_null :upload_media_assets, :media_asset_id, true
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1915,7 +1915,7 @@ CREATE TABLE public.upload_media_assets (
|
|||||||
created_at timestamp(6) without time zone NOT NULL,
|
created_at timestamp(6) without time zone NOT NULL,
|
||||||
updated_at timestamp(6) without time zone NOT NULL,
|
updated_at timestamp(6) without time zone NOT NULL,
|
||||||
upload_id bigint NOT NULL,
|
upload_id bigint NOT NULL,
|
||||||
media_asset_id bigint NOT NULL,
|
media_asset_id bigint,
|
||||||
status integer DEFAULT 0 NOT NULL,
|
status integer DEFAULT 0 NOT NULL,
|
||||||
source_url character varying DEFAULT ''::character varying NOT NULL,
|
source_url character varying DEFAULT ''::character varying NOT NULL,
|
||||||
error character varying
|
error character varying
|
||||||
@@ -5776,6 +5776,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||||||
('20220203040648'),
|
('20220203040648'),
|
||||||
('20220204075610'),
|
('20220204075610'),
|
||||||
('20220207195123'),
|
('20220207195123'),
|
||||||
('20220210171310');
|
('20220210171310'),
|
||||||
|
('20220210200157');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user