[3.9] Add UserQuery entity

- [x] Add UserQuery entity
- [x] Make migration script