|
| 1 | +// This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | +// License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | +// file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 | + |
| 5 | +syntax = "proto3"; |
| 6 | + |
| 7 | +package typedb.protocol; |
| 8 | + |
| 9 | +import "proto/concept.proto"; |
| 10 | + |
| 11 | +message Migration { |
| 12 | + message Export { |
| 13 | + message Req { |
| 14 | + string name = 1; |
| 15 | + } |
| 16 | + |
| 17 | + message Server { |
| 18 | + oneof server { |
| 19 | + InitialRes initial_res = 1; |
| 20 | + ResPart res_part = 2; |
| 21 | + Done done = 3; |
| 22 | + } |
| 23 | + } |
| 24 | + |
| 25 | + message InitialRes { |
| 26 | + string schema = 1; |
| 27 | + } |
| 28 | + |
| 29 | + message ResPart { |
| 30 | + repeated Item items = 1; |
| 31 | + } |
| 32 | + |
| 33 | + message Done {} |
| 34 | + } |
| 35 | + |
| 36 | + message Import { |
| 37 | + message Client { |
| 38 | + oneof client { |
| 39 | + InitialReq initial_req = 1; |
| 40 | + ReqPart req_part = 2; |
| 41 | + Done done = 3; |
| 42 | + } |
| 43 | + |
| 44 | + message InitialReq { |
| 45 | + string name = 1; |
| 46 | + string schema = 2; |
| 47 | + } |
| 48 | + |
| 49 | + message ReqPart { |
| 50 | + repeated Item items = 1; |
| 51 | + } |
| 52 | + |
| 53 | + message Done { } |
| 54 | + } |
| 55 | + |
| 56 | + message Server { |
| 57 | + Done done = 1; |
| 58 | + |
| 59 | + message Done { } |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + // _ _____ _____ _____ _ _ _____ ___ ___ _ _ _ |
| 64 | + // / \|_ _|_ _| ____| \ | |_ _|_ _/ _ \| \ | | | |
| 65 | + // / _ \ | | | | | _| | \| | | | | | | | | \| | | |
| 66 | + // / ___ \| | | | | |___| |\ | | | | | |_| | |\ |_| |
| 67 | + // /_/ \_\_| |_| |_____|_| \_| |_| |___\___/|_| \_(_) |
| 68 | + // |
| 69 | + // ATTENTION: the messages below are used to import multiple versions of TypeDB. |
| 70 | + // DO NOT reorder or delete existing and reserved indices. Be careful while extending this. |
| 71 | + // |
| 72 | + |
| 73 | + message Item { |
| 74 | + oneof item { |
| 75 | + Attribute attribute = 1; |
| 76 | + Entity entity = 2; |
| 77 | + Relation relation = 3; |
| 78 | + |
| 79 | + Header header = 15; |
| 80 | + Checksums checksums = 16; |
| 81 | + } |
| 82 | + |
| 83 | + message Entity { |
| 84 | + string id = 1; |
| 85 | + string label = 2; |
| 86 | + repeated OwnedAttribute attributes = 3; |
| 87 | + } |
| 88 | + |
| 89 | + message Attribute { |
| 90 | + string id = 1; |
| 91 | + string label = 2; |
| 92 | + repeated OwnedAttribute attributes = 3; // empty in 3.x, used for backwards compatibility |
| 93 | + MigrationValue value = 4; |
| 94 | + } |
| 95 | + |
| 96 | + message Relation { |
| 97 | + string id = 1; |
| 98 | + string label = 2; |
| 99 | + repeated OwnedAttribute attributes = 3; |
| 100 | + repeated Role roles = 4; |
| 101 | + message Role { |
| 102 | + string label = 1; |
| 103 | + repeated Player players = 2; |
| 104 | + message Player { |
| 105 | + string id = 1; |
| 106 | + } |
| 107 | + } |
| 108 | + } |
| 109 | + |
| 110 | + message OwnedAttribute { |
| 111 | + string id = 1; |
| 112 | + } |
| 113 | + |
| 114 | + message Header { |
| 115 | + string typedb_version = 1; |
| 116 | + string original_database = 2; |
| 117 | + } |
| 118 | + |
| 119 | + message Checksums { |
| 120 | + int64 entity_count = 1; |
| 121 | + int64 attribute_count = 2; |
| 122 | + int64 relation_count = 3; |
| 123 | + int64 role_count = 4; |
| 124 | + int64 ownership_count = 5; |
| 125 | + reserved 6; // was deleted and cannot be used until a breaking change occurs |
| 126 | + } |
| 127 | + } |
| 128 | + |
| 129 | + message MigrationValue { |
| 130 | + oneof value { |
| 131 | + string string = 1; |
| 132 | + bool boolean = 2; |
| 133 | + int64 integer = 3; |
| 134 | + double double = 4; |
| 135 | + int64 datetime_millis = 5; // compatibility with 2.x, milliseconds since epoch |
| 136 | + Value.Decimal decimal = 6; |
| 137 | + Value.Date date = 8; |
| 138 | + Value.Datetime datetime = 9; |
| 139 | + Value.Datetime_TZ datetime_tz = 10; |
| 140 | + Value.Duration duration = 11; |
| 141 | + Value.Struct struct = 12; |
| 142 | + } |
| 143 | + } |
| 144 | +} |
0 commit comments