src/update.sql
author Edouard Tisserant <edouard@pep-project.org>
Thu, 15 Jun 2017 11:35:44 +0200
branchtest_diphoton
changeset 1860 1975a3b9bc37
parent 11 3ac4c77f987a
permissions -rw-r--r--
Merge default in test_diphoton
     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;