src/update.sql
author Roker <roker@pep-project.org>
Tue, 20 Sep 2016 15:54:57 +0200
branchroker-linux
changeset 1168 4d4e3ecbaf8b
parent 11 3ac4c77f987a
permissions -rw-r--r--
merge "default" into my branch
     1 create table trust (
     2    user_id text references person (id) on delete cascade,
     3    pgp_keypair_fpr text references pgp_keypair (fpr) on delete cascade,
     4    comm_type integer not null,
     5    comment text
     6 );
     7 
     8 create unique index trust_index on trust (
     9    user_id,
    10    pgp_keypair_fpr
    11 );
    12 
    13 insert into trust (user_id, pgp_keypair_fpr, comm_type)
    14     select user_id, main_key_id, comm_type from identity;
    15 
    16 alter table identity rename to identity_old;
    17 
    18 create table identity (
    19     address text primary key,
    20     user_id text
    21         references person (id)
    22         on delete cascade,
    23     main_key_id text
    24         references pgp_keypair (fpr)
    25         on delete set null,
    26     comment text
    27 );
    28 
    29 insert into identity (address, user_id, main_key_id)
    30     select address, user_id, main_key_id from identity_old;
    31 
    32 drop table identity_old;