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

Move the schema field from database to table model #44

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

tjdammann
Copy link
Contributor

Moves the schema field from the database model to the table model, enabling cross-schema queries.

The database will need to be migrated to update to the new version with the schema removed.

@tjdammann tjdammann requested a review from tevonsb April 11, 2024 00:16
Copy link
Contributor

@glpierce glpierce left a comment

Choose a reason for hiding this comment

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

1 question, otherwise LGTM

Comment on lines -25 to -36
if (column.table === "aggregate") {
return column.name;
}

// If the column was added via relation, prefix it with the relation name
if (column.relation) {
return `${column.relation.as}__${column.name}`;
}

// Otherwise, prefix it with its base table name
const table = _.find(tables, (table) => table.id === column.table);
assert(table, `Table not found: ${column.table}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not need this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's been moved into a utils function (generateColumnName) since it's used in a bunch of places!

@tjdammann tjdammann merged commit 23b91db into grant/bru-1077 Apr 11, 2024
2 checks passed
@tjdammann tjdammann deleted the tyler/move-schema-to-tables branch April 11, 2024 00:33
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