Skip to content

Missing Typescript Type - PostgreSQL Data Types #681

@NicolasB-Pro

Description

@NicolasB-Pro

Hello i'm having a little issue with Postgre Data Types with Sequelize Auto.

I'm not sure if it's a bug or a misunderstanding on my part.

My versions :

Node: v24.13.0

"pg": "8.18.0",
"pg-hstore": "2.3.4",
"sequelize": "6.37.7",
"sequelize-auto": "0.8.8",

In my database I have something in my sql around these lines (simplified for clarity) :

CREATE TYPE myschema.valid_tier_values AS ENUM('S','A+','A','B');

CREATE TYPE myschema.tier AS (
    tier myschema.valid_tier_values,
    warning BOOLEAN,
    comment TEXT,
);

CREATE TABLE IF NOT EXISTS myschema.votes(
    id SERIAL PRIMARY KEY,
    first_vote tier,
    second_vote tier,
    last_vote tier
);

The SQL seems good and is used.

My sequelize-auto CLI command is something like that :

npx sequelize-auto -o './libs/models' -d default_database -h localhost -u myfakeuser -p 15432 -x myfakepassword -e postgres -l ts --cp c --cf c --cm c --sg

When I use the CLI, the result ends with :

Missing TypeScript type: tier 
Missing TypeScript type: tier 
Missing TypeScript type: tier 
Missing TypeScript type: tier 
Done!

and my generated interface & model are like this :

export interface votesAttributes {
  id: number;
  firstVote?: any;
  secondVote?: any;
  lastVote?: any;
}

export class votes [...] implements votesAttributes  {
  id!: number;
  firstVote?: any;
  secondVote?: any;
  lastVote?: any;
}

Is there a way to have a nice type instead of any here ?
( Also is there a simple parameter to have one folder per schema ? Or should I do it with two CLI commands ? )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions