schemats: Unsafe table names generate invalid ts file

If we have table names that, on the db side, need to be quoted, the generated type names end up being invalid typescript names. Not certain what the ideal end result should be, but just figured this was worth documenting.

for instance:

CREATE TABLE "has spaces" (id int not null);
CREATE TABLE "has-dashes" (id int not null);

Produces

export namespace has spacesFields {
  export type id = number;
}
export interface has spaces {
  id: has spacesFields.id;
}
export namespace has-dashesFields {
  export type id = number;
}
export interface has-dashes {
  id: has-dashes.id;
}

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

In that case, why not create a schemats organization and fork it from there. There was a steady growth of users (whether it’s from CI or not), so there’s some merits to having it become maintained again.

I still have access to the npm registry so transition for the users should be smooth

image

I’d also be happy to contribute to a new maintained fork in the future.

(@HoldYourWaffle – your CC PR was a great start to some really helpful things that we’ve been able to do internally, so I suppose I owe you a great deal of thanks!)