diff options
author | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-03-28 15:54:17 +0800 |
---|---|---|
committer | Jhih-Ming Huang <jm.huang@cobinhood.com> | 2019-05-06 10:44:04 +0800 |
commit | aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac (patch) | |
tree | aa57c6b402dc276f3084aded1074e7eb42b71261 /core/vm/sqlvm/schema/schema.go | |
parent | 10861508f90fa45ad65f5f15163614cdaec8f9f8 (diff) | |
download | dexon-aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac.tar dexon-aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac.tar.gz dexon-aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac.tar.bz2 dexon-aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac.tar.lz dexon-aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac.tar.xz dexon-aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac.tar.zst dexon-aa7a9f5170fff9cc7040cb8794d6c3c5e36066ac.zip |
core: vm: sqlvm: schema: make foreign key constraints a slice
It is allowed to declare multiple foreign key constraints on a column.
Diffstat (limited to 'core/vm/sqlvm/schema/schema.go')
-rw-r--r-- | core/vm/sqlvm/schema/schema.go | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/core/vm/sqlvm/schema/schema.go b/core/vm/sqlvm/schema/schema.go index 0d40a9612..d50a3ff46 100644 --- a/core/vm/sqlvm/schema/schema.go +++ b/core/vm/sqlvm/schema/schema.go @@ -158,14 +158,13 @@ type Index struct { } type column struct { - Name []byte - Type ast.DataType - Attr ColumnAttr - ForeignTable TableRef - ForeignColumn ColumnRef - Sequence SequenceRef - SlotOffset uint8 - ByteOffset uint8 + Name []byte + Type ast.DataType + Attr ColumnAttr + ForeignKeys []ColumnDescriptor + Sequence SequenceRef + SlotOffset uint8 + ByteOffset uint8 // Rest is a special field reserved for use in EncodeRLP. The value stored // in it will be overwritten every time EncodeRLP is called. Rest interface{} @@ -178,15 +177,14 @@ type Column struct { } // NewColumn return a Column instance. -func NewColumn(Name []byte, Type ast.DataType, Attr ColumnAttr, Sequence SequenceRef, - FT TableRef, FC ColumnRef) Column { +func NewColumn(Name []byte, Type ast.DataType, Attr ColumnAttr, + ForeignKeys []ColumnDescriptor, Sequence SequenceRef) Column { c := column{ - Name: Name, - Type: Type, - Attr: Attr, - Sequence: Sequence, - ForeignTable: FT, - ForeignColumn: FC, + Name: Name, + Type: Type, + Attr: Attr, + ForeignKeys: ForeignKeys, + Sequence: Sequence, } return Column{ |