diff --git a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx index a6da8ddc3..d5315ed3a 100644 --- a/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx +++ b/client/src/components/courtesy-car-form/courtesy-car-form.component.jsx @@ -228,8 +228,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) { {() => { const nextservicekm = form.getFieldValue("nextservicekm"); const mileageOver = - nextservicekm <= form.getFieldValue("mileage"); - + nextservicekm && nextservicekm <= form.getFieldValue("mileage"); if (mileageOver) return ( diff --git a/hasura/migrations/1701307239375_alter_table_public_courtesycars_alter_column_nextservicekm/down.sql b/hasura/migrations/1701307239375_alter_table_public_courtesycars_alter_column_nextservicekm/down.sql new file mode 100644 index 000000000..efc416b2e --- /dev/null +++ b/hasura/migrations/1701307239375_alter_table_public_courtesycars_alter_column_nextservicekm/down.sql @@ -0,0 +1,2 @@ +alter table "public"."courtesycars" alter column "nextservicekm" set not null; +alter table "public"."courtesycars" alter column "nextservicekm" set default '0'; diff --git a/hasura/migrations/1701307239375_alter_table_public_courtesycars_alter_column_nextservicekm/up.sql b/hasura/migrations/1701307239375_alter_table_public_courtesycars_alter_column_nextservicekm/up.sql new file mode 100644 index 000000000..3a6640343 --- /dev/null +++ b/hasura/migrations/1701307239375_alter_table_public_courtesycars_alter_column_nextservicekm/up.sql @@ -0,0 +1,2 @@ +ALTER TABLE "public"."courtesycars" ALTER COLUMN "nextservicekm" drop default; +alter table "public"."courtesycars" alter column "nextservicekm" drop not null;