mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-21 19:39:04 -05:00
85 lines
1.9 KiB
Plaintext
85 lines
1.9 KiB
Plaintext
// Copyright 2021 Dolthub, Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
namespace serial;
|
|
|
|
table Column {
|
|
name:string (required);
|
|
storage_order:uint16;
|
|
schema_order:uint16;
|
|
|
|
type:Type (required);
|
|
nullable:bool;
|
|
primary_key:bool;
|
|
auto_increment:bool;
|
|
default:ColumnDefault;
|
|
constraints:[ColumnConstraint] (required);
|
|
comment:string (required);
|
|
}
|
|
|
|
// based on schema_marshalling.go:encodeTypeInfo()
|
|
table Type {
|
|
type:string (required);
|
|
param_keys:[string] (required);
|
|
param_values:[string] (required);
|
|
}
|
|
|
|
table ColumnDefault {
|
|
expression:string (required);
|
|
}
|
|
|
|
table ColumnConstraint {
|
|
name:string (required);
|
|
expression:string (required);
|
|
enforced:bool;
|
|
}
|
|
|
|
table TableSchema {
|
|
columns:[Column] (required);
|
|
indexes:[IndexSchema] (required);
|
|
}
|
|
|
|
table IndexSchema {
|
|
name:string (required);
|
|
columns:[string] (required);
|
|
unique:bool;
|
|
system_defined:bool;
|
|
comment:string (required);
|
|
}
|
|
|
|
enum ForeignKeyReferenceOption : uint8 {
|
|
DefaultAction,
|
|
Cascade,
|
|
NoAction,
|
|
Restrict,
|
|
SetNull,
|
|
}
|
|
|
|
table ForeignKey {
|
|
name:string (required);
|
|
|
|
child_table:string (required);
|
|
child_columns:[string] (required);
|
|
child_index:string (required);
|
|
|
|
parent_table:string (required);
|
|
parent_columns:[string] (required);
|
|
parent_index:string (required);
|
|
|
|
on_update:ForeignKeyReferenceOption;
|
|
on_delete:ForeignKeyReferenceOption;
|
|
|
|
// todo(andy): "resolved details"
|
|
}
|