-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add PK or set replication identity #4
Comments
@fgblomqvist we should add a unique ID column like how we did for Gorm Adapter: casbin/gorm-adapter#54 |
One question I got is since Casbin wants adapters to fully manage their DBs/tables, I'm guessing that means that a migration has to be created for this? How will that work out? |
@closetool do you think we need migration? |
@hsluoyz I don't get it why it's necessary |
@fgblomqvist I think we can put a notice about the db format change, like how we did it previously: jcasbin/casbin-spring-boot-starter#25 |
It's just a bit uggly to force the user to add the field when Casbin does the table creation. If it was completely managed by the user it would make sense. But oh well. |
@fgblomqvist what kind of DB migration do you refer to? Can you provide some details? |
https://www.cloudbees.com/blog/database-migration/ |
@fgblomqvist OK. Then I think we are on the same page. The question on my mind is that is there any production use for this adapter given its popularity? If not, the migration code will become useless efforts. |
Fair enough, perhaps the adoption is not there yet. I can figure things out on my end. But regardless, having a PK column would be very nice indeed. |
@fgblomqvist thanks for understanding. Currently still waiting for: #8 to be merged, then we will fix this issue. |
Since the table that is created does not have a PK, it's impossible to do DELETE/UPDATE statements on it in case the DB instance has a publication set for
ALL TABLES
(https://www.postgresql.org/docs/current/logical-replication-publication.html). This is not uncommon in more complex environments.In order to prevent people from having to fix the table created by this adapter, I would propose either adding a PK to it or setting the
REPLICA IDENTITY
toFULL
. If you go with the PK, you could either do it on the full row (not sure if there are any bad side effects from that) or simply add an ID column (seems a bit useless perhaps). Setting theREPLICA IDENTITY
can be done usingALTER TABLE ... REPLICA IDENTITY FULL
.The text was updated successfully, but these errors were encountered: