1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231

content / test / data / interest_group / schemaV6.sql [blame]

PRAGMA foreign_keys = OFF;

BEGIN TRANSACTION;

CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);

INSERT INTO meta VALUES ('mmap_status', '-1');
INSERT INTO meta VALUES ('version', '6');
INSERT INTO meta VALUES ('last_compatible_version', '6');

CREATE TABLE interest_groups(
  expiration INTEGER NOT NULL,
  last_updated INTEGER NOT NULL,
  next_update_after INTEGER NOT NULL,
  owner TEXT NOT NULL,
  joining_origin TEXT NOT NULL,
  name TEXT NOT NULL,
  joining_url TEXT NOT NULL,
  bidding_url TEXT NOT NULL,
  bidding_wasm_helper_url TEXT NOT NULL,
  update_url TEXT NOT NULL,
  trusted_bidding_signals_url TEXT NOT NULL,
  trusted_bidding_signals_keys TEXT NOT NULL,
  user_bidding_signals TEXT,
  ads TEXT NOT NULL,
  ad_components TEXT NOT NULL,
  PRIMARY KEY(owner, name));

INSERT INTO interest_groups
VALUES
  (
    13293932603076872,
    13291340603081533,
    -9223372036854775808,
    'https://owner.example.com',
    'https://publisher.example.com',
    'groupNullUserBiddingSignals',
    'https://publisher.example.com/page1.html',
    'https://owner.example.com/bidder.js',
    '',
    'https://owner.example.com/update',
    'https://owner.example.com/signals',
    '["groupNullUserBiddingSignals"]',
    NULL,
    '[{"metadata":"[\"4\",\"5\",null,\"6\"]","url":"https://ads.example.com/1"}]',
    '');

INSERT INTO interest_groups
VALUES
  (
    13293932603076872,
    13291340603081533,
    -9223372036854775808,
    'https://owner.example.com',
    'https://publisher.example.com',
    'group1',
    'https://publisher.example.com/page1.html',
    'https://owner.example.com/bidder.js',
    '',
    'https://owner.example.com/update',
    'https://owner.example.com/signals',
    '["group1"]',
    '[["1","2"]]',
    '[{"metadata":"[\"4\",\"5\",null,\"6\"]","url":"https://ads.example.com/1"}]',
    '');

INSERT INTO interest_groups
VALUES
  (
    13293932603080090,
    13291340603089914,
    -9223372036854775808,
    'https://owner.example.com',
    'https://publisher.example.com',
    'group2',
    'https://publisher.example.com/page2.html',
    'https://owner.example.com/bidder.js',
    '',
    'https://owner.example.com/update',
    'https://owner.example.com/signals',
    '["group2"]',
    '[["1","3"]]',
    '[{"metadata":"[\"4\",\"5\",null,\"6\"]","url":"https://ads.example.com/1"}]',
    '');

INSERT INTO interest_groups
VALUES
  (
    13293932603052561,
    13291340603098283,
    -9223372036854775808,
    'https://owner.example.com',
    'https://publisher.example.com',
    'group3',
    'https://publisher.example.com/page3.html',
    'https://owner.example.com/bidder.js',
    '',
    'https://owner.example.com/update',
    'https://owner.example.com/signals',
    '["group3"]',
    '[["3","2"]]',
    '[{"metadata":"[\"4\",\"5\",null,\"6\"]","url":"https://ads.example.com/1"}]',
    '');

CREATE TABLE kanon(
  last_referenced_time INTEGER NOT NULL,
  type INTEGER NOT NULL,
  key TEXT NOT NULL,
  k_anon_count INTEGER NOT NULL,
  last_k_anon_updated_time INTEGER NOT NULL,
  last_reported_to_anon_server_time INTEGER NOT NULL,
  PRIMARY KEY(type, key));

INSERT INTO kanon
VALUES
  (
    13291340603098283,
    3,
    'https://ads.example.com/1',
    0,
    -9223372036854775808,
    -9223372036854775808);

INSERT INTO kanon
VALUES
  (
    13291340603089914,
    1,
    'https://owner.example.com/group2',
    0,
    -9223372036854775808,
    -9223372036854775808);

INSERT INTO kanon
VALUES
  (
    13291340603098283,
    2,
    'https://owner.example.com/update',
    0,
    -9223372036854775808,
    -9223372036854775808);

INSERT INTO kanon
VALUES
  (
    13291340603081533,
    1,
    'https://owner.example.com/group1',
    0,
    -9223372036854775808,
    -9223372036854775808);

INSERT INTO kanon
VALUES
  (
    13291340603098283,
    1,
    'https://owner.example.com/group3',
    0,
    -9223372036854775808,
    -9223372036854775808);

CREATE TABLE join_history(
  owner TEXT NOT NULL, name TEXT NOT NULL, join_time INTEGER NOT NULL,
  FOREIGN KEY(owner, name) REFERENCES interest_groups);

INSERT INTO join_history VALUES ('https://owner.example.com', 'group2', 13291340064197574);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group1', 13291340064205914);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group3', 13291340064214052);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group3', 13291340515442940);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group1', 13291340515453832);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group2', 13291340515462085);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group2', 13291340515470175);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group1', 13291340515478159);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group3', 13291340515486493);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group2', 13291340603053960);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group1', 13291340603072942);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group1', 13291350603081533);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group2', 13291350603089914);
INSERT INTO join_history VALUES ('https://owner.example.com', 'group3', 13291350603098283);

CREATE TABLE bid_history(
  owner TEXT NOT NULL, name TEXT NOT NULL, bid_time INTEGER NOT NULL,
  FOREIGN KEY(owner, name) REFERENCES interest_groups);

INSERT INTO bid_history VALUES ('https://owner.example.com', 'group3', 13291340515442940);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group1', 13291340515453832);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group2', 13291340515470175);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group1', 13291340515478159);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group3', 13291340515486493);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group2', 13291350603053960);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group3', 13291350603064576);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group1', 13291350603072942);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group1', 13291350603081533);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group2', 13291350603089914);
INSERT INTO bid_history VALUES ('https://owner.example.com', 'group3', 13291350603098283);

CREATE TABLE win_history(
  owner TEXT NOT NULL, name TEXT NOT NULL, win_time INTEGER NOT NULL, ad TEXT NOT NULL,
  FOREIGN KEY(owner, name) REFERENCES interest_groups);

CREATE
  INDEX interest_group_expiration
ON interest_groups(expiration DESC, owner, name);

CREATE
  INDEX interest_group_owner
ON interest_groups(owner, expiration DESC);

CREATE
  INDEX interest_group_joining_origin
ON interest_groups(joining_origin, expiration DESC, owner, name);

CREATE
  INDEX kanon_last_referenced_time
ON kanon(last_referenced_time DESC);

CREATE
  INDEX join_history_index
ON join_history(owner, name, join_time);

CREATE
  INDEX bid_history_index
ON bid_history(owner, name, bid_time);

CREATE
  INDEX win_history_index
ON win_history(owner, name, win_time DESC);

COMMIT;