Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable warning: could not find a field to use to iterate over rows in model ___ #103

Open
renatocron opened this issue Mar 16, 2024 · 2 comments

Comments

@renatocron
Copy link

Hello!

I'm using this plugin in on a model where I unique with @@unique([created_at, cf_ray, request_num]). This table is in the database is actually partitioned on created_at /daily using timescaledb so I cannot have another column as PK, unless I lie in the schema and change in the production model

So, I would appreciate if I have a way to disable the warning, or a way to implement a workarround

  console.warn
    [prisma-field-encryption] Warning: could not find a field to use to iterate over rows in model api_request_log.
      Automatic encryption/decryption/key rotation migrations are disabled for this model.
      Read more: https://github.com/47ng/prisma-field-encryption#migrations

I've tried using the @encryption:cursor, but it as well only has the same limitation as with the @id field, so it do not accept compound fields

schema, if need, to reproduce the log message:

model api_request_log {
    created_at  DateTime @default(now()) @db.Timestamp(6)
    cf_ray      String
    request_num Int

    ip                  String  @db.Inet
    response_time       Int
    response_size       Int
    req_method          String
    req_path            String
    req_host            String
    req_headers         String /// @encrypted?mode=strict
    req_query           String /// @encrypted?mode=strict
    req_body            String /// @encrypted?mode=strict
    req_body_size       Int?
    res_code            Int     @db.SmallInt
    created_customer_id Int?

    @@unique([created_at, cf_ray, request_num])
}
@franky47
Copy link
Member

Disabling the warning for specific models could be done with an environment variable, for example:

DISABLE_MIGRATION_WARNING=api_request_log,other_model

Would you like to open a PR?

@renatocron
Copy link
Author

@franky47
I can make further changes if needed,
#104

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants