From 552bb8e729eaab4a99de834d570d5bdd31460550 Mon Sep 17 00:00:00 2001 From: Louisa Spicer Date: Thu, 9 Nov 2023 15:50:35 +0000 Subject: [PATCH 1/2] fix: set unique to true for primary key fields in the proto.schema --- schema/makeproto.go | 1 + .../proto_action_inputs_in_both_query_and_with/proto.json | 2 ++ schema/testdata/proto_action_inputs_long_form/proto.json | 2 ++ schema/testdata/proto_action_inputs_with_empty/proto.json | 2 ++ schema/testdata/proto_action_inputs_with_omitted/proto.json | 2 ++ schema/testdata/proto_api/proto.json | 3 +++ schema/testdata/proto_arbitrary_function/proto.json | 2 ++ .../testdata/proto_arbitrary_function_any_type/proto.json | 2 ++ .../proto_arbitrary_function_inline_inputs/proto.json | 2 ++ .../testdata/proto_arbitrary_function_no_inputs/proto.json | 2 ++ schema/testdata/proto_arbitrary_functions_any/proto.json | 2 ++ schema/testdata/proto_attribute_on/proto.json | 3 +++ schema/testdata/proto_attribute_orderby/proto.json | 2 ++ schema/testdata/proto_attribute_sortable/proto.json | 2 ++ schema/testdata/proto_basics/proto.json | 2 ++ schema/testdata/proto_delete_action/proto.json | 2 ++ schema/testdata/proto_empty_fields/proto.json | 2 ++ schema/testdata/proto_enums/proto.json | 1 + schema/testdata/proto_environment_variables/proto.json | 2 ++ .../proto_expression_identity_field_comparison/proto.json | 4 ++++ schema/testdata/proto_expression_named_inputs/proto.json | 2 ++ schema/testdata/proto_expressions/proto.json | 2 ++ .../proto_expressions_compare_model_operand/proto.json | 3 +++ schema/testdata/proto_expressions_null_values/proto.json | 2 ++ .../proto_field_array_of_same_message_type/proto.json | 2 ++ .../proto_field_optional_of_same_message_type/proto.json | 2 ++ .../proto_field_optional_of_same_model_type/proto.json | 2 ++ schema/testdata/proto_fields_attributes/proto.json | 2 ++ schema/testdata/proto_fields_names/proto.json | 2 ++ schema/testdata/proto_fields_optional/proto.json | 2 ++ schema/testdata/proto_fields_types/proto.json | 2 ++ schema/testdata/proto_functions/proto.json | 2 ++ schema/testdata/proto_functions_inputs/proto.json | 2 ++ schema/testdata/proto_identity_backlinks/proto.json | 2 ++ .../proto_identity_backlinks_relation_attribute/proto.json | 2 ++ schema/testdata/proto_job_adhoc/proto.json | 1 + schema/testdata/proto_job_fields/proto.json | 1 + .../testdata/proto_job_permissions_expressions/proto.json | 1 + schema/testdata/proto_job_permissions_roles/proto.json | 1 + schema/testdata/proto_job_scheduled/proto.json | 1 + schema/testdata/proto_message_enum_field/proto.json | 2 ++ schema/testdata/proto_message_type/proto.json | 2 ++ schema/testdata/proto_message_type_nested_model/proto.json | 2 ++ schema/testdata/proto_models_multiple/proto.json | 3 +++ schema/testdata/proto_models_permissions/proto.json | 2 ++ schema/testdata/proto_models_unique/proto.json | 2 ++ schema/testdata/proto_operations_attr_set/proto.json | 2 ++ schema/testdata/proto_operations_attr_validate/proto.json | 2 ++ schema/testdata/proto_operations_attr_where/proto.json | 2 ++ .../proto_operations_create_all_required_inputs/proto.json | 2 ++ .../proto_operations_create_relationships/proto.json | 4 ++++ .../testdata/proto_operations_get_unique_input/proto.json | 2 ++ .../testdata/proto_operations_get_unique_where/proto.json | 2 ++ schema/testdata/proto_operations_inputs/proto.json | 2 ++ .../proto.json | 4 ++++ schema/testdata/proto_operations_multiple/proto.json | 2 ++ .../testdata/proto_operations_nested_model_input/proto.json | 5 +++++ schema/testdata/proto_operations_permissions/proto.json | 2 ++ schema/testdata/proto_operations_types/proto.json | 2 ++ schema/testdata/proto_optional_inputs/proto.json | 2 ++ schema/testdata/proto_optional_nested_input/proto.json | 3 +++ .../proto_permission_expression_with_identity/proto.json | 2 ++ schema/testdata/proto_relations_both_sides/proto.json | 3 +++ .../proto_relations_multi_uses_reln_attribute/proto.json | 3 +++ schema/testdata/proto_relations_single/proto.json | 3 +++ .../proto.json | 3 +++ schema/testdata/proto_relationships_mixed/proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ schema/testdata/proto_relationships_one_to_one/proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto_relationships_one_to_one_both_sides/proto.json | 3 +++ .../proto_relationships_one_to_one_missing_reln/proto.json | 3 +++ .../proto_relationships_one_to_one_multi_layered/proto.json | 4 ++++ .../proto.json | 3 +++ .../proto_relationships_one_to_one_with_unique/proto.json | 3 +++ .../proto.json | 2 ++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ .../proto.json | 3 +++ schema/testdata/proto_roles/proto.json | 1 + schema/testdata/proto_secrets/proto.json | 2 ++ .../proto.json | 4 ++++ schema/testdata/proto_set_attribute_backlinks/proto.json | 4 ++++ .../proto_set_attribute_ctx_identity_fields/proto.json | 2 ++ .../proto_set_attribute_lhs_within_write_scope/proto.json | 6 ++++++ schema/testdata/proto_unique_attribute/proto.json | 3 +++ schema/testdata/proto_unique_composite_lookup/proto.json | 5 +++++ schema/testdata/proto_unique_lookup/proto.json | 3 +++ schema/testdata/proto_unique_lookup_model/proto.json | 2 ++ schema/testdata/proto_unique_lookup_nested/proto.json | 3 +++ .../validation_create_inputs_missing_reln_valid/proto.json | 3 +++ schema/testdata/validation_default_zero/proto.json | 2 ++ .../proto.json | 2 ++ .../proto.json | 2 ++ schema/testdata/validation_enum_default/proto.json | 2 ++ .../validation_expression_enum_field_comparison/proto.json | 2 ++ schema/testdata/validation_expression_enum_set/proto.json | 2 ++ .../proto.json | 2 ++ .../proto.json | 2 ++ .../proto.json | 2 ++ .../proto.json | 3 +++ .../validation_request_headers_expression/proto.json | 2 ++ .../proto.json | 2 ++ .../proto.json | 2 ++ .../proto.json | 2 ++ 114 files changed, 276 insertions(+) diff --git a/schema/makeproto.go b/schema/makeproto.go index 88552f3f7..221896a17 100644 --- a/schema/makeproto.go +++ b/schema/makeproto.go @@ -1558,6 +1558,7 @@ func (scm *Builder) applyFieldAttributes(parserField *parser.FieldNode, protoFie protoField.Unique = true case parser.AttributePrimaryKey: protoField.PrimaryKey = true + protoField.Unique = true case parser.AttributeDefault: defaultValue := &proto.DefaultValue{} if len(fieldAttribute.Arguments) == 1 { diff --git a/schema/testdata/proto_action_inputs_in_both_query_and_with/proto.json b/schema/testdata/proto_action_inputs_in_both_query_and_with/proto.json index abc63f16f..06608758e 100644 --- a/schema/testdata/proto_action_inputs_in_both_query_and_with/proto.json +++ b/schema/testdata/proto_action_inputs_in_both_query_and_with/proto.json @@ -49,6 +49,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -184,6 +185,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_action_inputs_long_form/proto.json b/schema/testdata/proto_action_inputs_long_form/proto.json index c7751b21b..a6be5e36e 100644 --- a/schema/testdata/proto_action_inputs_long_form/proto.json +++ b/schema/testdata/proto_action_inputs_long_form/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -140,6 +141,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_action_inputs_with_empty/proto.json b/schema/testdata/proto_action_inputs_with_empty/proto.json index 3efbcfc21..7b83d1cb4 100644 --- a/schema/testdata/proto_action_inputs_with_empty/proto.json +++ b/schema/testdata/proto_action_inputs_with_empty/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -136,6 +137,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_action_inputs_with_omitted/proto.json b/schema/testdata/proto_action_inputs_with_omitted/proto.json index 3efbcfc21..7b83d1cb4 100644 --- a/schema/testdata/proto_action_inputs_with_omitted/proto.json +++ b/schema/testdata/proto_action_inputs_with_omitted/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -136,6 +137,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_api/proto.json b/schema/testdata/proto_api/proto.json index ba5ded4e7..260d79c90 100644 --- a/schema/testdata/proto_api/proto.json +++ b/schema/testdata/proto_api/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -45,6 +46,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -131,6 +133,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_arbitrary_function/proto.json b/schema/testdata/proto_arbitrary_function/proto.json index 2c1d797c5..06c07a909 100644 --- a/schema/testdata/proto_arbitrary_function/proto.json +++ b/schema/testdata/proto_arbitrary_function/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -105,6 +106,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_arbitrary_function_any_type/proto.json b/schema/testdata/proto_arbitrary_function_any_type/proto.json index e94b09e32..32f3db0d3 100644 --- a/schema/testdata/proto_arbitrary_function_any_type/proto.json +++ b/schema/testdata/proto_arbitrary_function_any_type/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -105,6 +106,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_arbitrary_function_inline_inputs/proto.json b/schema/testdata/proto_arbitrary_function_inline_inputs/proto.json index 5788f3f88..679f2c67a 100644 --- a/schema/testdata/proto_arbitrary_function_inline_inputs/proto.json +++ b/schema/testdata/proto_arbitrary_function_inline_inputs/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -112,6 +113,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_arbitrary_function_no_inputs/proto.json b/schema/testdata/proto_arbitrary_function_no_inputs/proto.json index c0cfe6866..84b3ea9a8 100644 --- a/schema/testdata/proto_arbitrary_function_no_inputs/proto.json +++ b/schema/testdata/proto_arbitrary_function_no_inputs/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -129,6 +130,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_arbitrary_functions_any/proto.json b/schema/testdata/proto_arbitrary_functions_any/proto.json index 7bcfa2e77..0e774ecce 100644 --- a/schema/testdata/proto_arbitrary_functions_any/proto.json +++ b/schema/testdata/proto_arbitrary_functions_any/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -113,6 +114,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_attribute_on/proto.json b/schema/testdata/proto_attribute_on/proto.json index 35214baa3..47d6151b7 100644 --- a/schema/testdata/proto_attribute_on/proto.json +++ b/schema/testdata/proto_attribute_on/proto.json @@ -23,6 +23,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -73,6 +74,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -159,6 +161,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_attribute_orderby/proto.json b/schema/testdata/proto_attribute_orderby/proto.json index 46872be8d..b630026c8 100644 --- a/schema/testdata/proto_attribute_orderby/proto.json +++ b/schema/testdata/proto_attribute_orderby/proto.json @@ -23,6 +23,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -128,6 +129,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_attribute_sortable/proto.json b/schema/testdata/proto_attribute_sortable/proto.json index ea142247a..7d039f919 100644 --- a/schema/testdata/proto_attribute_sortable/proto.json +++ b/schema/testdata/proto_attribute_sortable/proto.json @@ -23,6 +23,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -118,6 +119,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_basics/proto.json b/schema/testdata/proto_basics/proto.json index c2996fd72..cfea7e3c3 100644 --- a/schema/testdata/proto_basics/proto.json +++ b/schema/testdata/proto_basics/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -102,6 +103,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_delete_action/proto.json b/schema/testdata/proto_delete_action/proto.json index d89574880..64f640a64 100644 --- a/schema/testdata/proto_delete_action/proto.json +++ b/schema/testdata/proto_delete_action/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -104,6 +105,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_empty_fields/proto.json b/schema/testdata/proto_empty_fields/proto.json index d786469e5..ac708e82c 100644 --- a/schema/testdata/proto_empty_fields/proto.json +++ b/schema/testdata/proto_empty_fields/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -95,6 +96,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_enums/proto.json b/schema/testdata/proto_enums/proto.json index c86a6423e..f985d26d2 100644 --- a/schema/testdata/proto_enums/proto.json +++ b/schema/testdata/proto_enums/proto.json @@ -59,6 +59,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_environment_variables/proto.json b/schema/testdata/proto_environment_variables/proto.json index 43d96cfd7..0a119f389 100644 --- a/schema/testdata/proto_environment_variables/proto.json +++ b/schema/testdata/proto_environment_variables/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -106,6 +107,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_expression_identity_field_comparison/proto.json b/schema/testdata/proto_expression_identity_field_comparison/proto.json index 5f252e7a6..85e5478a7 100644 --- a/schema/testdata/proto_expression_identity_field_comparison/proto.json +++ b/schema/testdata/proto_expression_identity_field_comparison/proto.json @@ -18,6 +18,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -74,6 +75,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -148,6 +150,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -276,6 +279,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_expression_named_inputs/proto.json b/schema/testdata/proto_expression_named_inputs/proto.json index eaa0f964d..e51ccdcc0 100644 --- a/schema/testdata/proto_expression_named_inputs/proto.json +++ b/schema/testdata/proto_expression_named_inputs/proto.json @@ -17,6 +17,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -147,6 +148,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_expressions/proto.json b/schema/testdata/proto_expressions/proto.json index 32258ab0a..0cf101488 100644 --- a/schema/testdata/proto_expressions/proto.json +++ b/schema/testdata/proto_expressions/proto.json @@ -40,6 +40,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -187,6 +188,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_expressions_compare_model_operand/proto.json b/schema/testdata/proto_expressions_compare_model_operand/proto.json index 7b20eebc6..5fe49bf02 100644 --- a/schema/testdata/proto_expressions_compare_model_operand/proto.json +++ b/schema/testdata/proto_expressions_compare_model_operand/proto.json @@ -20,6 +20,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -79,6 +80,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -195,6 +197,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_expressions_null_values/proto.json b/schema/testdata/proto_expressions_null_values/proto.json index e8490427c..52ef5ca91 100644 --- a/schema/testdata/proto_expressions_null_values/proto.json +++ b/schema/testdata/proto_expressions_null_values/proto.json @@ -17,6 +17,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -129,6 +130,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_field_array_of_same_message_type/proto.json b/schema/testdata/proto_field_array_of_same_message_type/proto.json index affc17b44..3462128fe 100644 --- a/schema/testdata/proto_field_array_of_same_message_type/proto.json +++ b/schema/testdata/proto_field_array_of_same_message_type/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -105,6 +106,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_field_optional_of_same_message_type/proto.json b/schema/testdata/proto_field_optional_of_same_message_type/proto.json index 37980130d..7bb76b8d1 100644 --- a/schema/testdata/proto_field_optional_of_same_message_type/proto.json +++ b/schema/testdata/proto_field_optional_of_same_message_type/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -105,6 +106,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_field_optional_of_same_model_type/proto.json b/schema/testdata/proto_field_optional_of_same_model_type/proto.json index 07ce68476..09511d024 100644 --- a/schema/testdata/proto_field_optional_of_same_model_type/proto.json +++ b/schema/testdata/proto_field_optional_of_same_model_type/proto.json @@ -30,6 +30,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -137,6 +138,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_fields_attributes/proto.json b/schema/testdata/proto_fields_attributes/proto.json index 52abc1e81..d4ee32224 100644 --- a/schema/testdata/proto_fields_attributes/proto.json +++ b/schema/testdata/proto_fields_attributes/proto.json @@ -45,6 +45,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -143,6 +144,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_fields_names/proto.json b/schema/testdata/proto_fields_names/proto.json index 61a699a04..d38b7cb33 100644 --- a/schema/testdata/proto_fields_names/proto.json +++ b/schema/testdata/proto_fields_names/proto.json @@ -23,6 +23,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -109,6 +110,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_fields_optional/proto.json b/schema/testdata/proto_fields_optional/proto.json index b564b12a7..58a3173f9 100644 --- a/schema/testdata/proto_fields_optional/proto.json +++ b/schema/testdata/proto_fields_optional/proto.json @@ -17,6 +17,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -103,6 +104,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_fields_types/proto.json b/schema/testdata/proto_fields_types/proto.json index 59ed6d156..c519f362b 100644 --- a/schema/testdata/proto_fields_types/proto.json +++ b/schema/testdata/proto_fields_types/proto.json @@ -54,6 +54,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -151,6 +152,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_functions/proto.json b/schema/testdata/proto_functions/proto.json index 61e651485..5cbd32cbb 100644 --- a/schema/testdata/proto_functions/proto.json +++ b/schema/testdata/proto_functions/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -104,6 +105,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_functions_inputs/proto.json b/schema/testdata/proto_functions_inputs/proto.json index f9984b057..7d749e340 100644 --- a/schema/testdata/proto_functions_inputs/proto.json +++ b/schema/testdata/proto_functions_inputs/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -132,6 +133,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_identity_backlinks/proto.json b/schema/testdata/proto_identity_backlinks/proto.json index 3bfc6a6f5..6186ad711 100644 --- a/schema/testdata/proto_identity_backlinks/proto.json +++ b/schema/testdata/proto_identity_backlinks/proto.json @@ -20,6 +20,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -118,6 +119,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_identity_backlinks_relation_attribute/proto.json b/schema/testdata/proto_identity_backlinks_relation_attribute/proto.json index d224f8967..8ed36cbd4 100644 --- a/schema/testdata/proto_identity_backlinks_relation_attribute/proto.json +++ b/schema/testdata/proto_identity_backlinks_relation_attribute/proto.json @@ -31,6 +31,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -141,6 +142,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_job_adhoc/proto.json b/schema/testdata/proto_job_adhoc/proto.json index 2747da997..97512603f 100644 --- a/schema/testdata/proto_job_adhoc/proto.json +++ b/schema/testdata/proto_job_adhoc/proto.json @@ -59,6 +59,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_job_fields/proto.json b/schema/testdata/proto_job_fields/proto.json index 82cef8709..8f412fa20 100644 --- a/schema/testdata/proto_job_fields/proto.json +++ b/schema/testdata/proto_job_fields/proto.json @@ -59,6 +59,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_job_permissions_expressions/proto.json b/schema/testdata/proto_job_permissions_expressions/proto.json index e51b1d016..26a5ba379 100644 --- a/schema/testdata/proto_job_permissions_expressions/proto.json +++ b/schema/testdata/proto_job_permissions_expressions/proto.json @@ -59,6 +59,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_job_permissions_roles/proto.json b/schema/testdata/proto_job_permissions_roles/proto.json index a4463e0de..785ca089c 100644 --- a/schema/testdata/proto_job_permissions_roles/proto.json +++ b/schema/testdata/proto_job_permissions_roles/proto.json @@ -59,6 +59,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_job_scheduled/proto.json b/schema/testdata/proto_job_scheduled/proto.json index 03b183a24..794e79d2b 100644 --- a/schema/testdata/proto_job_scheduled/proto.json +++ b/schema/testdata/proto_job_scheduled/proto.json @@ -59,6 +59,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_message_enum_field/proto.json b/schema/testdata/proto_message_enum_field/proto.json index 6c0c46ff2..3a4d0b032 100644 --- a/schema/testdata/proto_message_enum_field/proto.json +++ b/schema/testdata/proto_message_enum_field/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -112,6 +113,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_message_type/proto.json b/schema/testdata/proto_message_type/proto.json index 06021087b..5b887e47e 100644 --- a/schema/testdata/proto_message_type/proto.json +++ b/schema/testdata/proto_message_type/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -112,6 +113,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_message_type_nested_model/proto.json b/schema/testdata/proto_message_type_nested_model/proto.json index 4450063c4..7558c1a82 100644 --- a/schema/testdata/proto_message_type_nested_model/proto.json +++ b/schema/testdata/proto_message_type_nested_model/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -112,6 +113,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_models_multiple/proto.json b/schema/testdata/proto_models_multiple/proto.json index 2cbb6beb2..3cb0fd629 100644 --- a/schema/testdata/proto_models_multiple/proto.json +++ b/schema/testdata/proto_models_multiple/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -45,6 +46,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -131,6 +133,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_models_permissions/proto.json b/schema/testdata/proto_models_permissions/proto.json index 76281b04a..d8b555ef0 100644 --- a/schema/testdata/proto_models_permissions/proto.json +++ b/schema/testdata/proto_models_permissions/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -126,6 +127,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_models_unique/proto.json b/schema/testdata/proto_models_unique/proto.json index 22bf5c828..cadcc4e22 100644 --- a/schema/testdata/proto_models_unique/proto.json +++ b/schema/testdata/proto_models_unique/proto.json @@ -29,6 +29,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -115,6 +116,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_attr_set/proto.json b/schema/testdata/proto_operations_attr_set/proto.json index d20db91f2..8a0589482 100644 --- a/schema/testdata/proto_operations_attr_set/proto.json +++ b/schema/testdata/proto_operations_attr_set/proto.json @@ -23,6 +23,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -123,6 +124,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_attr_validate/proto.json b/schema/testdata/proto_operations_attr_validate/proto.json index 8f8fc6fcc..ca8b4e67c 100644 --- a/schema/testdata/proto_operations_attr_validate/proto.json +++ b/schema/testdata/proto_operations_attr_validate/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -116,6 +117,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_attr_where/proto.json b/schema/testdata/proto_operations_attr_where/proto.json index cb7b85799..27de72d81 100644 --- a/schema/testdata/proto_operations_attr_where/proto.json +++ b/schema/testdata/proto_operations_attr_where/proto.json @@ -17,6 +17,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -117,6 +118,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_create_all_required_inputs/proto.json b/schema/testdata/proto_operations_create_all_required_inputs/proto.json index e47ddf644..1c920218e 100644 --- a/schema/testdata/proto_operations_create_all_required_inputs/proto.json +++ b/schema/testdata/proto_operations_create_all_required_inputs/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -119,6 +120,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_create_relationships/proto.json b/schema/testdata/proto_operations_create_relationships/proto.json index a066add06..521a25f57 100644 --- a/schema/testdata/proto_operations_create_relationships/proto.json +++ b/schema/testdata/proto_operations_create_relationships/proto.json @@ -26,6 +26,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -104,6 +105,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -185,6 +187,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -271,6 +274,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_get_unique_input/proto.json b/schema/testdata/proto_operations_get_unique_input/proto.json index 84738c229..05dabbbbc 100644 --- a/schema/testdata/proto_operations_get_unique_input/proto.json +++ b/schema/testdata/proto_operations_get_unique_input/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -104,6 +105,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_get_unique_where/proto.json b/schema/testdata/proto_operations_get_unique_where/proto.json index d5dc9db5e..fda5090e4 100644 --- a/schema/testdata/proto_operations_get_unique_where/proto.json +++ b/schema/testdata/proto_operations_get_unique_where/proto.json @@ -17,6 +17,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -117,6 +118,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_inputs/proto.json b/schema/testdata/proto_operations_inputs/proto.json index f6d59ef7c..456b9d230 100644 --- a/schema/testdata/proto_operations_inputs/proto.json +++ b/schema/testdata/proto_operations_inputs/proto.json @@ -23,6 +23,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -139,6 +140,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_list_nested_input_optional_model/proto.json b/schema/testdata/proto_operations_list_nested_input_optional_model/proto.json index b67a21035..5762113b2 100644 --- a/schema/testdata/proto_operations_list_nested_input_optional_model/proto.json +++ b/schema/testdata/proto_operations_list_nested_input_optional_model/proto.json @@ -26,6 +26,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -83,6 +84,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -141,6 +143,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -247,6 +250,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_multiple/proto.json b/schema/testdata/proto_operations_multiple/proto.json index 53b959f4d..3feb6aede 100644 --- a/schema/testdata/proto_operations_multiple/proto.json +++ b/schema/testdata/proto_operations_multiple/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -111,6 +112,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_nested_model_input/proto.json b/schema/testdata/proto_operations_nested_model_input/proto.json index 398c4a52b..0868d88f6 100644 --- a/schema/testdata/proto_operations_nested_model_input/proto.json +++ b/schema/testdata/proto_operations_nested_model_input/proto.json @@ -26,6 +26,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -102,6 +103,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -169,6 +171,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -233,6 +236,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -328,6 +332,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_permissions/proto.json b/schema/testdata/proto_operations_permissions/proto.json index 18811b0c8..c334d9ee4 100644 --- a/schema/testdata/proto_operations_permissions/proto.json +++ b/schema/testdata/proto_operations_permissions/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -130,6 +131,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_operations_types/proto.json b/schema/testdata/proto_operations_types/proto.json index 2ce5a426c..d935b4e36 100644 --- a/schema/testdata/proto_operations_types/proto.json +++ b/schema/testdata/proto_operations_types/proto.json @@ -17,6 +17,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -133,6 +134,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_optional_inputs/proto.json b/schema/testdata/proto_optional_inputs/proto.json index 8e4aa71df..d7b81ee4a 100644 --- a/schema/testdata/proto_optional_inputs/proto.json +++ b/schema/testdata/proto_optional_inputs/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -133,6 +134,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_optional_nested_input/proto.json b/schema/testdata/proto_optional_nested_input/proto.json index 21ca33743..a882db2bb 100644 --- a/schema/testdata/proto_optional_nested_input/proto.json +++ b/schema/testdata/proto_optional_nested_input/proto.json @@ -35,6 +35,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -132,6 +133,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -218,6 +220,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_permission_expression_with_identity/proto.json b/schema/testdata/proto_permission_expression_with_identity/proto.json index 9417c6658..b1779c4a1 100644 --- a/schema/testdata/proto_permission_expression_with_identity/proto.json +++ b/schema/testdata/proto_permission_expression_with_identity/proto.json @@ -21,6 +21,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -145,6 +146,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relations_both_sides/proto.json b/schema/testdata/proto_relations_both_sides/proto.json index 487db8c41..64b0f0e89 100644 --- a/schema/testdata/proto_relations_both_sides/proto.json +++ b/schema/testdata/proto_relations_both_sides/proto.json @@ -19,6 +19,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -65,6 +66,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -162,6 +164,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relations_multi_uses_reln_attribute/proto.json b/schema/testdata/proto_relations_multi_uses_reln_attribute/proto.json index 05ca25844..bd835e4e2 100644 --- a/schema/testdata/proto_relations_multi_uses_reln_attribute/proto.json +++ b/schema/testdata/proto_relations_multi_uses_reln_attribute/proto.json @@ -39,6 +39,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -116,6 +117,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -224,6 +226,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relations_single/proto.json b/schema/testdata/proto_relations_single/proto.json index 4ceb221da..41f84e5ba 100644 --- a/schema/testdata/proto_relations_single/proto.json +++ b/schema/testdata/proto_relations_single/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -54,6 +55,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -151,6 +153,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_create_with_implicit_input/proto.json b/schema/testdata/proto_relationships_create_with_implicit_input/proto.json index ad708dc10..b5a0698f2 100644 --- a/schema/testdata/proto_relationships_create_with_implicit_input/proto.json +++ b/schema/testdata/proto_relationships_create_with_implicit_input/proto.json @@ -35,6 +35,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -117,6 +118,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -203,6 +205,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_mixed/proto.json b/schema/testdata/proto_relationships_mixed/proto.json index b9e6513a8..a22a9e3b0 100644 --- a/schema/testdata/proto_relationships_mixed/proto.json +++ b/schema/testdata/proto_relationships_mixed/proto.json @@ -39,6 +39,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -118,6 +119,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -215,6 +217,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_mixed_one_to_many_single_sided/proto.json b/schema/testdata/proto_relationships_mixed_one_to_many_single_sided/proto.json index 66c5817a6..6d81c0868 100644 --- a/schema/testdata/proto_relationships_mixed_one_to_many_single_sided/proto.json +++ b/schema/testdata/proto_relationships_mixed_one_to_many_single_sided/proto.json @@ -39,6 +39,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -128,6 +129,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -214,6 +216,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_mixed_one_to_one_single_sided/proto.json b/schema/testdata/proto_relationships_mixed_one_to_one_single_sided/proto.json index ea4d03041..b50e0a878 100644 --- a/schema/testdata/proto_relationships_mixed_one_to_one_single_sided/proto.json +++ b/schema/testdata/proto_relationships_mixed_one_to_one_single_sided/proto.json @@ -39,6 +39,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -129,6 +130,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -215,6 +217,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_mixed_one_to_one_single_sided_2/proto.json b/schema/testdata/proto_relationships_mixed_one_to_one_single_sided_2/proto.json index 5f6a41e3c..7f8b733c5 100644 --- a/schema/testdata/proto_relationships_mixed_one_to_one_single_sided_2/proto.json +++ b/schema/testdata/proto_relationships_mixed_one_to_one_single_sided_2/proto.json @@ -29,6 +29,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -117,6 +118,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -215,6 +217,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_mixed_with_self_relationship/proto.json b/schema/testdata/proto_relationships_mixed_with_self_relationship/proto.json index f470f8d66..5de226f4f 100644 --- a/schema/testdata/proto_relationships_mixed_with_self_relationship/proto.json +++ b/schema/testdata/proto_relationships_mixed_with_self_relationship/proto.json @@ -52,6 +52,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -132,6 +133,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -229,6 +231,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_many_multi_one_sided/proto.json b/schema/testdata/proto_relationships_one_to_many_multi_one_sided/proto.json index 82f2b359d..57dbf731e 100644 --- a/schema/testdata/proto_relationships_one_to_many_multi_one_sided/proto.json +++ b/schema/testdata/proto_relationships_one_to_many_multi_one_sided/proto.json @@ -18,6 +18,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -74,6 +75,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -171,6 +173,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_many_multi_one_sided_same_side/proto.json b/schema/testdata/proto_relationships_one_to_many_multi_one_sided_same_side/proto.json index e2c7a4637..9828b3402 100644 --- a/schema/testdata/proto_relationships_one_to_many_multi_one_sided_same_side/proto.json +++ b/schema/testdata/proto_relationships_one_to_many_multi_one_sided_same_side/proto.json @@ -27,6 +27,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -85,6 +86,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -171,6 +173,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_many_single_sided_multiple/proto.json b/schema/testdata/proto_relationships_one_to_many_single_sided_multiple/proto.json index d091c72bb..d5dff4a5d 100644 --- a/schema/testdata/proto_relationships_one_to_many_single_sided_multiple/proto.json +++ b/schema/testdata/proto_relationships_one_to_many_single_sided_multiple/proto.json @@ -27,6 +27,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -103,6 +104,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -211,6 +213,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one/proto.json b/schema/testdata/proto_relationships_one_to_one/proto.json index be45a0bdc..96ad05581 100644 --- a/schema/testdata/proto_relationships_one_to_one/proto.json +++ b/schema/testdata/proto_relationships_one_to_one/proto.json @@ -19,6 +19,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -83,6 +84,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -169,6 +171,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_both_directions/proto.json b/schema/testdata/proto_relationships_one_to_one_both_directions/proto.json index cd2e726a4..6107576e1 100644 --- a/schema/testdata/proto_relationships_one_to_one_both_directions/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_both_directions/proto.json @@ -29,6 +29,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -97,6 +98,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -195,6 +197,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_both_directions_missing_relation_attribute/proto.json b/schema/testdata/proto_relationships_one_to_one_both_directions_missing_relation_attribute/proto.json index cd2e726a4..6107576e1 100644 --- a/schema/testdata/proto_relationships_one_to_one_both_directions_missing_relation_attribute/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_both_directions_missing_relation_attribute/proto.json @@ -29,6 +29,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -97,6 +98,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -195,6 +197,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_both_directions_no_relation_attribute/proto.json b/schema/testdata/proto_relationships_one_to_one_both_directions_no_relation_attribute/proto.json index cd2e726a4..6107576e1 100644 --- a/schema/testdata/proto_relationships_one_to_one_both_directions_no_relation_attribute/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_both_directions_no_relation_attribute/proto.json @@ -29,6 +29,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -97,6 +98,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -195,6 +197,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_both_sides/proto.json b/schema/testdata/proto_relationships_one_to_one_both_sides/proto.json index d636421d0..e32ef4bfe 100644 --- a/schema/testdata/proto_relationships_one_to_one_both_sides/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_both_sides/proto.json @@ -20,6 +20,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -93,6 +94,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -179,6 +181,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_missing_reln/proto.json b/schema/testdata/proto_relationships_one_to_one_missing_reln/proto.json index 5972471b0..0c4acb5e0 100644 --- a/schema/testdata/proto_relationships_one_to_one_missing_reln/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_missing_reln/proto.json @@ -31,6 +31,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -109,6 +110,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -195,6 +197,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_multi_layered/proto.json b/schema/testdata/proto_relationships_one_to_one_multi_layered/proto.json index 79e70bf97..be9cde4b0 100644 --- a/schema/testdata/proto_relationships_one_to_one_multi_layered/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_multi_layered/proto.json @@ -27,6 +27,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -112,6 +113,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -186,6 +188,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -281,6 +284,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_unique_both_sides/proto.json b/schema/testdata/proto_relationships_one_to_one_unique_both_sides/proto.json index 8dae4a5b0..7659c4a57 100644 --- a/schema/testdata/proto_relationships_one_to_one_unique_both_sides/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_unique_both_sides/proto.json @@ -19,6 +19,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -77,6 +78,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -175,6 +177,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_one_to_one_with_unique/proto.json b/schema/testdata/proto_relationships_one_to_one_with_unique/proto.json index bac39f963..5c60558da 100644 --- a/schema/testdata/proto_relationships_one_to_one_with_unique/proto.json +++ b/schema/testdata/proto_relationships_one_to_one_with_unique/proto.json @@ -30,6 +30,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -89,6 +90,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -187,6 +189,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_self_referencing_multiple/proto.json b/schema/testdata/proto_relationships_self_referencing_multiple/proto.json index e5349db30..5d6134ea9 100644 --- a/schema/testdata/proto_relationships_self_referencing_multiple/proto.json +++ b/schema/testdata/proto_relationships_self_referencing_multiple/proto.json @@ -51,6 +51,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -161,6 +162,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_self_referencing_no_reln_attribute/proto.json b/schema/testdata/proto_relationships_self_referencing_no_reln_attribute/proto.json index 31047155c..7db1f385c 100644 --- a/schema/testdata/proto_relationships_self_referencing_no_reln_attribute/proto.json +++ b/schema/testdata/proto_relationships_self_referencing_no_reln_attribute/proto.json @@ -30,6 +30,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -99,6 +100,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -197,6 +199,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_self_referencing_uses_reln_attribute/proto.json b/schema/testdata/proto_relationships_self_referencing_uses_reln_attribute/proto.json index 31047155c..7db1f385c 100644 --- a/schema/testdata/proto_relationships_self_referencing_uses_reln_attribute/proto.json +++ b/schema/testdata/proto_relationships_self_referencing_uses_reln_attribute/proto.json @@ -30,6 +30,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -99,6 +100,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -197,6 +199,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_update_with_explicit_input/proto.json b/schema/testdata/proto_relationships_update_with_explicit_input/proto.json index 749d1e211..c84e067bb 100644 --- a/schema/testdata/proto_relationships_update_with_explicit_input/proto.json +++ b/schema/testdata/proto_relationships_update_with_explicit_input/proto.json @@ -35,6 +35,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -145,6 +146,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -231,6 +233,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_relationships_update_with_implicit_input/proto.json b/schema/testdata/proto_relationships_update_with_implicit_input/proto.json index 801651b2f..82ab91ac1 100644 --- a/schema/testdata/proto_relationships_update_with_implicit_input/proto.json +++ b/schema/testdata/proto_relationships_update_with_implicit_input/proto.json @@ -35,6 +35,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -131,6 +132,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -217,6 +219,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_roles/proto.json b/schema/testdata/proto_roles/proto.json index 76c954817..3b6041829 100644 --- a/schema/testdata/proto_roles/proto.json +++ b/schema/testdata/proto_roles/proto.json @@ -59,6 +59,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_secrets/proto.json b/schema/testdata/proto_secrets/proto.json index 80af12209..eb93647f6 100644 --- a/schema/testdata/proto_secrets/proto.json +++ b/schema/testdata/proto_secrets/proto.json @@ -9,6 +9,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -106,6 +107,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_set_attribute_backlink_repeated_rhs_fields/proto.json b/schema/testdata/proto_set_attribute_backlink_repeated_rhs_fields/proto.json index 29d142850..b76394f6b 100644 --- a/schema/testdata/proto_set_attribute_backlink_repeated_rhs_fields/proto.json +++ b/schema/testdata/proto_set_attribute_backlink_repeated_rhs_fields/proto.json @@ -67,6 +67,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -211,6 +212,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -292,6 +294,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -378,6 +381,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_set_attribute_backlinks/proto.json b/schema/testdata/proto_set_attribute_backlinks/proto.json index 773e7820d..7f2135c52 100644 --- a/schema/testdata/proto_set_attribute_backlinks/proto.json +++ b/schema/testdata/proto_set_attribute_backlinks/proto.json @@ -67,6 +67,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -208,6 +209,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -289,6 +291,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -375,6 +378,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_set_attribute_ctx_identity_fields/proto.json b/schema/testdata/proto_set_attribute_ctx_identity_fields/proto.json index 4953ad3e4..1f65102e6 100644 --- a/schema/testdata/proto_set_attribute_ctx_identity_fields/proto.json +++ b/schema/testdata/proto_set_attribute_ctx_identity_fields/proto.json @@ -44,6 +44,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -198,6 +199,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_set_attribute_lhs_within_write_scope/proto.json b/schema/testdata/proto_set_attribute_lhs_within_write_scope/proto.json index 8854c0a4d..380882f8e 100644 --- a/schema/testdata/proto_set_attribute_lhs_within_write_scope/proto.json +++ b/schema/testdata/proto_set_attribute_lhs_within_write_scope/proto.json @@ -45,6 +45,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -273,6 +274,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -377,6 +379,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -452,6 +455,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -506,6 +510,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -604,6 +609,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_unique_attribute/proto.json b/schema/testdata/proto_unique_attribute/proto.json index 0999b1c02..0a93fc39b 100644 --- a/schema/testdata/proto_unique_attribute/proto.json +++ b/schema/testdata/proto_unique_attribute/proto.json @@ -31,6 +31,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -78,6 +79,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -164,6 +166,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_unique_composite_lookup/proto.json b/schema/testdata/proto_unique_composite_lookup/proto.json index 10daccb2f..d55c36df5 100644 --- a/schema/testdata/proto_unique_composite_lookup/proto.json +++ b/schema/testdata/proto_unique_composite_lookup/proto.json @@ -29,6 +29,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -144,6 +145,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -307,6 +309,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -396,6 +399,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -498,6 +502,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_unique_lookup/proto.json b/schema/testdata/proto_unique_lookup/proto.json index 3cc1e93c4..286100942 100644 --- a/schema/testdata/proto_unique_lookup/proto.json +++ b/schema/testdata/proto_unique_lookup/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -197,6 +198,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -306,6 +308,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_unique_lookup_model/proto.json b/schema/testdata/proto_unique_lookup_model/proto.json index b1aff6534..dc2da48a5 100644 --- a/schema/testdata/proto_unique_lookup_model/proto.json +++ b/schema/testdata/proto_unique_lookup_model/proto.json @@ -20,6 +20,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -132,6 +133,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/proto_unique_lookup_nested/proto.json b/schema/testdata/proto_unique_lookup_nested/proto.json index 436ac1e23..d049724fc 100644 --- a/schema/testdata/proto_unique_lookup_nested/proto.json +++ b/schema/testdata/proto_unique_lookup_nested/proto.json @@ -36,6 +36,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -185,6 +186,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -280,6 +282,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_create_inputs_missing_reln_valid/proto.json b/schema/testdata/validation_create_inputs_missing_reln_valid/proto.json index 2001becdd..2db0966b6 100644 --- a/schema/testdata/validation_create_inputs_missing_reln_valid/proto.json +++ b/schema/testdata/validation_create_inputs_missing_reln_valid/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -68,6 +69,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -186,6 +188,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_default_zero/proto.json b/schema/testdata/validation_default_zero/proto.json index 2d5c6f34e..acdb2125f 100644 --- a/schema/testdata/validation_default_zero/proto.json +++ b/schema/testdata/validation_default_zero/proto.json @@ -19,6 +19,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -105,6 +106,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_delete_operation_unique_lookup_in_inputs/proto.json b/schema/testdata/validation_delete_operation_unique_lookup_in_inputs/proto.json index facb5a1c9..40bd6b588 100644 --- a/schema/testdata/validation_delete_operation_unique_lookup_in_inputs/proto.json +++ b/schema/testdata/validation_delete_operation_unique_lookup_in_inputs/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -116,6 +117,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_delete_operation_unique_lookup_in_wheres/proto.json b/schema/testdata/validation_delete_operation_unique_lookup_in_wheres/proto.json index 7f1069edb..e6cef3f5c 100644 --- a/schema/testdata/validation_delete_operation_unique_lookup_in_wheres/proto.json +++ b/schema/testdata/validation_delete_operation_unique_lookup_in_wheres/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -127,6 +128,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_enum_default/proto.json b/schema/testdata/validation_enum_default/proto.json index 85bf29ae3..3fb532b2c 100644 --- a/schema/testdata/validation_enum_default/proto.json +++ b/schema/testdata/validation_enum_default/proto.json @@ -22,6 +22,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -108,6 +109,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_expression_enum_field_comparison/proto.json b/schema/testdata/validation_expression_enum_field_comparison/proto.json index 2e3375d14..adc39452e 100644 --- a/schema/testdata/validation_expression_enum_field_comparison/proto.json +++ b/schema/testdata/validation_expression_enum_field_comparison/proto.json @@ -25,6 +25,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -129,6 +130,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_expression_enum_set/proto.json b/schema/testdata/validation_expression_enum_set/proto.json index f1199e6b8..4df9f1119 100644 --- a/schema/testdata/validation_expression_enum_set/proto.json +++ b/schema/testdata/validation_expression_enum_set/proto.json @@ -17,6 +17,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -117,6 +118,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_expression_nullish_optional_comparison/proto.json b/schema/testdata/validation_expression_nullish_optional_comparison/proto.json index 3740a6f0b..1fec735a4 100644 --- a/schema/testdata/validation_expression_nullish_optional_comparison/proto.json +++ b/schema/testdata/validation_expression_nullish_optional_comparison/proto.json @@ -19,6 +19,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -140,6 +141,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_get_operation_unique_lookup_in_inputs/proto.json b/schema/testdata/validation_get_operation_unique_lookup_in_inputs/proto.json index 180ef5387..a9516575a 100644 --- a/schema/testdata/validation_get_operation_unique_lookup_in_inputs/proto.json +++ b/schema/testdata/validation_get_operation_unique_lookup_in_inputs/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -116,6 +117,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_get_operation_unique_lookup_in_wheres/proto.json b/schema/testdata/validation_get_operation_unique_lookup_in_wheres/proto.json index c3ef31776..d924d72a6 100644 --- a/schema/testdata/validation_get_operation_unique_lookup_in_wheres/proto.json +++ b/schema/testdata/validation_get_operation_unique_lookup_in_wheres/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -127,6 +128,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_relationships_create_with_explicit_input/proto.json b/schema/testdata/validation_relationships_create_with_explicit_input/proto.json index fd7242d5c..80cc45570 100644 --- a/schema/testdata/validation_relationships_create_with_explicit_input/proto.json +++ b/schema/testdata/validation_relationships_create_with_explicit_input/proto.json @@ -35,6 +35,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -145,6 +146,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -231,6 +233,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_request_headers_expression/proto.json b/schema/testdata/validation_request_headers_expression/proto.json index 0e2e9f073..849c694e8 100644 --- a/schema/testdata/validation_request_headers_expression/proto.json +++ b/schema/testdata/validation_request_headers_expression/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -116,6 +117,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_update_operation_unique_lookup_in_inputs/proto.json b/schema/testdata/validation_update_operation_unique_lookup_in_inputs/proto.json index 51bee17cf..2e63a840a 100644 --- a/schema/testdata/validation_update_operation_unique_lookup_in_inputs/proto.json +++ b/schema/testdata/validation_update_operation_unique_lookup_in_inputs/proto.json @@ -16,6 +16,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -116,6 +117,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_update_operation_unique_lookup_in_wheres/proto.json b/schema/testdata/validation_update_operation_unique_lookup_in_wheres/proto.json index e69aa9b94..edda3bc4e 100644 --- a/schema/testdata/validation_update_operation_unique_lookup_in_wheres/proto.json +++ b/schema/testdata/validation_update_operation_unique_lookup_in_wheres/proto.json @@ -24,6 +24,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -127,6 +128,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true diff --git a/schema/testdata/validation_where_expression_allowed_operators_builtin_types/proto.json b/schema/testdata/validation_where_expression_allowed_operators_builtin_types/proto.json index edefd360e..b4db2894b 100644 --- a/schema/testdata/validation_where_expression_allowed_operators_builtin_types/proto.json +++ b/schema/testdata/validation_where_expression_allowed_operators_builtin_types/proto.json @@ -113,6 +113,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true @@ -358,6 +359,7 @@ "type": { "type": "TYPE_ID" }, + "unique": true, "primaryKey": true, "defaultValue": { "useZeroValue": true From c3da3b5b99bccad430cba622f0e1d2010007f625 Mon Sep 17 00:00:00 2001 From: Louisa Spicer Date: Fri, 10 Nov 2023 11:15:49 +0000 Subject: [PATCH 2/2] fix: don't add unique constraint to primary key fields --- migrations/migrations.go | 2 +- migrations/sql.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migrations/migrations.go b/migrations/migrations.go index 64299a751..8c8f848cd 100644 --- a/migrations/migrations.go +++ b/migrations/migrations.go @@ -289,7 +289,7 @@ func New(ctx context.Context, schema *proto.Schema, database db.Database) (*Migr return c.TableName == tableName && c.ConstraintType == "u" && len(c.ConstrainedColumns) == 1 && c.ConstrainedColumns[0] == int64(column.ColumnNum) }) - if field.Unique && !hasUniqueConstraint { + if field.Unique && !field.PrimaryKey && !hasUniqueConstraint { uniqueStmt, err := addUniqueConstraintStmt(schema, model.Name, []string{field.Name}) if err != nil { return nil, err diff --git a/migrations/sql.go b/migrations/sql.go index 871088a3b..cb3dd95c0 100644 --- a/migrations/sql.go +++ b/migrations/sql.go @@ -85,7 +85,7 @@ func createTableStmt(schema *proto.Schema, model *proto.Model) (string, error) { PrimaryKeyConstraintName(model.Name, field.Name), Identifier(field.Name))) } - if field.Unique { + if field.Unique && !field.PrimaryKey { uniqueStmt, err := addUniqueConstraintStmt(schema, model.Name, []string{field.Name}) if err != nil { return "", err @@ -150,7 +150,7 @@ func addColumnStmt(schema *proto.Schema, modelName string, field *proto.Field) ( fmt.Sprintf("ALTER TABLE %s ADD COLUMN %s;", Identifier(modelName), stmt), ) - if field.Unique { + if field.Unique && !field.PrimaryKey { stmt, err := addUniqueConstraintStmt(schema, modelName, []string{field.Name}) if err != nil { return "", err