update analytics queries

This commit is contained in:
Brandon Thomas committed 2024-05-20 20:00:57 -04:00
1 parent 98f1e20bdd
commit 11e2921b63
2 files changed
+15

No files matched your search

@@ -0,0 +1,15 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Find users with studio flags.
select username from users where maybe_feature_flags like '%studio%';
-- Sync the top-level boolean with the authoritative feature flags field.
-- Performs a full table scan and string search, but is relatively quick.
-- NB: Can't use users in the subquery:
-- ERROR 1093 (HY000): You can't specify target table 'users' for update in FROM clause
UPDATE users u INNER JOIN users uf
ON u.token = uf.token
SET u.can_access_studio = true
WHERE uf.maybe_feature_flags like '%studio%';