Compare commits
2 Commits
master
...
constraint
Author | SHA1 | Date | |
---|---|---|---|
20dab8b776
|
|||
9382c0e2d6
|
@ -17,11 +17,12 @@ type ScriptPolicy struct {
|
||||
// Hash of the source code that leads to this policy.
|
||||
// If this is a replacement mapping, the original source may not be pointed to by any policy.
|
||||
// The original source should still exist in the scripts table, which can be located by the same hash.
|
||||
FromScriptHash int64 // postgres does not support unsigned integers, so we have to pretend
|
||||
// postgres does not support unsigned integers, so we have to manually pretend this is an unsigned integer
|
||||
FromScriptHash int64 `gorm:"uniqueIndex;constraint:fk_script_policies_from_script_hash,onUpdate:NO ACTION,onDelete:NO ACTION;foreignKey:FromScriptHash;references:Hash"`
|
||||
// The ID of the replacement source (ScriptPolicyReplace)
|
||||
// or verbatim source (ScriptPolicyAllowed)
|
||||
// or 0 (other)
|
||||
ToScriptID int64
|
||||
ToScriptID int64 `gorm:"constraint:fk_script_policies_to_script_id,onUpdate:NO ACTION,onDelete:NO ACTION;foreignKey:ToScriptID;references:ID"`
|
||||
Policy Policy
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
@ -26,7 +26,8 @@ func HashParse(hash string) (uint64, error){
|
||||
type Script struct {
|
||||
ID int64 `gorm:"primaryKey"`
|
||||
Name string
|
||||
Hash int64 // postgres does not support unsigned integers, so we have to pretend
|
||||
// postgres does not support unsigned integers, so we have to pretend
|
||||
Hash int64 `gorm:"uniqueIndex;constraint:fk_script_hash,onUpdate:CASCADE,onDelete:CASCADE;foreignKey:Hash;references:FromScriptHash"`
|
||||
Source string
|
||||
ResourceType ResourceType // is this a submission or is it a mapfix
|
||||
ResourceID int64 // which submission / mapfix did this script first appear in
|
||||
|
Reference in New Issue
Block a user