Browse Source

DDL for blacklist_keys

async_key_management
Volker Birk 7 years ago
parent
commit
f7d38661e7
2 changed files with 66 additions and 60 deletions
  1. +65
    -60
      src/pEpEngine.c
  2. +1
    -0
      src/pEp_internal.h

+ 65
- 60
src/pEpEngine.c View File

@ -20,6 +20,7 @@ DYNAMIC_API PEP_STATUS init(PEP_SESSION *session)
static const char *sql_least_trust;
static const char *sql_mark_as_compromized;
static const char *sql_crashdump;
static const char *sql_blacklist_keys;
bool in_first = false;
@ -94,66 +95,70 @@ DYNAMIC_API PEP_STATUS init(PEP_SESSION *session)
if (in_first) {
int_result = sqlite3_exec(
_session->db,
"create table if not exists version_info ("
" id integer primary key,"
" timestamp integer default (datetime('now')) ,"
" version text,"
" comment text"
");"
"create table if not exists log ("
" timestamp integer default (datetime('now')) ,"
" title text not null,"
" entity text not null,"
" description text,"
" comment text"
");"
"create index if not exists log_timestamp on log ("
" timestamp"
");"
"create table if not exists pgp_keypair ("
" fpr text primary key,"
" public_id text unique,"
" private_id text,"
" created integer,"
" expires integer,"
" comment text"
");"
"create index if not exists pgp_keypair_expires on pgp_keypair ("
" expires"
");"
"create table if not exists person ("
" id text primary key,"
" username text not null,"
" main_key_id text"
" references pgp_keypair (fpr)"
" on delete set null,"
" lang text,"
" comment text"
");"
"create table if not exists identity ("
" address text primary key,"
" user_id text"
" references person (id)"
" on delete cascade,"
" main_key_id text"
" references pgp_keypair (fpr)"
" on delete set null,"
" comment text"
");"
"create table if not exists trust ("
" user_id text not null"
" references person (id)"
" on delete cascade,"
" pgp_keypair_fpr text not null"
" references pgp_keypair (fpr)"
" on delete cascade,"
" comm_type integer not null,"
" comment text"
");"
"create unique index if not exists trust_index on trust ("
" user_id,"
" pgp_keypair_fpr"
");",
"create table if not exists version_info (\n"
" id integer primary key,\n"
" timestamp integer default (datetime('now')) ,\n"
" version text,\n"
" comment text\n"
");\n"
"create table if not exists log (\n"
" timestamp integer default (datetime('now')) ,\n"
" title text not null,\n"
" entity text not null,\n"
" description text,\n"
" comment text\n"
");\n"
"create index if not exists log_timestamp on log (\n"
" timestamp\n"
");\n"
"create table if not exists pgp_keypair (\n"
" fpr text primary key,\n"
" public_id text unique,\n"
" private_id text,\n"
" created integer,\n"
" expires integer,\n"
" comment text\n"
");\n"
"create index if not exists pgp_keypair_expires on pgp_keypair (\n"
" expires\n"
");\n"
"create table if not exists person (\n"
" id text primary key,\n"
" username text not null,\n"
" main_key_id text\n"
" references pgp_keypair (fpr)\n"
" on delete set null,\n"
" lang text,\n"
" comment text\n"
");\n"
"create table if not exists identity (\n"
" address text primary key,\n"
" user_id text\n"
" references person (id)\n"
" on delete cascade,\n"
" main_key_id text\n"
" references pgp_keypair (fpr)\n"
" on delete set null,\n"
" comment text\n"
");\n"
"create table if not exists trust (\n"
" user_id text not null\n"
" references person (id)\n"
" on delete cascade,\n"
" pgp_keypair_fpr text not null\n"
" references pgp_keypair (fpr)\n"
" on delete cascade,\n"
" comm_type integer not null,\n"
" comment text\n"
");\n"
"create unique index if not exists trust_index on trust (\n"
" user_id,\n"
" pgp_keypair_fpr\n"
");\n"
"create table if not exists blacklist_keys (\n"
" fpr text primary key\n"
");\n"
,
NULL,
NULL,
NULL


+ 1
- 0
src/pEp_internal.h View File

@ -97,6 +97,7 @@ typedef struct _pEpSession {
sqlite3_stmt *mark_compromized;
sqlite3_stmt *reset_trust;
sqlite3_stmt *crashdump;
sqlite3_stmt *blacklist_keys;
examine_identity_t examine_identity;
void *examine_management;


Loading…
Cancel
Save