sqlx-ts icon indicating copy to clipboard operation
sqlx-ts copied to clipboard

Types are not generated

Open simplenotezy opened this issue 1 year ago • 2 comments

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"
    }
  }
}

simplenotezy avatar Apr 09 '24 10:04 simplenotezy

Running:

yarn run sqlx-ts $(pwd) --generate-types --config .sqlxrc.json

Works - from here: https://github.com/JasonShin/sqlx-ts/issues/81

simplenotezy avatar Apr 09 '24 10:04 simplenotezy

Running: npx sqlx-ts ./src --config .sqlxrc.json --generate-types also works

simplenotezy avatar Apr 09 '24 10:04 simplenotezy

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

JasonShin avatar Jun 10 '24 01:06 JasonShin

Nice, thanks for the update @JasonShin

simplenotezy avatar Jun 12 '24 12:06 simplenotezy