Dmitry a67184adbd Wallet database isolated by the network id
Wallet database refactored so that every query ensures isolation by the network id.
Network id provided when database object is created, thus it is transparent to other parts
of the wallet module.

Additionally every uniqueness index is changed to ensure that it doesn't prevent adding
object with same id but from a different network.
2019-08-21 10:44:50 +03:00

128 lines
6.2 KiB
Go

package migrations
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"strings"
)
func bindata_read(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
var buf bytes.Buffer
_, err = io.Copy(&buf, gz)
gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
return buf.Bytes(), nil
}
var __0001_app_down_sql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\x28\x4e\x2d\x29\xc9\xcc\x4b\x2f\xb6\xe6\x42\x12\x4c\x4c\x4e\xce\x2f\xcd\x2b\x41\x15\x4c\x2a\xca\x2f\x2f\x4e\x2d\xc2\x2e\x18\x9f\x91\x59\x5c\x92\x5f\x54\x89\x22\x99\x92\x58\x50\x80\xaa\xbc\x20\xb5\x28\x37\xb3\xb8\x38\x33\x3f\x0f\x55\xbc\xa4\x28\x31\xaf\x38\x0d\xc3\xf0\x9c\xfc\xe4\x6c\xec\x2e\x8b\x2f\xc9\x8f\x87\x49\x03\x02\x00\x00\xff\xff\xe3\xa7\x2d\xc9\xce\x00\x00\x00")
func _0001_app_down_sql() ([]byte, error) {
return bindata_read(
__0001_app_down_sql,
"0001_app.down.sql",
)
}
var __0001_app_up_sql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x54\x5d\x93\x9a\x30\x14\x7d\xcf\xaf\xb8\x8f\x3a\xc3\x3f\xd8\x27\xd4\xe8\x66\x4a\x43\xcb\x47\x77\xf7\x89\x89\x90\x55\x46\x0c\x34\x89\x75\xfd\xf7\x9d\x00\x01\x74\x11\xbb\xd3\x37\x92\x9c\x1c\xce\x39\xf7\xde\x2c\x03\xec\x46\x18\x22\x77\xe1\x61\x20\x6b\xa0\x7e\x04\xf8\x95\x84\x51\x08\x8a\x6b\x9d\x8b\x9d\x82\x19\xd2\x97\x8a\xc3\x2f\x37\x58\x3e\xbb\x01\xfc\x08\xc8\x77\x37\x78\x83\x6f\xf8\xcd\x41\x7f\x58\x71\xe2\xb0\xf0\xfc\x05\x9a\xc3\x0b\x89\x9e\xfd\x38\x82\xc0\x7f\x21\xab\x27\x84\x26\xc8\x59\x9a\x96\x27\xa1\x0d\x39\xcb\x32\xc9\x95\x1a\xe7\x3f\xb3\xa2\xe0\x1a\x16\xbe\xef\x61\x97\x3a\x28\xdd\xb3\xc1\xaa\xd6\x15\xe1\xd7\xc8\x41\x4a\x97\x92\xed\xec\xaa\x3a\x6d\x0f\xfc\x52\xeb\x72\x50\xc5\xf4\xbe\xdd\x17\xec\x68\x21\x69\x59\x94\xb2\xfe\xbe\xaf\x3c\xa6\xe4\x67\x8c\x81\xd0\x15\x7e\x85\x93\xc8\x7f\x9f\x78\xd2\x28\x4a\xac\x6a\x9f\x0e\xbc\x34\x67\x73\x78\x79\xc6\x01\xee\x96\x4f\x53\x74\xc6\xd0\x38\x99\x39\xe9\xa8\xea\xc5\x74\xa4\x5b\x59\x9e\x15\x97\x26\xd2\x3c\xab\x8d\x5d\x47\xd9\x79\xaf\x2f\xd1\xd8\xf3\x1c\xa4\xf3\x23\x57\x9a\x1d\x2b\x88\xc3\x0d\xd9\x50\xbc\x82\x05\xd9\x10\x1a\x39\x28\x63\x55\x65\x93\x86\x15\x5e\xbb\xb1\x17\xc1\x3b\x2b\x14\x77\xd0\x3e\x37\x71\x5f\x88\xc8\xf8\x07\xc4\x34\x6c\x6e\x12\x3a\x11\xe5\x94\xe2\xa4\xe5\x83\x19\x6a\xb7\x12\xeb\xa0\x97\x6a\x31\x4d\xf5\xd6\x7e\x80\xc9\x86\x1a\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\x7f\x03\x00\x00\xff\xff\xd0\x65\x6e\xd9\x13\x08\x00\x00")
func _0001_app_up_sql() ([]byte, error) {
return bindata_read(
__0001_app_up_sql,
"0001_app.up.sql",
)
}
var _doc_go = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xc9\xb1\x0d\xc4\x20\x0c\x05\xd0\x9e\x29\xfe\x02\xd8\xfd\x6d\xe3\x4b\xac\x2f\x44\x82\x09\x78\x7f\xa5\x49\xfd\xa6\x1d\xdd\xe8\xd8\xcf\x55\x8a\x2a\xe3\x47\x1f\xbe\x2c\x1d\x8c\xfa\x6f\xe3\xb4\x34\xd4\xd9\x89\xbb\x71\x59\xb6\x18\x1b\x35\x20\xa2\x9f\x0a\x03\xa2\xe5\x0d\x00\x00\xff\xff\x60\xcd\x06\xbe\x4a\x00\x00\x00")
func doc_go() ([]byte, error) {
return bindata_read(
_doc_go,
"doc.go",
)
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
return f()
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() ([]byte, error){
"0001_app.down.sql": _0001_app_down_sql,
"0001_app.up.sql": _0001_app_up_sql,
"doc.go": doc_go,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for name := range node.Children {
rv = append(rv, name)
}
return rv, nil
}
type _bintree_t struct {
Func func() ([]byte, error)
Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"0001_app.down.sql": &_bintree_t{_0001_app_down_sql, map[string]*_bintree_t{
}},
"0001_app.up.sql": &_bintree_t{_0001_app_up_sql, map[string]*_bintree_t{
}},
"doc.go": &_bintree_t{doc_go, map[string]*_bintree_t{
}},
}}