github.com/dolthub/dolt/go@v0.40.5-0.20240520175717-68db7794bea6/serial/schema.fbs (about) 1 // Copyright 2021 Dolthub, Inc. 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 include "encoding.fbs"; 16 include "collation.fbs"; 17 18 namespace serial; 19 20 21 table TableSchema { 22 columns:[Column] (required); 23 clustered_index:Index (required); 24 secondary_indexes:[Index]; 25 checks:[CheckConstraint]; 26 collation:Collation; 27 28 // this field is necessary because older dolt clients weren't using TryAccessor for Columns, but are in TableSchemas 29 has_features_after_try_accessors:bool; 30 31 // table comment 32 comment:string; 33 } 34 35 table Column { 36 // column name 37 name:string (required); 38 39 // sql column type 40 sql_type:string; 41 42 // sql default value. For generated columns, this is the generated expression rather than the default. 43 default_value:string; 44 45 // sql comment 46 comment:string; 47 48 // sql display order 49 display_order:int16; 50 51 // column tag 52 tag: uint64; 53 54 // storage encoding 55 encoding:Encoding; 56 57 // column meta 58 primary_key:bool; 59 nullable:bool; 60 auto_increment:bool; 61 hidden:bool; 62 generated:bool; 63 virtual:bool; 64 65 // sql on update value 66 on_update_value:string; 67 } 68 69 table Index { 70 // index name 71 name:string; 72 73 // sql comment 74 comment:string; 75 76 // ordered list of columns defining the index. 77 // stored as indices into columns vector. 78 index_columns:[uint16] (required); 79 80 // ordered list of columns corresponding to 81 // key tuple fields within index storage. 82 // stored as indices into columns vector. 83 // 84 // for secondary indexes, this is typically 85 // index columns + primary key columns. 86 key_columns:[uint16] (required); 87 88 // ordered list of columns corresponding to 89 // value tuple fields within index storage. 90 // stored as indices into columns vector. 91 // 92 // typically, this is only populated for 93 // clustered primary key indexes. 94 value_columns:[uint16]; 95 96 // index meta 97 primary_key:bool; 98 unique_key:bool; 99 system_defined:bool; 100 101 prefix_lengths:[uint16]; 102 spatial_key:bool; 103 104 // fulltext information 105 fulltext_key:bool; 106 fulltext_info:FulltextInfo; 107 } 108 109 table FulltextInfo { 110 config_table:string; 111 position_table:string; 112 doc_count_table:string; 113 global_count_table:string; 114 row_count_table:string; 115 key_type:uint8; 116 key_name:string; 117 key_positions:[uint16]; 118 } 119 120 table CheckConstraint { 121 name:string; 122 expression:string; 123 enforced:bool; 124 } 125 126 // KEEP THIS IN SYNC WITH fileidentifiers.go 127 file_identifier "DSCH"; 128 129 root_type TableSchema;