Revert "Remove useless sql, fix admin.py"

This reverts commit cc728a73b45f980e7649e407c7ee4c5576acbfda.
fix admin
fix custom sql
fix addonuser duplicates