DROP VIEW pptpusers;
BEGIN;
drop view v_my_account;
alter table contact add column tmp varchar(40);
update contact set tmp = '' where tmp IS NULL;
alter table contact alter column tmp set not null;
alter table contact alter column tmp set default '';
update contact set tmp = password where password IS NOT NULL;
update contact set tmp = '' where password IS NULL;
alter table contact drop column password ;
alter table contact rename column tmp to password;
CREATE VIEW v_my_account AS
SELECT *
   FROM contact
  WHERE contact.username::name = "current_user"();
GRANT SELECT, UPDATE ON v_my_account TO GROUP astium_users;
COMMIT;
