Files
wehub-resource-sync 5357c39144
Fuzzer / Run Fuzzer (push) Has been cancelled
Race tests / Go race tests (ubuntu-22.04) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:01:40 +08:00

73 lines
1.8 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,
}
enum ForeignKeyMatchType : uint8 {
Simple = 0,
Full = 1,
Partial = 2,
}
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];
// For tables in the non-default schema, these fields are set
child_table_database_schema:[string];
parent_table_database_schema:[string];
// For whether existing rows are checked
is_not_valid:bool;
// NULL handling semantics for composite FK columns
match_type:ForeignKeyMatchType;
}
// KEEP THIS IN SYNC WITH fileidentifiers.go
file_identifier "DFKC";
root_type ForeignKeyCollection;