src/update.sql
changeset 1 06e02338bdd8
child 11 3ac4c77f987a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/update.sql	Wed Jun 25 18:46:19 2014 +0200
     1.3 @@ -0,0 +1,33 @@
     1.4 +create table trust (
     1.5 +   user_id text references person (id) on delete cascade,
     1.6 +   pgp_keypair_fpr text references pgp_keypair (fpr) on delete cascade,
     1.7 +   comm_type integer not null,
     1.8 +   comment text
     1.9 +);
    1.10 +
    1.11 +create unique index trust_index on trust (
    1.12 +   user_id,
    1.13 +   pgp_keypair_fpr
    1.14 +);
    1.15 +
    1.16 +insert into trust (user_id, pgp_keypair_fpr, comm_type)
    1.17 +    select user_id, main_key_id, comm_type from identity;
    1.18 +
    1.19 +alter table identity rename to identity_old;
    1.20 +
    1.21 +create table identity (
    1.22 +	address text primary key,
    1.23 +	user_id text
    1.24 +		references person (id)
    1.25 +		on delete cascade,
    1.26 +	main_key_id text
    1.27 +		references pgp_keypair (fpr)
    1.28 +		on delete set null,
    1.29 +	comment text
    1.30 +);
    1.31 +
    1.32 +insert into identity (address, user_id, main_key_id)
    1.33 +    select address, user_id, main_key_id from identity_old;
    1.34 +
    1.35 +drop table identity_old;
    1.36 +