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

Add capability for typescript type gen to reference table row types #533

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

joeally
Copy link
Contributor

@joeally joeally commented Mar 11, 2023

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

In the situation where we have a view in which one of the columns has the row type of a table, unknown is generated for that column.

e.g

CREATE VIEW rows_with_user_view AS (
  SELECT *, users as user FROM rows
  INNER JOIN users on rows.user_id = user.id
);

Currently results in the following generation

{
...
  public: {
    ...
    Views: {
      rows_with_user_view: {
        Row: {
          ...
          user: unknown
        }
      }
    }
    ...
  }
...
}

What is the new behavior?

Instead types should be generated in the following form

{
...
  public: {
    ...
    Views: {
      rows_with_user_view: {
        Row: {
          ...
          user: Database["public"]["Tables"]["users"]["Row"]
        }
      }
    }
    ...
  }
...
}

@joeally joeally requested a review from a team as a code owner March 11, 2023 12:29
@joeally joeally requested a review from a team as a code owner March 13, 2024 07:36
Copy link
Member

@soedirgo soedirgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry this took a year to get to.

@soedirgo soedirgo merged commit 2ddd618 into supabase:master Mar 13, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants