On Sat, Nov 13, 2021 at 6:53 AM Ben Schmeckpeper <ben.schmeckpe...@gmail.com> wrote:
> Good morning. > > When querying a MySQL table's schema, I would like to know if a column has > ON UPDATE CURRENT_TIMESTAMP set. > > I found an earlier question where it was explained that MySQL's usage of > that syntax is non-standard and not supported for table creation, which I > understand. Would it be reasonable, though, to add this syntax to the > strings looked for in Extras when determining if a column is generated? > https://github.com/jeremyevans/sequel/blob/1afc503f591127755e5316cf2fbd12d9de12a85d/lib/sequel/adapters/shared/mysql.rb#L530 > > If not, and the desire is for the value of that generated field to only > match columns that can be created using the generated_always_as option, is > there another way to access the Extra data provided by MySQL, or would I > need to run the DESCRIBE query and parse the output myself? > I'll have to try out this feature and see how it works. If it always updates to the desired value, regardless of the value you put in, then having it as a generated column is fine. If it only updates by default, but will not override a value explicitly given during the update, then it isn't generated in the same way the other columns marked as generated are, and I don't think it would be a good idea to mix the two concepts. It is possible to expand the schema entries on MySQL to include an :extra key. It's also possible to expand table creation on MySQL to support ON UPDATE CURRENT TIMESTAMP. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CADGZSSfmtgFX_rB4C_Y%2Bk%2BtDxL9p7YmEkfiXHLk8NdUANh7sNA%40mail.gmail.com.