BTW, I write a test for show this issue. https://github.com/zw963/marketbet_crawler/compare/090349f..HEAD?w=1
Current test is passed, work as expected. but if revert to use DB.run, test is failing. this project clear enough, i consider it can be serve as a example. DB config is here: https://github.com/zw963/marketbet_crawler/blob/master/config/db.rb Model config is here: https://github.com/zw963/marketbet_crawler/blob/master/config/model.rb All relative migration is here: https://github.com/zw963/marketbet_crawler/blob/master/db/migrations/20211112143230_add_zhparser_extension.rb https://github.com/zw963/marketbet_crawler/blob/master/db/migrations/20211112143437_add_stored_generated_column_to_investing_latest_news.rb run test should just work after ```sh $: bundle install $: RACK_ENV=test rake db:create $: RACK_ENV=test rake db:migrate m test/services/retrieve_investing_latest_news_test.rb ``` 在2021年11月20日星期六 UTC+8 下午12:27:36<Billy Zheng> 写道: > Okay, i will do more research with add a trigger for find out this issue > caused by UPDATE statement invalid, or just stored generated column not > updated when do UPDATE, even, DB.run not works with Roda request? > > will be in touch, thanks > > > 在2021年11月20日星期六 UTC+8 上午1:38:06<Jeremy Evans> 写道: > >> On Fri, Nov 19, 2021 at 9:05 AM Billy Zheng <vil...@gmail.com> wrote: >> >>> Okay, i update my code, like this: >>> >>> ``` >>> r.is 'add-ts-keyword' do >>> new_keyword = r.params['new_keyword'] >>> >>> if new_keyword.present? >>> DB.run(Sequel.lit("INSERT INTO zhparser.zhprs_custom_word >>> values(?) ON CONFLICT DO NOTHING;", new_keyword)) >>> end >>> >>> r.redirect request.referrer >>> end >>> >>> r.is 'remove-ts-keyword' do >>> keyword = r.params['keyword'] >>> >>> if keyword.present? >>> DB.run(Sequel.lit("DELETE FROM zhparser.zhprs_custom_word >>> WHERE word=?;", keyword)) >>> end >>> >>> r.redirect request.referrer >>> end >>> >>> r.is 'sync-ts-keyword' do >>> DB.run("SELECT sync_zhprs_custom_word();") >>> DB.run("UPDATE investing_latest_news SET title = title, preview >>> = preview;") >>> r.redirect request.referrer >>> end >>> ``` >>> >>> But it still not work. >>> >>> For describe my issue, i record a video, and upload here. >>> >>> >>> https://raw.githubusercontent.com/zw963/zw963.github.io/master/files/1.mp4 >>> >>> Could you please check? >>> >>> >>> > UPDATE just sets columns to their current value, so it will only have >>> an effect if there are triggers or something similar in play. >>> >>> As you can see in the video, the first time, i add "美元“ token into >>> parser, the UPDATE statement works, but then after i remove add from parser, >>> the UPDATE not work anymore, and finally, when i UPDATE from >>> bin/console, it works again. >>> >> >> Sorry, I don't have time to watch vidoes. This is a Sequel help form, so >> if you think there is a problem, please post a minimal self contained >> example showing it using just Sequel, with no other libraries. >> >> 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/59c68f0b-7255-42eb-8635-3fc472e4dfd2n%40googlegroups.com.