diff --git a/apps/designer/app/shared/db/assets.server.ts b/apps/designer/app/shared/db/assets.server.ts index 80a237ad99..9992deb643 100644 --- a/apps/designer/app/shared/db/assets.server.ts +++ b/apps/designer/app/shared/db/assets.server.ts @@ -32,8 +32,8 @@ export const create = async ( ...values, size, format: metadata.format, - width: Math.round(metadata.width), - height: Math.round(metadata.height), + ...(metadata.width ? { width: Math.round(metadata.width) } : {}), + ...(metadata.height ? { height: Math.round(metadata.height) } : {}), projectId, }, }); diff --git a/apps/designer/prisma/migrations/20220716192051_make_metadata_not_mandatory/migration.sql b/apps/designer/prisma/migrations/20220716192051_make_metadata_not_mandatory/migration.sql new file mode 100644 index 0000000000..0f2544df04 --- /dev/null +++ b/apps/designer/prisma/migrations/20220716192051_make_metadata_not_mandatory/migration.sql @@ -0,0 +1,4 @@ +-- AlterTable +ALTER TABLE "Asset" ALTER COLUMN "format" DROP NOT NULL, +ALTER COLUMN "height" DROP NOT NULL, +ALTER COLUMN "width" DROP NOT NULL; diff --git a/apps/designer/prisma/schema.prisma b/apps/designer/prisma/schema.prisma index 53cd3556b5..daaaac3626 100644 --- a/apps/designer/prisma/schema.prisma +++ b/apps/designer/prisma/schema.prisma @@ -19,10 +19,10 @@ model Asset { id String @id @default(uuid()) project Project @relation(fields: [projectId], references: [id]) projectId String - format String + format String? size Int - width Int - height Int + width Int? + height Int? name String path String alt String?