Skip to content

Add column helper#541

Closed
hfhbd wants to merge 4 commits into
masterfrom
hfhbd/columnHelper
Closed

Add column helper#541
hfhbd wants to merge 4 commits into
masterfrom
hfhbd/columnHelper

Conversation

@hfhbd

@hfhbd hfhbd commented Aug 4, 2023

Copy link
Copy Markdown
Collaborator

}
}

fun SqlColumnName.getColumnDefOrNull(): SqlColumnDef? {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it's a little more nuanced then this, since columns can come from an alter table statement

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm also pretty sure this is already done elsewhere in code quite a bit (going from column name to column def)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, you are right. Also added a test for alter table.

@hfhbd
hfhbd force-pushed the hfhbd/columnHelper branch from f6a9b76 to aea3f16 Compare August 4, 2023 11:28
}
}

fun SqlColumnDef.isForeignKey(): Boolean {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

After thinking again, this won't work in sqldelight with the mysql dialect supporting ALTER TABLE DROP FOREIGN KEY because this isn't a SqlColumnDef... I guess the only option is to put the keys into the schema too 🤔

@hfhbd hfhbd closed this Nov 5, 2023
@hfhbd
hfhbd deleted the hfhbd/columnHelper branch November 5, 2023 14:45
@alexpuchau-lendable

Copy link
Copy Markdown

@hfhbd Why was this PR closed? I still cannot drop foreign keys :-/

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.

3 participants