2024-12-27 22:05:15 +00:00
|
|
|
# [WIP] sqlxgentools
|
|
|
|
|
2024-12-28 18:56:04 +00:00
|
|
|
better name: sqlitexgentools, sqlitexgen
|
|
|
|
|
2024-12-27 22:05:15 +00:00
|
|
|
Tools to generate SQL migrations and Rust SQLx repositories code from models structs in a SQLite context.
|
|
|
|
|
|
|
|
Will be used in [minauthator](https://forge.lefuturiste.fr/mbess/minauthator).
|
|
|
|
|
|
|
|
## Project context
|
|
|
|
|
|
|
|
### Goals
|
|
|
|
|
|
|
|
- Help developers that dont use ORM and use SQLx in a Rust project with a SQLite DB.
|
|
|
|
- Auto generate boilerplate repositories pattern code
|
|
|
|
- Auto generate CREATE TABLE base migrations from model struct
|
|
|
|
- Auto generate Up and Down migrations
|
|
|
|
- Let developer have flexibility over the model definition
|
|
|
|
|
|
|
|
### Non-goals
|
|
|
|
|
|
|
|
- Provide a full a ORM interface
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Generate initial CREATE TABLE sqlite migration
|
|
|
|
|
|
|
|
cargo run --bin sqlx-generator -- ./path/to/project generate-create-migrations > migrations/all.sql
|
|
|
|
|
|
|
|
### Generate repositories code
|
|
|
|
|
|
|
|
not implemented yet
|
|
|
|
|
|
|
|
cargo run --bin sqlx-generator -- ./path/to/project generate-repositories
|