Skip to content

feat: add create_casbin_rule_model() API for Alembic migration support#22

Merged
hsluoyz merged 3 commits intomasterfrom
copilot/add-casbinrule-table-migration
Dec 7, 2025
Merged

feat: add create_casbin_rule_model() API for Alembic migration support#22
hsluoyz merged 3 commits intomasterfrom
copilot/add-casbinrule-table-migration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 2, 2025

  • Add create_casbin_rule_model() function for Alembic migration support
  • Export function in __init__.py
  • Keep changes minimal: short one-line docstring, no new README docs, no new tests
Original prompt

This section details on the original issue you should resolve

<issue_title>CasbinRule Table Migration?</issue_title>
<issue_description>What is the intended way of adding CasbinRule table into the existing application?

Having create_table() on an application's startup doesn't seem like a correct way to go [in the long run].

await adapter.create_table()

Considering SQLAlchemy goes with Alembic migration in most cases, are we supposed to auto-generate the migration on our own? I'd seem logical, but casbin_async_sqlalchemy_adapter.adapter::CasbinRule class uses Base metadata object different than my other models.
Or did I miss this aspect in the documentation?</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add migration for CasbinRule table in application Add create_casbin_rule_model() for Alembic migration support Dec 2, 2025
Copilot AI requested a review from hsluoyz December 2, 2025 12:57
@hsluoyz hsluoyz marked this pull request as ready for review December 2, 2025 13:06
@hsluoyz
Copy link
Copy Markdown
Member

hsluoyz commented Dec 7, 2025

@copilot don't add so long README text and code comment. Keep it short and simple. Don't add new test code

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 7, 2025

@copilot don't add so long README text and code comment. Keep it short and simple. Don't add new test code

Done in 9f9c83c. Removed README documentation and tests, shortened docstring to one line.

@hsluoyz
Copy link
Copy Markdown
Member

hsluoyz commented Dec 7, 2025

@copilot need to add the new create_casbin_rule_model API usage to README (but keep it concise)

@hsluoyz hsluoyz changed the title Add create_casbin_rule_model() for Alembic migration support feat: add create_casbin_rule_model() API for Alembic migration support Dec 7, 2025
@hsluoyz hsluoyz merged commit f250462 into master Dec 7, 2025
13 of 14 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 7, 2025
# [1.16.0](v1.15.0...v1.16.0) (2025-12-07)

### Features

* add create_casbin_rule_model() API for Alembic migration support ([#22](#22)) ([5628b21](5628b21))
@mserico mserico mentioned this pull request Dec 7, 2025
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

Successfully merging this pull request may close these issues.

CasbinRule Table Migration?

2 participants