Add user classes to the database.

You may want to test this further on a dev machine as breaking the db on prod could be a disaster. Use the following commands to change the schema on an existing db.

CREATE TYPE UserClass AS ENUM (‘user’, ‘moderator, ‘admin’);

ALTER TABLE ONLY users ADD COLUMN class UserClass DEFAULT ‘user’ NOT NULL;
UPDATE users SET class = ‘admin’ where username = 'Eric';

CREATE OR REPLACE VIEW users_view AS
 SELECT u.id,
    u.created,
    u.username,
    u.email,
    u.password,
    u.balance_satoshis,
    ( SELECT max(giveaways.created) AS max
           FROM giveaways
          WHERE (giveaways.user_id = u.id)) AS last_giveaway,
    u.class
   FROM users u;