changes to database ddl

added viewed column to alerts table, cleaned up errors in create table
ddl that resulted from the change.