Help with enums and PostgreSQL on Amazon RDS with Encryption
See original GitHub issueHI
This is not a problem with the library but I wanted to ask because we cant find any documentation and we hope you can point us at the right direction.
We are using Npgsql.EntityFrameworkCore.PostgreSQL Version=2.1.2, we mapped our enumerations correctly and we were working great, but yesterday our security team asked us to enable Encryption on the database, after that we started seeing errors like “The CLR enum type CountryType must be registered with Npgsql before usage”.
In our script we create enums like this:
CREATE TYPE entity_country_type AS enum ('CITIZENSHIP','RESIDENCE','TAXATION','NATIONALITY','DOMICILE','BIRTH');
And we have this in code:
NpgsqlConnection.GlobalTypeMapper.MapEnum<CountryType>("entity_country_type");
modelBuilder.ForNpgsqlHasEnum("entity_country_type", new[] { "CITIZENSHIP", "RESIDENCE", "TAXATION", "NATIONALITY", "DOMICILE", "BIRTH" });
public enum CountryType
{
[PgName("CITIZENSHIP")]
Citizenship = 0,
[PgName("RESIDENCE")]
Residence = 1,
[PgName("TAXATION")]
Taxation = 2,
[PgName("NATIONALITY")]
Nationality = 3,
[PgName("DOMICILE")]
Domicile = 4,
[PgName("BIRTH")]
Birth = 5,
}
Are you aware of any changes we have to make to ensure the enum mapping keeps working after we enable the ecryption?
Thanks a lot
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Encrypt an existing Amazon RDS for PostgreSQL DB ...
This pattern explains how to encrypt an existing Amazon Relational Database Service (Amazon RDS) for PostgreSQL DB instance in the Amazon Web Services...
Read more >Enable encrypted connections for PostgreSQL DB ...
This pattern describes how you can enable encrypted connections for an Amazon RDS for PostgreSQL DB instance. You can use the same process...
Read more >Using a PostgreSQL database as an AWS DMS source
Use a PostgreSQL database as a source for AWS DMS. ... You can use Secure Socket Layers (SSL) to encrypt connections between your...
Read more >Encrypting Amazon RDS resources - AWS Documentation
Amazon RDS can encrypt your Amazon RDS DB instances. Data that is encrypted at rest includes the underlying storage for DB instances, its...
Read more >Encrypt Amazon RDS for PostgreSQL and Amazon Aurora ...
Converting an unencrypted RDS for PostgreSQL or Amazon Aurora ... In this post, you use the AWS managed default RDS encryption key (alias ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JuanZamudioGBM Thanks for keeping us updated. At this point, it sounds like this isn’t primarily driven by the EF Core provider, so I’m going to close the issue for now.
That said, I would be very interested to hear any resolution details you can share with us. Also, if further investigation does point back to the EF Core provider, we can reopen this issue at that time.
Hi
We found the origin of the problem, we are using flyway to handle the changes in the database, and when we add a new version of the script flyway runs with the following commands:
And the scripts are numbered like this:
After that we see the enum error, we are currently investigating if the new version number is what creates the problem or if simple the fact that adding a new script, and trying to see the logs to see what changes flyway makes in the database so the enum mapping stops working.
Thanks for your time