Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing support for INHERITS #533

Open
ian-weir opened this issue Feb 12, 2024 · 1 comment
Open

Missing support for INHERITS #533

ian-weir opened this issue Feb 12, 2024 · 1 comment

Comments

@ian-weir
Copy link

When using the INHERITS functionality in a database the generated types to not reflect this inheritence. Using the example from the Postgresql documentation:

CREATE TABLE cities (
    name            text,
    population      float,
    elevation       int     -- in feet
);

CREATE TABLE capitals (
    state           char(2)
) INHERITS (cities);

Kanel would output something like:

//Cities.ts
export default interface Cities {
  name: string;
  population: number;
  elevation: number;
}

//Capitals.ts
export default interface Capitals {
  state: string;
}

Which doesn't correctly represent the model of the database. The correct output would look like:

//Capitals.ts
export default interface Capitals extends Cities {
  state: string;
}

I really like the rest of the way Kanel behaves but this is sadly a blocker from me using it at work :(

@kristiandupont
Copy link
Owner

Ah yes, I can see that this is a missing feature. I will need to add support for inheritance to extract-pg-schema for this to be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants