sqlx-ts
sqlx-ts copied to clipboard
Types are not generated
I am having issues generating types from my project. I have successfully done it once, because I see a my-file.queries.ts file, however, I have tried deleting it again and rerunning: npx sqlx-ts ./src --config .sqlxrc.json - but nothing happens.
I have also tried running: cargo run ./src/index.ts --config .sqlxrc.json but that results in error: error: could not find Cargo.toml in /Users/mf/Projects/project or any parent directory
If I make a mistake the query, I will get an error, so it does indeed check the query, but it does not generate the types.
This is my config:
{
"generateTypes": {
"enabled": true
},
"connections": {
"default": {
"DB_TYPE": "postgres",
"DB_HOST": "localhost",
"DB_PORT": 26257,
"DB_USER": "root",
"DB_PASS": "passwd",
"DB_NAME": "defaultdb"
}
}
}
Running:
yarn run sqlx-ts $(pwd) --generate-types --config .sqlxrc.json
Works - from here: https://github.com/JasonShin/sqlx-ts/issues/81
Running: npx sqlx-ts ./src --config .sqlxrc.json --generate-types also works
I just released a small fix (thanks @Leo5878 ) in relation to scanning the project and cleaning the target --generate-path. Not sure if the fix is related to this
I will revisit this issue again soon
Nice, thanks for the update @JasonShin