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

casbin_sequence is generated even when casbin_rule table is made beforehand using GenerationType.IDENTITY #59

Closed
offset-null1 opened this issue Nov 12, 2022 · 9 comments · Fixed by #60
Assignees
Labels
bug Something isn't working released

Comments

@offset-null1
Copy link

offset-null1 commented Nov 12, 2022

I implicitly created casbin_rule table with Id generation type as IDENTITY. But it created casbin_sequence which wasn't required and happened because of
case "PostgreSQL": sql = renderActualSql("CREATE SEQUENCE IF NOT EXISTS CASBIN_SEQUENCE START 1;");

in JDBCBaseAdapter.java .
It should only be executed when the table doesn't exist otherwise the generation of sequence is redundant.

@casbin-bot
Copy link

@tangyang9464 @imp2002

@casbin-bot casbin-bot added the question Further information is requested label Nov 12, 2022
@hsluoyz
Copy link
Member

hsluoyz commented Nov 12, 2022

@OutOfEastGate

@OutOfEastGate
Copy link
Collaborator

@offset-null1 Thank you for your feedback. I will deal with it soon.

@hsluoyz
Copy link
Member

hsluoyz commented Nov 13, 2022

@offset-null1 are you a user or contributor?

@offset-null1
Copy link
Author

@hsluoyz I'm using this module to contribute to this issue.

@offset-null1
Copy link
Author

offset-null1 commented Nov 13, 2022 via email

@OutOfEastGate
Copy link
Collaborator

Yes, that prevents the creation of casbin_sequence but as the default is true, I feel before generating the sequence there should be a check if the table exists or not. In my case I didn't set it to false but had a table already created, still the sequence was generated i.e., I ended up having 2 sequences in the database.

I know what you mean.By default, we create casbin_sequence. If you have your own requirements, you can modify the parameters of casbin_sequence directly.In mybatis adapter, sequence is not created by default. Of course, we will refine this section to check the existence of the table before creating the casbin_sequence.

@offset-null1
Copy link
Author

offset-null1 commented Nov 14, 2022 via email

@hsluoyz hsluoyz added bug Something isn't working and removed question Further information is requested labels Nov 14, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 2.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants