sqlmodel icon indicating copy to clipboard operation
sqlmodel copied to clipboard

📝 Add migrations section

Open ezeparziale opened this issue 4 months ago • 9 comments

I added the migrations section to use SQLModel with alembic.

  • [X] Initial example
  • [X] Step by step
  • [X] Example codes

Updated release from: https://github.com/fastapi/sqlmodel/pull/512

ezeparziale avatar Sep 07 '25 22:09 ezeparziale

📝 Docs preview for commit 23a6b352ef8042a434d871ee42dc67cf918dd26c at: https://eae99712.sqlmodel.pages.dev

Modified Pages

  • https://eae99712.sqlmodel.pages.dev/advanced/migrations/ - (before)
  • https://eae99712.sqlmodel.pages.dev/img/advanced/migrations/migrations001.png - (before)
  • https://eae99712.sqlmodel.pages.dev/img/advanced/migrations/migrations002.png - (before)
  • https://eae99712.sqlmodel.pages.dev/img/advanced/migrations/migrations003.png - (before)

github-actions[bot] avatar Sep 07 '25 22:09 github-actions[bot]

📝 Docs preview for commit 5cb04c1ed74af515bafd22bfdfee507679bf0e57 at: https://0bdff723.sqlmodel.pages.dev

Modified Pages

  • https://0bdff723.sqlmodel.pages.dev/advanced/migrations/ - (before)
  • https://0bdff723.sqlmodel.pages.dev/img/advanced/migrations/migrations001.png - (before)
  • https://0bdff723.sqlmodel.pages.dev/img/advanced/migrations/migrations002.png - (before)
  • https://0bdff723.sqlmodel.pages.dev/img/advanced/migrations/migrations003.png - (before)

github-actions[bot] avatar Sep 07 '25 22:09 github-actions[bot]

📝 Docs preview for commit 9b58d73ac67c22272543ad248dc51839ea6590b5 at: https://5ae74634.sqlmodel.pages.dev

Modified Pages

  • https://5ae74634.sqlmodel.pages.dev/advanced/migrations/ - (before)
  • https://5ae74634.sqlmodel.pages.dev/img/advanced/migrations/migrations001.png - (before)
  • https://5ae74634.sqlmodel.pages.dev/img/advanced/migrations/migrations002.png - (before)
  • https://5ae74634.sqlmodel.pages.dev/img/advanced/migrations/migrations003.png - (before)

github-actions[bot] avatar Sep 07 '25 23:09 github-actions[bot]

📝 Docs preview for commit 2258c98c61cac9bbe25c4e2a487618496bd3c0d3 at: https://00e5a54e.sqlmodel.pages.dev

Modified Pages

  • https://00e5a54e.sqlmodel.pages.dev/advanced/migrations/ - (before)
  • https://00e5a54e.sqlmodel.pages.dev/img/advanced/migrations/migrations001.png - (before)
  • https://00e5a54e.sqlmodel.pages.dev/img/advanced/migrations/migrations002.png - (before)
  • https://00e5a54e.sqlmodel.pages.dev/img/advanced/migrations/migrations003.png - (before)

github-actions[bot] avatar Sep 07 '25 23:09 github-actions[bot]

Just as a maintenance note, https://github.com/fastapi/sqlmodel/pull/689 is a related PR.

svlandeg avatar Sep 17 '25 15:09 svlandeg

this is great, no external dependency required, should be able to merged to doc site

dheerapat avatar Oct 01 '25 12:10 dheerapat

@ezeparziale, thanks for your interest!

It's mentioned in the roadmap, that there is a plan to implement "Integrated migrations (using Alembic)". As I understand, the idea is not just use alembic directly, but implement a simpler interface for migrations.

#689 "Integrates" migrations into sqlmodel command, but, IMO, the configuration process can still be simplified more.

YuriiMotov avatar Oct 08 '25 21:10 YuriiMotov

It has been nearly two years since the roadmap proposed the integrated migration plan. Could we temporarily provide documentation on using Alembic for migration in the meantime?

hongfanmeng avatar Oct 10 '25 12:10 hongfanmeng

@YuriiMotov I understand that SQLModel will have it own "way" of doing a migration, but in the means time, it not harm for adding simple instruction to use Alembic with SQLModel in the doc. There is no code change in the core module.

dheerapat avatar Oct 14 '25 04:10 dheerapat