mysql-schema-ts icon indicating copy to clipboard operation
mysql-schema-ts copied to clipboard

[IDEA] Add schema type output

Open elderapo opened this issue 3 years ago • 2 comments

Besides generating T & TWithDefault, generate schema type/interface like this:

export type Schema = { // this name could contain database name mby?
  user: { normal: User; withDefaults: UserWithDefaults }; // key being table name, value could be a tuple [T, TWithDefaults] - no preference
  movie: { normal: Movie; withDefaults: MovieWithDefaults }
};

so its output can be easily consumed by some query builders that require database schema to work on (ex. kysely).

elderapo avatar Dec 13 '21 23:12 elderapo

That's a pretty neat idea! I would be down to approve a PR :)

nettofarah avatar Dec 14 '21 00:12 nettofarah

Any preference between object (or maybe other keys?) vs tuple approach?

elderapo avatar Dec 14 '21 00:12 elderapo