notebooks: set default pattern type to keyword#63662
Conversation
Relates to https://github.com/sourcegraph/sourcegraph/pull/63472 This changes the default patternType of Notebooks from "standard" to "keyword". The migration introduced in https://github.com/sourcegraph/sourcegraph/pull/63472 sets all *existing* Notebooks to pattern type "standard". The migration of this PR will cause all *new* Notebooks to use "keyword". Test plan: I ran the migration locally a verified that new notebooks use "keyword" as default.
jtibshirani
left a comment
There was a problem hiding this comment.
Makes sense! Just musing: I prefer to handle default logic at the application layer, so you don't need a database migration to change it. I feel it's more obvious to newcomers too (we don't usually think to look at the schema layer for important application logic).
I see we already use postgres SET DEFAULT in other places, and my opinion may be the minority, so no need to change anything for this PR!
I see what you mean and you are right, we could do it all on the application layer. However, the approach of storing the default pattern type in the db was a hack to keep the overall code changes to a minimum. Additionally, in this case, I think having a default enforced by the db is nice, because it guarantees a valid "state" of the notebook. The client relies on the backend to always send the pattern type. We could build this guarantee into the application layer of course but it seems much cleaner to do it with the db. And, maybe the most important point. This is something we don't change very often, and in the case of Notebooks, probably never (famous last words ;-)). |
Relates to https://github.com/sourcegraph/sourcegraph/pull/63472
This changes the default patternType of Notebooks from "standard" to "keyword". As a consequence, all new notebooks will default to keyword search. Existing notebooks will keep using standard search.
Test plan: