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

Reduce duplication between CREATE TABLE and ADD COLUMN SQL conversion #562

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

andrew-farries
Copy link
Collaborator

There is a lot of duplication between the CREATE TABLE and ALTER TABLE ADD COLUMN conversion code.

Reduce the duplication by having the ALTER TABLE ADD COLUMN conversion code and the CREATE TABLE conversion code use the same convertColumnDef function, which handles the conversion of a column definition to a migrations.Column struct along with the conversion of the column constraints.

@andrew-farries andrew-farries added the sql2pgroll Issues relating to the sql2pgroll package label Dec 20, 2024
@andrew-farries andrew-farries marked this pull request as ready for review December 20, 2024 12:36
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from 6637821 to 19aff38 Compare January 2, 2025 09:09
@andrew-farries andrew-farries force-pushed the reduce-duplication-create-table-add-column branch from 2b40b5b to 243f01a Compare January 2, 2025 09:09
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from 19aff38 to cef3018 Compare January 2, 2025 09:15
@andrew-farries andrew-farries force-pushed the reduce-duplication-create-table-add-column branch from 243f01a to 8e57056 Compare January 2, 2025 09:15
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from cef3018 to f03b847 Compare January 2, 2025 09:20
@andrew-farries andrew-farries force-pushed the reduce-duplication-create-table-add-column branch from 8e57056 to a6df553 Compare January 2, 2025 09:20
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from f03b847 to 48ea17e Compare January 2, 2025 09:27
@andrew-farries andrew-farries force-pushed the reduce-duplication-create-table-add-column branch from a6df553 to b6a5ce1 Compare January 2, 2025 09:27
Base automatically changed from change-create-table-default-constraint-handling to main January 2, 2025 09:31
There is a lot of duplication between the `CREATE TABLE` and `ALTER
TABLE ADD COLUMN` conversion code.

Reduce the duplication by having the ALTER TABLE ADD COLUMN conversion
code and the CREATE TABLE conversion code use the same
`convertColumnDef` function, which handles the conversion of a column
definition to a `migrations.Column` struct along with the conversion of
the column constraints.
@andrew-farries andrew-farries force-pushed the reduce-duplication-create-table-add-column branch from b6a5ce1 to 64c12ab Compare January 2, 2025 09:32
@andrew-farries andrew-farries merged commit 829586e into main Jan 2, 2025
28 checks passed
@andrew-farries andrew-farries deleted the reduce-duplication-create-table-add-column branch January 2, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql2pgroll Issues relating to the sql2pgroll package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants