├── .github
├── CODEOWNERS
├── FUNDING.yml
└── workflows
│ └── deploy.yml
├── .gitignore
├── .npmrc
├── Cargo.lock
├── Cargo.toml
├── LICENSE.md
├── NOTICE
├── README.MD
├── assets
├── README.md
└── package.json
├── crates
├── ast
│ ├── builtin_connectors
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── cockroach_datamodel_connector.rs
│ │ │ ├── cockroach_datamodel_connector
│ │ │ ├── native_types.rs
│ │ │ └── validations.rs
│ │ │ ├── lib.rs
│ │ │ ├── mongodb.rs
│ │ │ ├── mongodb
│ │ │ ├── mongodb_types.rs
│ │ │ └── validations.rs
│ │ │ ├── mssql_datamodel_connector.rs
│ │ │ ├── mssql_datamodel_connector
│ │ │ ├── native_types.rs
│ │ │ └── validations.rs
│ │ │ ├── mysql_datamodel_connector.rs
│ │ │ ├── mysql_datamodel_connector
│ │ │ ├── native_types.rs
│ │ │ └── validations.rs
│ │ │ ├── native_type_definition.rs
│ │ │ ├── postgres_datamodel_connector.rs
│ │ │ ├── postgres_datamodel_connector
│ │ │ ├── datasource.rs
│ │ │ ├── native_types.rs
│ │ │ └── validations.rs
│ │ │ └── sqlite_datamodel_connector.rs
│ ├── diagnostics
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── collection.rs
│ │ │ ├── error.rs
│ │ │ ├── lib.rs
│ │ │ ├── native_type_error_factory.rs
│ │ │ ├── pretty_print.rs
│ │ │ ├── span.rs
│ │ │ └── warning.rs
│ ├── parser_database
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── attributes.rs
│ │ │ ├── attributes
│ │ │ ├── default.rs
│ │ │ ├── id.rs
│ │ │ ├── map.rs
│ │ │ ├── native_types.rs
│ │ │ └── schema.rs
│ │ │ ├── coerce_expression.rs
│ │ │ ├── context.rs
│ │ │ ├── context
│ │ │ └── attributes.rs
│ │ │ ├── interner.rs
│ │ │ ├── lib.rs
│ │ │ ├── names.rs
│ │ │ ├── names
│ │ │ └── reserved_model_names.rs
│ │ │ ├── relations.rs
│ │ │ ├── types.rs
│ │ │ ├── types
│ │ │ └── index_fields.rs
│ │ │ ├── walkers.rs
│ │ │ └── walkers
│ │ │ ├── composite_type.rs
│ │ │ ├── enum.rs
│ │ │ ├── field.rs
│ │ │ ├── index.rs
│ │ │ ├── model.rs
│ │ │ ├── model
│ │ │ ├── primary_key.rs
│ │ │ └── unique_criteria.rs
│ │ │ ├── relation.rs
│ │ │ ├── relation
│ │ │ ├── implicit_many_to_many.rs
│ │ │ ├── inline.rs
│ │ │ ├── inline
│ │ │ │ └── complete.rs
│ │ │ └── two_way_embedded_many_to_many.rs
│ │ │ ├── relation_field.rs
│ │ │ └── scalar_field.rs
│ ├── psl
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── src
│ │ │ └── lib.rs
│ │ └── tests
│ │ │ ├── attributes
│ │ │ ├── arg_parsing.rs
│ │ │ ├── builtin_attributes.rs
│ │ │ ├── cockroachdb_sequence.rs
│ │ │ ├── composite_index.rs
│ │ │ ├── constraint_names_negative.rs
│ │ │ ├── constraint_names_positive.rs
│ │ │ ├── default_composite_negative.rs
│ │ │ ├── default_composite_positive.rs
│ │ │ ├── default_negative.rs
│ │ │ ├── default_positive.rs
│ │ │ ├── field_name_clash.rs
│ │ │ ├── id_negative.rs
│ │ │ ├── id_positive.rs
│ │ │ ├── ignore_negative.rs
│ │ │ ├── ignore_positive.rs
│ │ │ ├── index_clustering.rs
│ │ │ ├── index_negative.rs
│ │ │ ├── index_positive.rs
│ │ │ ├── map_positive.rs
│ │ │ ├── mod.rs
│ │ │ ├── postgres_indices.rs
│ │ │ ├── postgres_indices
│ │ │ │ ├── brin.rs
│ │ │ │ ├── cockroachdb.rs
│ │ │ │ ├── gin.rs
│ │ │ │ ├── gist.rs
│ │ │ │ └── spgist.rs
│ │ │ ├── relations
│ │ │ │ ├── many_to_many_negative.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── referential_actions.rs
│ │ │ │ ├── referential_actions
│ │ │ │ │ └── cycle_detection.rs
│ │ │ │ ├── relations_negative.rs
│ │ │ │ ├── relations_new.rs
│ │ │ │ └── relations_positive.rs
│ │ │ ├── unique_negative.rs
│ │ │ ├── unique_positive.rs
│ │ │ ├── updated_at_negative.rs
│ │ │ └── updated_at_positive.rs
│ │ │ ├── base
│ │ │ ├── array_sugar.rs
│ │ │ ├── base_types.rs
│ │ │ ├── basic.rs
│ │ │ ├── comments.rs
│ │ │ ├── duplicates.rs
│ │ │ └── mod.rs
│ │ │ ├── capabilities
│ │ │ ├── cockroachdb.rs
│ │ │ ├── mod.rs
│ │ │ ├── mysql.rs
│ │ │ ├── postgres.rs
│ │ │ ├── sqlite.rs
│ │ │ └── sqlserver.rs
│ │ │ ├── common
│ │ │ ├── asserts.rs
│ │ │ └── mod.rs
│ │ │ ├── config
│ │ │ ├── datasources.rs
│ │ │ ├── generators.rs
│ │ │ ├── mod.rs
│ │ │ ├── nice_warnings.rs
│ │ │ └── sources.rs
│ │ │ ├── datamodel_tests.rs
│ │ │ ├── functions
│ │ │ ├── functionals_environment.rs
│ │ │ ├── mod.rs
│ │ │ ├── server_side_functions.rs
│ │ │ └── string_interpolation.rs
│ │ │ ├── panic_with_diff
│ │ │ └── mod.rs
│ │ │ ├── parsing
│ │ │ ├── attributes.rs
│ │ │ ├── comments.rs
│ │ │ ├── expressions.rs
│ │ │ ├── literals.rs
│ │ │ ├── mod.rs
│ │ │ ├── models.rs
│ │ │ └── nice_errors.rs
│ │ │ ├── reformat
│ │ │ ├── mod.rs
│ │ │ ├── reformat.rs
│ │ │ └── reformat_implicit_relations.rs
│ │ │ ├── reformat_tests.rs
│ │ │ ├── reformatter
│ │ │ ├── block_attribute_comments_are_preserved.prisma
│ │ │ ├── block_attribute_comments_are_preserved.reformatted.prisma
│ │ │ ├── catch_all_in_a_block_must_not_influence_table_layout.prisma
│ │ │ ├── catch_all_in_a_block_must_not_influence_table_layout.reformatted.prisma
│ │ │ ├── model_block_attributes_ordering.prisma
│ │ │ ├── model_block_attributes_ordering.reformatted.prisma
│ │ │ ├── model_field_attributes_ordering.prisma
│ │ │ ├── model_field_attributes_ordering.reformatted.prisma
│ │ │ ├── model_single_field.prisma
│ │ │ ├── model_single_field.reformatted.prisma
│ │ │ ├── optional_list_fields.prisma
│ │ │ ├── optional_list_fields.reformatted.prisma
│ │ │ ├── regression_add_relation_attribute_on_field_with_multi_byte_trailing_comment.prisma
│ │ │ ├── regression_add_relation_attribute_on_field_with_multi_byte_trailing_comment.reformatted.prisma
│ │ │ ├── relations
│ │ │ │ ├── back_relation_fields_and_attribute_must_be_added_even_when_attribute_is_missing.prisma
│ │ │ │ ├── back_relation_fields_and_attribute_must_be_added_even_when_attribute_is_missing.reformatted.prisma
│ │ │ │ ├── back_relation_fields_must_be_added.prisma
│ │ │ │ ├── back_relation_fields_must_be_added.reformatted.prisma
│ │ │ │ ├── forward_relation_fields_must_be_added.prisma
│ │ │ │ ├── forward_relation_fields_must_be_added.reformatted.prisma
│ │ │ │ ├── native_types_in_missing_relation_fields.prisma
│ │ │ │ └── native_types_in_missing_relation_fields.reformatted.prisma
│ │ │ ├── trailing_comments_allowed_in_configuration_blocks.prisma
│ │ │ ├── trailing_comments_allowed_in_configuration_blocks.reformatted.prisma
│ │ │ ├── type_aliases.prisma
│ │ │ └── type_aliases.reformatted.prisma
│ │ │ ├── types
│ │ │ ├── cockroachdb_native_types.rs
│ │ │ ├── composite_types.rs
│ │ │ ├── mod.rs
│ │ │ ├── mongo_native_types.rs
│ │ │ ├── mssql_native_types.rs
│ │ │ ├── mysql_native_types.rs
│ │ │ ├── negative.rs
│ │ │ ├── positive.rs
│ │ │ └── postgres_native_types.rs
│ │ │ ├── validation
│ │ │ ├── attributes
│ │ │ │ ├── index
│ │ │ │ │ ├── indexes_on_relation_fields_must_error.prisma
│ │ │ │ │ ├── missing_index_warning
│ │ │ │ │ │ ├── mongodb.prisma
│ │ │ │ │ │ ├── relation_mode_foreign_keys.prisma
│ │ │ │ │ │ └── relation_mode_prisma
│ │ │ │ │ │ │ ├── one_field_at_at_unique.prisma
│ │ │ │ │ │ │ ├── one_field_at_unique.prisma
│ │ │ │ │ │ │ ├── one_field_no_index.prisma
│ │ │ │ │ │ │ ├── three_fields_index_leftmost.prisma
│ │ │ │ │ │ │ ├── three_fields_index_rightmost.prisma
│ │ │ │ │ │ │ ├── three_fields_mixed_unique.prisma
│ │ │ │ │ │ │ └── three_fields_no_index.prisma
│ │ │ │ │ ├── mysql_missing_length.prisma
│ │ │ │ │ ├── sql_server_disallows_compound_unique_length_prefix.prisma
│ │ │ │ │ ├── sql_server_disallows_index_length_prefix.prisma
│ │ │ │ │ ├── sqlite_disallows_unique_length_prefix.prisma
│ │ │ │ │ ├── sqlserver_disallows_unique_length_prefix.prisma
│ │ │ │ │ ├── string_field_names.prisma
│ │ │ │ │ ├── unique_sort_order_as_string.prisma
│ │ │ │ │ └── unknown_field.prisma
│ │ │ │ ├── index_clustering
│ │ │ │ │ ├── clustered_compound_unique_on_sqlite.prisma
│ │ │ │ │ ├── id_and_index_clustering_together_not_allowed.prisma
│ │ │ │ │ ├── id_and_unique_clustering_together_not_allowed.prisma
│ │ │ │ │ ├── non_boolean_index_clustering.prisma
│ │ │ │ │ ├── non_clustered_compound_id_sqlite.prisma
│ │ │ │ │ ├── non_clustered_id_sqlite.prisma
│ │ │ │ │ ├── on_mysql.prisma
│ │ │ │ │ └── on_postgres.prisma
│ │ │ │ ├── map
│ │ │ │ │ ├── duplicate_models_with_map_on_both_sides.prisma
│ │ │ │ │ ├── map_must_error_for_relation_fields.prisma
│ │ │ │ │ ├── mongodb_field_map_cannot_contain_periods.prisma
│ │ │ │ │ └── mongodb_field_map_cannot_start_with_dollar_sign.prisma
│ │ │ │ ├── nanoid
│ │ │ │ │ ├── require_int_argument.prisma
│ │ │ │ │ ├── require_minimum_value.prisma
│ │ │ │ │ ├── require_string_column.prisma
│ │ │ │ │ ├── string_column_with_length_valid.prisma
│ │ │ │ │ └── string_column_with_no_argument_valid.prisma
│ │ │ │ ├── relation_mode
│ │ │ │ │ ├── referential_integrity_attr_is_deprecated.prisma
│ │ │ │ │ └── relation_mode_and_referential_integrity_cannot_cooccur.prisma
│ │ │ │ └── schema
│ │ │ │ │ ├── bad_schema_attribute.prisma
│ │ │ │ │ ├── enums_in_different_schemas_with_same_mapped_name.prisma
│ │ │ │ │ ├── enums_in_same_schema_with_same_mapped_name.prisma
│ │ │ │ │ ├── missing_schema_annotations.prisma
│ │ │ │ │ ├── multiple_schemas_valid.prisma
│ │ │ │ │ ├── mysql_enums_do_not_have_a_schema.prisma
│ │ │ │ │ ├── no_schema_attributes.prisma
│ │ │ │ │ ├── non_existing_schema.prisma
│ │ │ │ │ ├── on_sqlite.prisma
│ │ │ │ │ ├── repeated_schema_attribute.prisma
│ │ │ │ │ ├── tables_in_different_schemas_with_same_constraint_names.prisma
│ │ │ │ │ ├── tables_in_different_schemas_with_same_mapped_name.prisma
│ │ │ │ │ ├── tables_in_same_schema_with_same_constraint_names.prisma
│ │ │ │ │ ├── tables_in_same_schema_with_same_mapped_name.prisma
│ │ │ │ │ ├── with_single_schema.prisma
│ │ │ │ │ ├── with_single_schema_mysql.prisma
│ │ │ │ │ ├── with_single_schema_sqlserver.prisma
│ │ │ │ │ └── without_preview_feature.prisma
│ │ │ ├── capabilities
│ │ │ │ ├── mongodb_does_not_support_autoincrement.prisma
│ │ │ │ └── mongodb_supports_composite_types.prisma
│ │ │ ├── cockroachdb
│ │ │ │ └── negative_time_precision.prisma
│ │ │ ├── composite_types
│ │ │ │ ├── ignore_field_attribute_is_not_allowed.prisma
│ │ │ │ ├── index_attributes_on_composite_types.prisma
│ │ │ │ ├── map_field_attribute_is_allowed.prisma
│ │ │ │ ├── relation_field_attribute_not_allowed.prisma
│ │ │ │ └── unique_index_field_clash.prisma
│ │ │ ├── datasource
│ │ │ │ ├── duplicates_in_schemas.prisma
│ │ │ │ └── schemas_array_with_non_string_values.prisma
│ │ │ ├── mysql
│ │ │ │ ├── set_default_no_warning_when_relation_mode_prisma.prisma
│ │ │ │ ├── set_default_warning.prisma
│ │ │ │ └── set_default_warning_when_relation_mode_foreignkeys.prisma
│ │ │ ├── postgres
│ │ │ │ └── negative_time_precision.prisma
│ │ │ ├── postgres_extensions
│ │ │ │ ├── extensions_are_not_numbers.prisma
│ │ │ │ ├── extensions_are_not_strings.prisma
│ │ │ │ ├── extensions_do_not_work_on_mongodb.prisma
│ │ │ │ ├── extensions_do_not_work_on_mysql.prisma
│ │ │ │ ├── extensions_do_not_work_on_sqlite.prisma
│ │ │ │ ├── extensions_do_not_work_on_sqlserver.prisma
│ │ │ │ ├── extensions_require_feature_flag.prisma
│ │ │ │ ├── extensions_with_arguments.prisma
│ │ │ │ ├── extensions_with_duplicate_arguments.prisma
│ │ │ │ ├── extensions_with_float_arguments.prisma
│ │ │ │ ├── extensions_with_garbage_arguments.prisma
│ │ │ │ ├── extensions_with_unnamed_arguments.prisma
│ │ │ │ ├── feature_flag.prisma
│ │ │ │ ├── invalid_characters_in_name.prisma
│ │ │ │ ├── simple_single_extension.prisma
│ │ │ │ └── single_extension_does_not_need_an_array.prisma
│ │ │ ├── postgres_indexes
│ │ │ │ ├── brin
│ │ │ │ │ ├── bit_minmax_no_native_type.prisma
│ │ │ │ │ ├── bit_minmax_wrong_native_type.prisma
│ │ │ │ │ ├── date_bloom_wrong_native_type.prisma
│ │ │ │ │ ├── date_minmax_wrong_native_type.prisma
│ │ │ │ │ ├── date_minmaxmulti_wrong_native_type.prisma
│ │ │ │ │ ├── on_mysql.prisma
│ │ │ │ │ ├── uuid_bloom_wrong_native_type.prisma
│ │ │ │ │ ├── uuid_minmax_wrong_native_type.prisma
│ │ │ │ │ ├── uuid_minmaxmulti_wrong_native_type.prisma
│ │ │ │ │ ├── varbit_minmax_no_native_type.prisma
│ │ │ │ │ └── varbit_minmax_wrong_native_type.prisma
│ │ │ │ ├── gin
│ │ │ │ │ ├── array_ops_default_ops.prisma
│ │ │ │ │ ├── array_ops_invalid_index_type.prisma
│ │ │ │ │ └── on_mysql.prisma
│ │ │ │ └── spgist
│ │ │ │ │ ├── inet_ops_with_wrong_index_type.prisma
│ │ │ │ │ ├── inet_ops_with_wrong_prisma_type.prisma
│ │ │ │ │ ├── no_ops_weird_type.prisma
│ │ │ │ │ ├── on_mysql.prisma
│ │ │ │ │ ├── only_single_column_allowed.prisma
│ │ │ │ │ ├── text_ops_with_wrong_index_type.prisma
│ │ │ │ │ └── text_ops_with_wrong_prisma_type.prisma
│ │ │ ├── relations
│ │ │ │ ├── mongodb
│ │ │ │ │ ├── relation_same_native_type_1.prisma
│ │ │ │ │ ├── relation_same_native_type_2.prisma
│ │ │ │ │ └── relation_same_native_type_3.prisma
│ │ │ │ ├── postgres
│ │ │ │ │ ├── set_null_is_not_valid_on_mixed_fields_when_relation_mode_prisma.prisma
│ │ │ │ │ ├── set_null_is_not_valid_on_required_fields_when_relation_mode_prisma.prisma
│ │ │ │ │ ├── set_null_warns_on_mixed_fields.prisma
│ │ │ │ │ └── set_null_warns_on_required_fields.prisma
│ │ │ │ ├── relation_field_with_ignored_or_unspported_fields_does_not_need_ignore.prisma
│ │ │ │ ├── set_null_is_not_valid_on_mixed_fields.prisma
│ │ │ │ ├── set_null_is_not_valid_on_required_fields.prisma
│ │ │ │ └── set_null_still_valid_on_optional_fields.prisma
│ │ │ ├── types
│ │ │ │ └── mongodb
│ │ │ │ │ ├── invalid_bindata_usage_in_model.prisma
│ │ │ │ │ ├── invalid_bindata_usage_in_type.prisma
│ │ │ │ │ ├── invalid_bool_usage_in_model.prisma
│ │ │ │ │ ├── invalid_bool_usage_in_type.prisma
│ │ │ │ │ ├── invalid_date_usage_in_model.prisma
│ │ │ │ │ ├── invalid_date_usage_in_type.prisma
│ │ │ │ │ ├── invalid_double_usage_in_model.prisma
│ │ │ │ │ ├── invalid_double_usage_in_type.prisma
│ │ │ │ │ ├── invalid_int_usage_in_model.prisma
│ │ │ │ │ ├── invalid_int_usage_in_type.prisma
│ │ │ │ │ ├── invalid_json_usage_in_type.prisma
│ │ │ │ │ ├── invalid_long_usage_in_model.prisma
│ │ │ │ │ ├── invalid_long_usage_in_type.prisma
│ │ │ │ │ ├── invalid_object_id_usage_in_model.prisma
│ │ │ │ │ ├── invalid_object_id_usage_in_type.prisma
│ │ │ │ │ ├── invalid_string_usage_in_model.prisma
│ │ │ │ │ ├── invalid_string_usage_in_type.prisma
│ │ │ │ │ ├── invalid_timestamp_usage_in_model.prisma
│ │ │ │ │ └── invalid_timestamp_usage_in_type.prisma
│ │ │ └── views
│ │ │ │ ├── basic_view.prisma
│ │ │ │ ├── duplicate_field.prisma
│ │ │ │ ├── duplicate_view_model_names.prisma
│ │ │ │ ├── duplicate_view_model_names_2.prisma
│ │ │ │ ├── duplicate_view_names.prisma
│ │ │ │ ├── field_name_starts_with_number.prisma
│ │ │ │ ├── garbage_field_definition.prisma
│ │ │ │ ├── multi_schema.prisma
│ │ │ │ ├── multi_schema_no_schema_declaration.prisma
│ │ │ │ ├── name_starts_with_number.prisma
│ │ │ │ ├── no_preview_feature.prisma
│ │ │ │ ├── no_unique.prisma
│ │ │ │ └── reserved_name.prisma
│ │ │ └── validation_tests.rs
│ ├── psl_core
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ └── src
│ │ │ ├── common.rs
│ │ │ ├── common
│ │ │ └── preview_features.rs
│ │ │ ├── configuration.rs
│ │ │ ├── configuration
│ │ │ ├── configuration_struct.rs
│ │ │ ├── datasource.rs
│ │ │ ├── env_vars.rs
│ │ │ └── generator.rs
│ │ │ ├── datamodel_connector.rs
│ │ │ ├── datamodel_connector
│ │ │ ├── capabilities.rs
│ │ │ ├── constraint_names.rs
│ │ │ ├── empty_connector.rs
│ │ │ ├── filters.rs
│ │ │ ├── native_types.rs
│ │ │ ├── relation_mode.rs
│ │ │ └── walker_ext_traits.rs
│ │ │ ├── lib.rs
│ │ │ ├── mcf.rs
│ │ │ ├── mcf
│ │ │ ├── generator.rs
│ │ │ └── source.rs
│ │ │ ├── reformat.rs
│ │ │ ├── validate.rs
│ │ │ └── validate
│ │ │ ├── datasource_loader.rs
│ │ │ ├── generator_loader.rs
│ │ │ ├── validation_pipeline.rs
│ │ │ └── validation_pipeline
│ │ │ ├── context.rs
│ │ │ ├── validations.rs
│ │ │ └── validations
│ │ │ ├── autoincrement.rs
│ │ │ ├── composite_types.rs
│ │ │ ├── constraint_namespace.rs
│ │ │ ├── database_name.rs
│ │ │ ├── datasource.rs
│ │ │ ├── default_value.rs
│ │ │ ├── enums.rs
│ │ │ ├── fields.rs
│ │ │ ├── indexes.rs
│ │ │ ├── models.rs
│ │ │ ├── names.rs
│ │ │ ├── relation_fields.rs
│ │ │ ├── relations.rs
│ │ │ ├── relations
│ │ │ ├── many_to_many.rs
│ │ │ ├── many_to_many
│ │ │ │ ├── embedded.rs
│ │ │ │ └── implicit.rs
│ │ │ ├── one_to_many.rs
│ │ │ ├── one_to_one.rs
│ │ │ └── visited_relation.rs
│ │ │ └── views.rs
│ └── schema_ast
│ │ ├── Cargo.toml
│ │ └── src
│ │ ├── ast.rs
│ │ ├── ast
│ │ ├── argument.rs
│ │ ├── attribute.rs
│ │ ├── comment.rs
│ │ ├── composite_type.rs
│ │ ├── config.rs
│ │ ├── enum.rs
│ │ ├── expression.rs
│ │ ├── field.rs
│ │ ├── find_at_position.rs
│ │ ├── generator_config.rs
│ │ ├── identifier.rs
│ │ ├── indentation_type.rs
│ │ ├── model.rs
│ │ ├── newline_type.rs
│ │ ├── source_config.rs
│ │ ├── top.rs
│ │ └── traits.rs
│ │ ├── lib.rs
│ │ ├── parser.rs
│ │ ├── parser
│ │ ├── datamodel.pest
│ │ ├── helpers.rs
│ │ ├── parse_arguments.rs
│ │ ├── parse_attribute.rs
│ │ ├── parse_comments.rs
│ │ ├── parse_composite_type.rs
│ │ ├── parse_enum.rs
│ │ ├── parse_expression.rs
│ │ ├── parse_field.rs
│ │ ├── parse_model.rs
│ │ ├── parse_schema.rs
│ │ ├── parse_source_and_generator.rs
│ │ ├── parse_types.rs
│ │ └── parse_view.rs
│ │ ├── reformat.rs
│ │ ├── renderer.rs
│ │ ├── renderer
│ │ └── table.rs
│ │ └── source_file.rs
├── format
│ ├── turboprisma_fmt
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── schema.prisma
│ │ └── src
│ │ │ ├── actions.rs
│ │ │ ├── code_actions.rs
│ │ │ ├── code_actions
│ │ │ ├── multi_schema.rs
│ │ │ ├── relation_mode.rs
│ │ │ └── relations.rs
│ │ │ ├── format.rs
│ │ │ ├── get_config.rs
│ │ │ ├── get_dmmf.rs
│ │ │ ├── lib.rs
│ │ │ ├── lint.rs
│ │ │ ├── main.rs
│ │ │ ├── native.rs
│ │ │ ├── preview.rs
│ │ │ ├── text_document_completion.rs
│ │ │ └── validate.rs
│ └── turboprisma_fmt_wasm
│ │ ├── Cargo.toml
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src
│ │ └── lib.rs
├── libs
│ └── prisma_value
│ │ ├── Cargo.toml
│ │ └── src
│ │ ├── arithmetic.rs
│ │ ├── error.rs
│ │ └── lib.rs
├── query_engine
│ ├── dml
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── composite_type.rs
│ │ │ ├── datamodel.rs
│ │ │ ├── default_value.rs
│ │ │ ├── field.rs
│ │ │ ├── lib.rs
│ │ │ ├── lift.rs
│ │ │ ├── model.rs
│ │ │ ├── native_type_instance.rs
│ │ │ ├── relation_info.rs
│ │ │ ├── scalars.rs
│ │ │ └── traits.rs
│ ├── dmmf
│ │ ├── Cargo.toml
│ │ ├── src
│ │ │ ├── ast_builders
│ │ │ │ ├── datamodel_ast_builder.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── schema_ast_builder
│ │ │ │ │ ├── enum_renderer.rs
│ │ │ │ │ ├── field_renderer.rs
│ │ │ │ │ ├── mod.rs
│ │ │ │ │ ├── object_renderer.rs
│ │ │ │ │ ├── schema_renderer.rs
│ │ │ │ │ └── type_renderer.rs
│ │ │ ├── lib.rs
│ │ │ ├── serialization_ast
│ │ │ │ ├── datamodel_ast.rs
│ │ │ │ ├── mappings_ast.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── schema_ast.rs
│ │ │ ├── test-schemas
│ │ │ │ └── sqlite_ignore.prisma
│ │ │ └── tests.rs
│ │ └── test_files
│ │ │ ├── functions.json
│ │ │ ├── functions.prisma
│ │ │ ├── general.json
│ │ │ ├── general.prisma
│ │ │ ├── ignore.json
│ │ │ ├── ignore.prisma
│ │ │ ├── source.json
│ │ │ ├── source.prisma
│ │ │ ├── source_with_comments.json
│ │ │ ├── source_with_comments.prisma
│ │ │ ├── source_with_generator.json
│ │ │ ├── source_with_generator.prisma
│ │ │ ├── views.json
│ │ │ ├── views.prisma
│ │ │ ├── without_relation_name.json
│ │ │ └── without_relation_name.prisma
│ ├── prisma_models
│ │ ├── Cargo.toml
│ │ ├── src
│ │ │ ├── composite_type.rs
│ │ │ ├── convert.rs
│ │ │ ├── error.rs
│ │ │ ├── field
│ │ │ │ ├── composite.rs
│ │ │ │ ├── mod.rs
│ │ │ │ ├── relation.rs
│ │ │ │ └── scalar.rs
│ │ │ ├── field_selection.rs
│ │ │ ├── fields.rs
│ │ │ ├── internal_data_model.rs
│ │ │ ├── lib.rs
│ │ │ ├── model.rs
│ │ │ ├── order_by.rs
│ │ │ ├── parent_container.rs
│ │ │ ├── pk.rs
│ │ │ ├── prelude.rs
│ │ │ ├── prisma_value_ext.rs
│ │ │ ├── projections
│ │ │ │ ├── mod.rs
│ │ │ │ └── model_projection.rs
│ │ │ ├── record.rs
│ │ │ ├── relation.rs
│ │ │ ├── selection_result.rs
│ │ │ └── zipper.rs
│ │ └── tests
│ │ │ └── datamodel_converter_tests.rs
│ ├── schema
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ ├── enum_type.rs
│ │ │ ├── input_types.rs
│ │ │ ├── lib.rs
│ │ │ ├── output_types.rs
│ │ │ ├── query_schema.rs
│ │ │ └── renderer.rs
│ └── schema_builder
│ │ ├── Cargo.toml
│ │ ├── benches
│ │ ├── noalyss_folder.prisma
│ │ ├── odoo.prisma
│ │ ├── schema_builder_bench.rs
│ │ └── standupbot.prisma
│ │ └── src
│ │ ├── cache.rs
│ │ ├── constants.rs
│ │ ├── enum_types.rs
│ │ ├── input_types
│ │ ├── fields
│ │ │ ├── arguments.rs
│ │ │ ├── data_input_mapper
│ │ │ │ ├── create.rs
│ │ │ │ ├── mod.rs
│ │ │ │ └── update.rs
│ │ │ ├── field_filter_types.rs
│ │ │ ├── field_ref_type.rs
│ │ │ ├── input_fields.rs
│ │ │ └── mod.rs
│ │ ├── mod.rs
│ │ └── objects
│ │ │ ├── connect_or_create_objects.rs
│ │ │ ├── filter_objects.rs
│ │ │ ├── mod.rs
│ │ │ ├── order_by_objects.rs
│ │ │ ├── update_many_objects.rs
│ │ │ ├── update_one_objects.rs
│ │ │ └── upsert_objects.rs
│ │ ├── lib.rs
│ │ ├── mutations
│ │ ├── create_many.rs
│ │ ├── create_one.rs
│ │ └── mod.rs
│ │ ├── output_types
│ │ ├── aggregation
│ │ │ ├── group_by.rs
│ │ │ ├── mod.rs
│ │ │ └── plain.rs
│ │ ├── field.rs
│ │ ├── mod.rs
│ │ ├── mutation_type.rs
│ │ ├── objects
│ │ │ ├── composite.rs
│ │ │ ├── mod.rs
│ │ │ └── model.rs
│ │ └── query_type.rs
│ │ └── utils.rs
├── turboprisma_cli
│ ├── Cargo.toml
│ └── src
│ │ ├── args.rs
│ │ ├── commands
│ │ ├── format.rs
│ │ ├── init.rs
│ │ ├── mod.rs
│ │ ├── validate.rs
│ │ └── version.rs
│ │ ├── env_parser.rs
│ │ ├── main.rs
│ │ └── utils
│ │ ├── env.rs
│ │ ├── install.rs
│ │ ├── mod.rs
│ │ └── schema.rs
└── turboprisma_vm
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── package.json
├── packages
├── turboprisma-vm
│ ├── LICENSE
│ ├── README.MD
│ ├── package.json
│ ├── postInstall.js
│ └── turboprisma_cli
└── turboprisma
│ ├── LICENSE
│ ├── README.MD
│ ├── package.json
│ ├── postInstall.js
│ └── turboprisma_cli
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
└── tsconfig.json
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @DavidHancu @leohaarmann
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | ko_fi: davidhancu
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | node_modules
3 |
4 | # not ready yet
5 | /packages/generator
6 | /packages/*/target
7 |
8 | prisma
9 | .env
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | auto-install-peers = true
2 | hoist = false
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [
3 | #"crates/ast/turboprisma_ast",
4 | "crates/turboprisma_cli",
5 | "crates/ast/*",
6 | "crates/libs/*",
7 | "crates/format/*",
8 | "crates/query_engine/*",
9 | "crates/turboprisma_vm"
10 | ]
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Parts of this project have been modified from the Prisma Engines (available at https://github.com/prisma/prisma-engines), made
2 | available via GitHub with an Apache-2.0 license by Prisma Data, Inc.
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 | ## What is Turboprisma?
24 |
25 | Turboprisma is a fast and performant Prisma runtime that provides an unified access framework, abstractions and new features on top of the Prisma schema, CLI and tools. It is fully developed in Rust, allowing for extreme speeds and optimizations which are just not possible with Prisma.
26 |
27 | ## Links
28 |
29 | Check out our API Documentation - [API Documentation](https://turboprisma.js.org/docs)
30 |
31 | Get Started with Turboprisma - [Getting Started](https://turboprisma.js.org/docs/getting-started)
--------------------------------------------------------------------------------
/assets/README.md:
--------------------------------------------------------------------------------
1 | # `turboprisma`
2 |
3 | This is a platform-specific binary for Turboprisma, a Prisma Runtime. See https://turboprisma.js.org for details.
--------------------------------------------------------------------------------
/assets/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "RINSERT_NAMER",
3 | "version": "RINSERT_VERSIONR",
4 | "description": "A platform binary for Turboprisma, a Prisma Runtime.",
5 | "repository": "https://github.com/DavidHancu/turboprisma",
6 | "bugs": "https://github.com/DavidHancu/turboprisma/issues",
7 | "homepage": "https://turboprisma.js.org",
8 | "license": "Apache-2.0",
9 | "os": [
10 | "RINSERT_OSR"
11 | ],
12 | "cpu": [
13 | "RINSERT_CPUR"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/crates/ast/builtin_connectors/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "builtin_psl_connectors"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | psl_core = { path = "../psl_core" }
8 |
9 | connection-string = "0.1"
10 | either = "1.6.1"
11 | enumflags2 = "0.7"
12 | indoc = "1"
13 | lsp-types = "0.91.1"
14 | once_cell = "1.3"
15 | regex = "1"
16 |
--------------------------------------------------------------------------------
/crates/ast/builtin_connectors/src/cockroach_datamodel_connector/native_types.rs:
--------------------------------------------------------------------------------
1 | crate::native_type_definition! {
2 | CockroachType;
3 | Bit(Option) -> String,
4 | Bool -> Boolean,
5 | Bytes -> Bytes,
6 | Char(Option) -> String,
7 | Date -> DateTime,
8 | Decimal(Option<(u32, u32)>) -> Decimal,
9 | Float4 -> Float,
10 | Float8 -> Float,
11 | Inet -> String,
12 | Int2 -> Int,
13 | Int4 -> Int,
14 | Int8 -> BigInt,
15 | JsonB -> Json,
16 | Oid -> Int,
17 | CatalogSingleChar -> String,
18 | String(Option) -> String,
19 | Time(Option) -> DateTime,
20 | Timestamp(Option) -> DateTime,
21 | Timestamptz(Option) -> DateTime,
22 | Timetz(Option) -> DateTime,
23 | Uuid -> String,
24 | VarBit(Option) -> String,
25 | }
26 |
--------------------------------------------------------------------------------
/crates/ast/builtin_connectors/src/lib.rs:
--------------------------------------------------------------------------------
1 | #![deny(rust_2018_idioms, unsafe_code)]
2 | #![allow(clippy::derive_partial_eq_without_eq)]
3 |
4 | pub mod cockroach_datamodel_connector;
5 |
6 | pub use cockroach_datamodel_connector::CockroachType;
7 | pub use mongodb::MongoDbType;
8 | pub use mssql_datamodel_connector::{MsSqlType, MsSqlTypeParameter};
9 | pub use mysql_datamodel_connector::MySqlType;
10 | pub use postgres_datamodel_connector::{PostgresDatasourceProperties, PostgresType};
11 |
12 | mod mongodb;
13 | mod mssql_datamodel_connector;
14 | mod mysql_datamodel_connector;
15 | mod native_type_definition;
16 | mod postgres_datamodel_connector;
17 | mod sqlite_datamodel_connector;
18 |
19 | use psl_core::{datamodel_connector::Connector, ConnectorRegistry};
20 |
21 | pub const POSTGRES: &'static dyn Connector = &postgres_datamodel_connector::PostgresDatamodelConnector;
22 | pub const COCKROACH: &'static dyn Connector = &cockroach_datamodel_connector::CockroachDatamodelConnector;
23 | pub const MYSQL: &'static dyn Connector = &mysql_datamodel_connector::MySqlDatamodelConnector;
24 | pub const SQLITE: &'static dyn Connector = &sqlite_datamodel_connector::SqliteDatamodelConnector;
25 | pub const MSSQL: &'static dyn Connector = &mssql_datamodel_connector::MsSqlDatamodelConnector;
26 | pub const MONGODB: &'static dyn Connector = &mongodb::MongoDbDatamodelConnector;
27 |
28 | pub const BUILTIN_CONNECTORS: ConnectorRegistry = &[POSTGRES, MYSQL, SQLITE, MSSQL, COCKROACH, MONGODB];
29 |
--------------------------------------------------------------------------------
/crates/ast/builtin_connectors/src/mysql_datamodel_connector/native_types.rs:
--------------------------------------------------------------------------------
1 | crate::native_type_definition! {
2 | /// The MySQL native type enum.
3 | MySqlType;
4 | Int -> Int,
5 | UnsignedInt -> Int,
6 | SmallInt -> Int,
7 | UnsignedSmallInt -> Int,
8 | TinyInt -> Boolean | Int,
9 | UnsignedTinyInt -> Boolean | Int,
10 | MediumInt -> Int,
11 | UnsignedMediumInt -> Int,
12 | BigInt -> BigInt,
13 | Decimal(Option<(u32, u32)>) -> Decimal,
14 | UnsignedBigInt -> BigInt,
15 | Float -> Float,
16 | Double -> Float,
17 | Bit(u32) -> Boolean | Bytes,
18 | Char(u32) -> String,
19 | VarChar(u32) -> String,
20 | Binary(u32) -> Bytes,
21 | VarBinary(u32) -> Bytes,
22 | TinyBlob -> Bytes,
23 | Blob -> Bytes,
24 | MediumBlob -> Bytes,
25 | LongBlob -> Bytes,
26 | TinyText -> String,
27 | Text -> String,
28 | MediumText -> String,
29 | LongText -> String,
30 | Date -> DateTime,
31 | Time(Option) -> DateTime,
32 | DateTime(Option) -> DateTime,
33 | Timestamp(Option) -> DateTime,
34 | Year -> Int,
35 | Json -> Json,
36 | }
37 |
38 | impl MySqlType {
39 | /// The user-defined precision for timestamp columns, where applicable.
40 | pub fn timestamp_precision(&self) -> Option {
41 | match self {
42 | MySqlType::Time(n) | MySqlType::DateTime(n) | MySqlType::Timestamp(n) => *n,
43 | _ => None,
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/crates/ast/builtin_connectors/src/postgres_datamodel_connector/native_types.rs:
--------------------------------------------------------------------------------
1 | crate::native_type_definition! {
2 | PostgresType;
3 | SmallInt -> Int,
4 | Integer -> Int,
5 | BigInt -> BigInt,
6 | Decimal(Option<(u32, u32)>) -> Decimal,
7 | Money -> Decimal,
8 | Inet -> String,
9 | Oid -> Int,
10 | Citext -> String,
11 | Real -> Float,
12 | DoublePrecision -> Float,
13 | VarChar(Option) -> String,
14 | Char(Option) -> String,
15 | Text -> String,
16 | ByteA -> Bytes,
17 | Timestamp(Option) -> DateTime,
18 | Timestamptz(Option) -> DateTime,
19 | Date -> DateTime,
20 | Time(Option) -> DateTime,
21 | Timetz(Option) -> DateTime,
22 | Boolean -> Boolean,
23 | Bit(Option) -> String,
24 | VarBit(Option) -> String,
25 | Uuid -> String,
26 | Xml -> String,
27 | Json -> Json,
28 | JsonB -> Json,
29 | }
30 |
--------------------------------------------------------------------------------
/crates/ast/diagnostics/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "diagnostics"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | colored = "2"
10 | pest = "2.1.3"
11 | indoc = "1"
--------------------------------------------------------------------------------
/crates/ast/diagnostics/src/lib.rs:
--------------------------------------------------------------------------------
1 | mod collection;
2 | mod error;
3 | mod native_type_error_factory;
4 | mod pretty_print;
5 | mod span;
6 | mod warning;
7 |
8 | pub use collection::Diagnostics;
9 | pub use error::DatamodelError;
10 | pub use native_type_error_factory::NativeTypeErrorFactory;
11 | pub use span::Span;
12 | pub use warning::DatamodelWarning;
--------------------------------------------------------------------------------
/crates/ast/diagnostics/src/span.rs:
--------------------------------------------------------------------------------
1 | /// Represents a location in a datamodel's text representation.
2 | #[derive(Debug, Clone, Copy, PartialEq, Eq)]
3 | pub struct Span {
4 | pub start: usize,
5 | pub end: usize,
6 | }
7 |
8 | impl Span {
9 | /// Constructor.
10 | pub fn new(start: usize, end: usize) -> Span {
11 | Span { start, end }
12 | }
13 |
14 | /// Creates a new empty span.
15 | pub fn empty() -> Span {
16 | Span { start: 0, end: 0 }
17 | }
18 |
19 | /// Is the given position inside the span? (boundaries included)
20 | pub fn contains(&self, position: usize) -> bool {
21 | position >= self.start && position <= self.end
22 | }
23 |
24 | /// Is the given span overlapping with the current span.
25 | pub fn overlaps(self, other: Span) -> bool {
26 | self.contains(other.start) || self.contains(other.end)
27 | }
28 | }
29 |
30 | impl From> for Span {
31 | fn from(s: pest::Span<'_>) -> Self {
32 | Span {
33 | start: s.start(),
34 | end: s.end(),
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/crates/ast/parser_database/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "parser_database"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 | diagnostics = { path = "../diagnostics" }
8 | schema_ast = { path = "../schema_ast" }
9 |
10 | enumflags2 = "0.7"
11 | indexmap = "1.8.0"
12 | either = "1.6.1"
13 |
--------------------------------------------------------------------------------
/crates/ast/parser_database/src/attributes/native_types.rs:
--------------------------------------------------------------------------------
1 | use crate::{
2 | ast,
3 | types::{CompositeTypeField, ScalarField},
4 | StringId,
5 | };
6 |
7 | pub(super) fn visit_model_field_native_type_attribute(
8 | datasource_name: StringId,
9 | type_name: StringId,
10 | attr: &ast::Attribute,
11 | scalar_field: &mut ScalarField,
12 | ) {
13 | let args = &attr.arguments;
14 | let args: Vec = args.arguments.iter().map(|arg| arg.value.to_string()).collect();
15 |
16 | scalar_field.native_type = Some((datasource_name, type_name, args, attr.span))
17 | }
18 |
19 | pub(super) fn visit_composite_type_field_native_type_attribute(
20 | datasource_name: StringId,
21 | type_name: StringId,
22 | attr: &ast::Attribute,
23 | composite_type_field: &mut CompositeTypeField,
24 | ) {
25 | let args = &attr.arguments;
26 | let args: Vec = args.arguments.iter().map(|arg| arg.value.to_string()).collect();
27 |
28 | composite_type_field.native_type = Some((datasource_name, type_name, args, attr.span))
29 | }
30 |
--------------------------------------------------------------------------------
/crates/ast/parser_database/src/attributes/schema.rs:
--------------------------------------------------------------------------------
1 | use crate::{ast, coerce, context::*, types::*, StringId};
2 |
3 | pub(super) fn model(model_attributes: &mut ModelAttributes, ctx: &mut Context<'_>) {
4 | model_attributes.schema = visit_schema_attribute(ctx);
5 | }
6 |
7 | pub(super) fn r#enum(enum_attributes: &mut EnumAttributes, ctx: &mut Context<'_>) {
8 | enum_attributes.schema = visit_schema_attribute(ctx);
9 | }
10 |
11 | fn visit_schema_attribute(ctx: &mut Context<'_>) -> Option<(StringId, ast::Span)> {
12 | let arg = match ctx.visit_default_arg("map") {
13 | Ok(arg) => arg,
14 | Err(err) => {
15 | ctx.push_error(err);
16 | return None;
17 | }
18 | };
19 | let name = coerce::string(arg, ctx.diagnostics)?;
20 | Some((ctx.interner.intern(name), arg.span()))
21 | }
22 |
--------------------------------------------------------------------------------
/crates/ast/parser_database/src/context/attributes.rs:
--------------------------------------------------------------------------------
1 | use super::*;
2 | use crate::interner::StringId;
3 |
4 | #[derive(Default, Debug)]
5 | pub(super) struct AttributesValidationState {
6 | /// The attributes list being validated.
7 | pub(super) attributes: Vec,
8 | pub(super) unused_attributes: HashSet, // the _remaining_ attributes
9 |
10 | /// The attribute being validated.
11 | pub(super) attribute: Option,
12 | pub(super) args: HashMap