Merge pull request #767 from docker/rethinkdb-export-schema

Export rethinkdb table definitions
This commit is contained in:
Riyaz Faizullabhoy
2016-06-08 10:43:53 -07:00
3 changed files with 9 additions and 6 deletions

View File

@@ -269,8 +269,8 @@ func (rdb RethinkDB) deleteByTSChecksum(tsChecksum string) error {
// Bootstrap sets up the database and tables, also creating the notary server user with appropriate db permission
func (rdb RethinkDB) Bootstrap() error {
if err := rethinkdb.SetupDB(rdb.sess, rdb.dbName, []rethinkdb.Table{
tufFiles,
keys,
TufFilesRethinkTable,
PubKeysRethinkTable,
}); err != nil {
return err
}

View File

@@ -12,7 +12,8 @@ const (
)
var (
tufFiles = rethinkdb.Table{
// TufFilesRethinkTable is the table definition of notary server's TUF metadata files
TufFilesRethinkTable = rethinkdb.Table{
Name: RDBTUFFile{}.TableName(),
PrimaryKey: "gun_role_version",
SecondaryIndexes: map[string][]string{
@@ -28,7 +29,8 @@ var (
},
}
keys = rethinkdb.Table{
// PubKeysRethinkTable is the table definition of notary server's public key information for TUF roles
PubKeysRethinkTable = rethinkdb.Table{
Name: RDBKey{}.TableName(),
PrimaryKey: "id",
SecondaryIndexes: map[string][]string{

View File

@@ -39,7 +39,8 @@ type RDBPrivateKey struct {
Private string `gorethink:"private"`
}
var privateKeys = rethinkdb.Table{
// PrivateKeysRethinkTable is the table definition for notary signer's key information
var PrivateKeysRethinkTable = rethinkdb.Table{
Name: RDBPrivateKey{}.TableName(),
PrimaryKey: RDBPrivateKey{}.KeyID,
}
@@ -243,7 +244,7 @@ func (rdb RethinkDBKeyStore) ExportKey(keyID string) ([]byte, error) {
// Bootstrap sets up the database and tables, also creating the notary signer user with appropriate db permission
func (rdb RethinkDBKeyStore) Bootstrap() error {
if err := rethinkdb.SetupDB(rdb.sess, rdb.dbName, []rethinkdb.Table{
privateKeys,
PrivateKeysRethinkTable,
}); err != nil {
return err
}