src/update.sql
author Krista Bennett <krista@pep-project.org>
Tue, 14 Aug 2018 13:45:34 +0200
branchENGINE-451
changeset 2826 07c080d73a63
parent 11 3ac4c77f987a
permissions -rw-r--r--
ENGINE-451: abandoning branch - config files to be dealt with using gpgme (and hotfix will be external to engine
     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;