mirror of
https://github.com/dolthub/dolt.git
synced 2026-03-17 09:53:59 -05:00
57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
// Copyright 2022 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;
|
|
|
|
// https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html#foreign-key-referential-actions
|
|
enum ForeignKeyReferentialAction : uint8 {
|
|
DefaultAction = 0,
|
|
Cascade = 1,
|
|
NoAction = 2,
|
|
Restrict = 3,
|
|
SetNull = 4,
|
|
}
|
|
|
|
table ForeignKeyCollection {
|
|
foreign_keys:[ForeignKey];
|
|
}
|
|
|
|
table ForeignKey {
|
|
// foreign key name
|
|
name:string;
|
|
|
|
// child table
|
|
child_table_name:string;
|
|
child_table_index:string;
|
|
child_table_columns:[uint64];
|
|
|
|
// parent table
|
|
parent_table_name:string;
|
|
parent_table_index:string;
|
|
parent_table_columns:[uint64];
|
|
|
|
// reference options
|
|
on_update:ForeignKeyReferentialAction;
|
|
on_delete:ForeignKeyReferentialAction;
|
|
|
|
// unresolved details
|
|
unresolved_child_columns:[string];
|
|
unresolved_parent_columns:[string];
|
|
}
|
|
|
|
// KEEP THIS IN SYNC WITH fileidentifiers.go
|
|
file_identifier "DFKC";
|
|
|
|
root_type ForeignKeyCollection;
|