rmp135 / sql-ts

Generate TypeScript interfaces from a SQL database.
MIT License
477 stars 65 forks source link

"database" and "tables" attributes ignored in mysql.json #122

Closed tofsjonas closed 1 year ago

tofsjonas commented 1 year ago

It just grabs all the tables in all the databases. 😢

tofsjonas commented 1 year ago

No, wait!

It's just the example that is wrong!

{
  "client":"mysql",
  "connection": {
    "host": "localhost",
    "user": "user",
    "password": "password",
    "database" : "my_database"
  }
}

Should be:

{
  "client":"mysql",
  "connection": {
    "host": "localhost",
    "user": "user",
    "password": "password"
  },
   "database" : "my_database"
 }
rmp135 commented 1 year ago

Ah, MySQL disregards the database when we fetch table schema.

From my testing, placing it outside the connection block won't do anything. You want to use schemas: ["my_database"] to only fetch schema info from a particular database.

I'll update the docs to reflect this, thanks.

tofsjonas commented 1 year ago

You are right, placing it outside doesn't work for me either. Don't know why I thought it did 🤷

schemas: ["my_database"] works like a charm though!

Thanks! 🙏