|
| 1 | +/* Copyright 2015 OpenMarket Ltd |
| 2 | + * |
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | + * you may not use this file except in compliance with the License. |
| 5 | + * You may obtain a copy of the License at |
| 6 | + * |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * |
| 9 | + * Unless required by applicable law or agreed to in writing, software |
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | + * See the License for the specific language governing permissions and |
| 13 | + * limitations under the License. |
| 14 | + */ |
| 15 | + |
| 16 | + |
| 17 | +CREATE TABLE IF NOT EXISTS new_server_keys_json ( |
| 18 | + server_name TEXT NOT NULL, -- Server name. |
| 19 | + key_id TEXT NOT NULL, -- Requested key id. |
| 20 | + from_server TEXT NOT NULL, -- Which server the keys were fetched from. |
| 21 | + ts_added_ms BIGINT NOT NULL, -- When the keys were fetched |
| 22 | + ts_valid_until_ms BIGINT NOT NULL, -- When this version of the keys exipires. |
| 23 | + key_json bytea NOT NULL, -- JSON certificate for the remote server. |
| 24 | + CONSTRAINT server_keys_json_uniqueness UNIQUE (server_name, key_id, from_server) |
| 25 | +); |
| 26 | + |
| 27 | +INSERT INTO new_server_keys_json |
| 28 | + SELECT server_name, key_id, from_server,ts_added_ms, ts_valid_until_ms, key_json FROM server_keys_json ; |
| 29 | + |
| 30 | +DROP TABLE server_keys_json; |
| 31 | + |
| 32 | +ALTER TABLE new_server_keys_json RENAME TO server_keys_json; |
0 commit comments