CREATE TABLE public.resource_metadata (
	id BIGSERIAL NOT NULL,
	tenant_id int4 NOT NULL,
	app_id int4 NOT NULL DEFAULT 1,
	record_type_id int4 NOT NULL DEFAULT 1,
	"tracking_change_id" int8 NULL,
	"is_active" bool NOT NULL DEFAULT true,
    "created_at" timestamptz NOT NULL DEFAULT now(),
    "updated_at" timestamptz NOT NULL DEFAULT now(),
    "is_deleted" bool NOT NULL DEFAULT false,
    "deleted_at" timestamptz,
	content_type text NOT NULL,
	size int4 NOT NULL,
	original_file_name text NOT NULL,
	original_file_extension text NOT NULL,
	preview_content_b64 text NULL,
	full_content_b64 text NULL,
	is_downloaded boolean NOT NULL DEFAULT false,
	"provider_metadata" jsonb NULL,
	sf_content_document_id text NULL,
	sf_content_version_id text NULL,
	PRIMARY KEY (id, tenant_id),
	FOREIGN KEY (tenant_id) references public.tenant(id) ON DELETE CASCADE
)
PARTITION BY LIST(tenant_id)
WITH (
	OIDS=FALSE
) ;
