-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1678 from smartcontractkit/release/0.6.8
Release/0.6.8
- Loading branch information
Showing
284 changed files
with
4,256 additions
and
7,388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.6.7 | ||
0.6.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package migration1568280052 | ||
|
||
import ( | ||
"github.com/jinzhu/gorm" | ||
"github.com/pkg/errors" | ||
"github.com/smartcontractkit/chainlink/core/store/migrations/migration1565877314" | ||
"github.com/smartcontractkit/chainlink/core/store/models" | ||
) | ||
|
||
type ExternalInitiator struct { | ||
*gorm.Model | ||
Name string `gorm:"not null;unique"` | ||
URL models.WebURL `gorm:"not null"` | ||
AccessKey string `gorm:"not null"` | ||
Salt string `gorm:"not null"` | ||
HashedSecret string `gorm:"not null"` | ||
OutgoingSecret string `gorm:"not null"` | ||
OutgoingToken string `gorm:"not null"` | ||
} | ||
|
||
// newExternalInitiator returns a copy of the old struct with the fields untouched. | ||
func newExternalInitiator(arg migration1565877314.ExternalInitiator) ExternalInitiator { | ||
return ExternalInitiator{ | ||
Model: arg.Model, | ||
Name: arg.AccessKey, | ||
URL: arg.URL, | ||
AccessKey: arg.AccessKey, | ||
Salt: arg.Salt, | ||
HashedSecret: arg.HashedSecret, | ||
OutgoingSecret: arg.OutgoingSecret, | ||
OutgoingToken: arg.OutgoingToken, | ||
} | ||
} | ||
|
||
// Migrate adds External Initiator Name and URL fields. | ||
func Migrate(tx *gorm.DB) error { | ||
var exis []migration1565877314.ExternalInitiator | ||
if err := tx.Find(&exis).Error; err != nil { | ||
return errors.Wrap(err, "could not load all External Intitiators") | ||
} | ||
|
||
// Make new table | ||
if err := tx.DropTable(migration1565877314.ExternalInitiator{}).Error; err != nil { | ||
return errors.Wrap(err, "could not drop old External Intitiator table") | ||
} | ||
if err := tx.AutoMigrate(&ExternalInitiator{}).Error; err != nil { | ||
return errors.Wrap(err, "could not create new External Intitiator table") | ||
} | ||
|
||
// Copy | ||
for _, old := range exis { | ||
exi := newExternalInitiator(old) | ||
if err := tx.Save(exi).Error; err != nil { | ||
return errors.Wrap(err, "could not save migrated version of External Initiator") | ||
} | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.