Allow precompile assets without opening db connection

Related to #3688 hopefully fix it

I think that `LIKE` constant in frontend is legacy code, it's not used anywhere now. But in case it is we could add a `self.connected?` there too to check if a db connection was opened.