ksuid-ruby icon indicating copy to clipboard operation
ksuid-ruby copied to clipboard

Fix add_column and generator behavior for missing type

Open michaelherold opened this issue 2 years ago • 4 comments

When using add_column, the definition methods for ksuid and ksuid_binary are not used like when using table.ksuid since add_column creates the column directly.

This change makes it so any column definition can handle both ksuid and ksuid_binary correctly by monkey-patching the method that creates the column definitions.

It also makes it so rails generate model example:ksuid works as expected. I am unsure how fragile this test is. Ideally, we would have a test that runs the generator against a dummy app and asserts on the outcome, but I don't have the spoons to manage that right now.

Closes #48

michaelherold avatar Oct 21 '23 04:10 michaelherold

@DataDaoDe, care to give this a whirl to see if it fixes the issue?

michaelherold avatar Oct 21 '23 04:10 michaelherold

@michaelherold awesome. I'll check it out today.

DataDaoDe avatar Oct 21 '23 10:10 DataDaoDe

This fixed the add_column error but I'm still getting the error when trying to run rails generate model Event my_field_name:ksuid, which is Could not generate field 'my_field_name' with unknown type 'ksuid'.

DataDaoDe avatar Oct 21 '23 13:10 DataDaoDe

Rats, I have a fix but it only works for 7.0+. I'd like to still support 6.1 so need to muddle some more. It's almost like monkey-patching Rails is a bad idea! 😅

michaelherold avatar Oct 24 '23 03:10 michaelherold