github.com/status-im/status-go@v1.1.0/protocol/communities/migrations/migrations.go (about)

     1  // Code generated by go-bindata. DO NOT EDIT.
     2  // sources:
     3  // 1602502752_initial_schema.down.sql (40B)
     4  // 1602502752_initial_schema.up.sql (246B)
     5  // doc.go (382B)
     6  
     7  package migrations
     8  
     9  import (
    10  	"bytes"
    11  	"compress/gzip"
    12  	"crypto/sha256"
    13  	"fmt"
    14  	"io"
    15  	"io/ioutil"
    16  	"os"
    17  	"path/filepath"
    18  	"strings"
    19  	"time"
    20  )
    21  
    22  func bindataRead(data []byte, name string) ([]byte, error) {
    23  	gz, err := gzip.NewReader(bytes.NewBuffer(data))
    24  	if err != nil {
    25  		return nil, fmt.Errorf("read %q: %v", name, err)
    26  	}
    27  
    28  	var buf bytes.Buffer
    29  	_, err = io.Copy(&buf, gz)
    30  	clErr := gz.Close()
    31  
    32  	if err != nil {
    33  		return nil, fmt.Errorf("read %q: %v", name, err)
    34  	}
    35  	if clErr != nil {
    36  		return nil, err
    37  	}
    38  
    39  	return buf.Bytes(), nil
    40  }
    41  
    42  type asset struct {
    43  	bytes  []byte
    44  	info   os.FileInfo
    45  	digest [sha256.Size]byte
    46  }
    47  
    48  type bindataFileInfo struct {
    49  	name    string
    50  	size    int64
    51  	mode    os.FileMode
    52  	modTime time.Time
    53  }
    54  
    55  func (fi bindataFileInfo) Name() string {
    56  	return fi.name
    57  }
    58  func (fi bindataFileInfo) Size() int64 {
    59  	return fi.size
    60  }
    61  func (fi bindataFileInfo) Mode() os.FileMode {
    62  	return fi.mode
    63  }
    64  func (fi bindataFileInfo) ModTime() time.Time {
    65  	return fi.modTime
    66  }
    67  func (fi bindataFileInfo) IsDir() bool {
    68  	return false
    69  }
    70  func (fi bindataFileInfo) Sys() interface{} {
    71  	return nil
    72  }
    73  
    74  var __1602502752_initial_schemaDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\xc8\x2f\x4a\x4f\xcc\xcb\x2c\x4e\x2c\xc9\xcc\xcf\x2b\x8e\x47\xe1\x59\x73\x01\x02\x00\x00\xff\xff\x9f\x6f\x27\x32\x28\x00\x00\x00")
    75  
    76  func _1602502752_initial_schemaDownSqlBytes() ([]byte, error) {
    77  	return bindataRead(
    78  		__1602502752_initial_schemaDownSql,
    79  		"1602502752_initial_schema.down.sql",
    80  	)
    81  }
    82  
    83  func _1602502752_initial_schemaDownSql() (*asset, error) {
    84  	bytes, err := _1602502752_initial_schemaDownSqlBytes()
    85  	if err != nil {
    86  		return nil, err
    87  	}
    88  
    89  	info := bindataFileInfo{name: "1602502752_initial_schema.down.sql", size: 40, mode: os.FileMode(0644), modTime: time.Unix(1605625368, 0)}
    90  	a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6c, 0xbc, 0xe7, 0xcb, 0xc0, 0x86, 0x79, 0xf8, 0x41, 0x5, 0xb8, 0x9e, 0x18, 0xd, 0xed, 0x71, 0x9f, 0x54, 0xdd, 0x5, 0xf7, 0x70, 0xf5, 0x51, 0xac, 0xce, 0x9e, 0x25, 0x17, 0x1, 0x94, 0x3d}}
    91  	return a, nil
    92  }
    93  
    94  var __1602502752_initial_schemaUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x8b\x41\x4a\xc5\x30\x14\x45\xe7\x59\xc5\x1d\xfe\x82\x3b\x70\x94\xc4\x17\x08\x3c\x12\x6d\x13\x70\x56\x8a\x89\xf2\x14\xda\x92\x96\x82\xbb\x97\x76\x20\x88\x93\x3f\xbc\xf7\x9c\x63\x7b\xd2\x89\x90\xb4\x61\x82\x77\x08\x31\x81\x5e\xfd\x90\x06\x2c\xed\x63\x9a\x65\x9b\x76\x59\xe6\x6d\xfc\xb3\x70\x53\x80\x14\x18\x8e\xe6\x4a\x42\x66\x7e\x50\xc0\xda\xe4\x98\xf6\x3a\x7e\xd5\xef\x0b\x9e\x5f\xa9\xdb\x5b\x93\xf5\x0c\xff\x07\x9f\x8b\xcc\xb5\xc0\xc4\xc8\xa4\xc3\x2f\xc2\x13\x39\x9d\x39\xc1\x69\x1e\xe8\x14\x8f\xda\xe4\x5d\xee\x52\x73\xf0\x2f\x99\x6e\x52\x3a\xc4\x00\x1b\x83\x63\x6f\x13\x7a\x7a\x66\x6d\x49\x75\x8f\xea\x27\x00\x00\xff\xff\x8e\x73\xee\xe8\xf6\x00\x00\x00")
    95  
    96  func _1602502752_initial_schemaUpSqlBytes() ([]byte, error) {
    97  	return bindataRead(
    98  		__1602502752_initial_schemaUpSql,
    99  		"1602502752_initial_schema.up.sql",
   100  	)
   101  }
   102  
   103  func _1602502752_initial_schemaUpSql() (*asset, error) {
   104  	bytes, err := _1602502752_initial_schemaUpSqlBytes()
   105  	if err != nil {
   106  		return nil, err
   107  	}
   108  
   109  	info := bindataFileInfo{name: "1602502752_initial_schema.up.sql", size: 246, mode: os.FileMode(0644), modTime: time.Unix(1605625384, 0)}
   110  	a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0x8c, 0xae, 0xc8, 0x30, 0xdb, 0x57, 0x77, 0x78, 0xa2, 0x4d, 0x8, 0xc4, 0xf2, 0x31, 0x37, 0x4c, 0xe8, 0xd7, 0x2d, 0xda, 0x70, 0x16, 0x97, 0x79, 0xf9, 0x9e, 0x57, 0x3f, 0x61, 0xd, 0x7c}}
   111  	return a, nil
   112  }
   113  
   114  var _docGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x8f\x3d\x6e\xec\x30\x0c\x84\x7b\x9d\x62\xb0\xcd\x36\xcf\x52\xf3\xaa\x74\x29\xd3\xe7\x02\x5c\x89\x96\x88\xb5\x24\x43\xa4\xf7\xe7\xf6\x81\x37\x01\xe2\x2e\xed\x87\xf9\x86\xc3\x10\xf0\x59\x44\x31\xcb\xc2\x10\x45\xe3\xc8\xaa\x34\x9e\xb8\x70\xa4\x4d\x19\xa7\x2c\x56\xb6\x8b\x8f\xbd\x06\x35\xb2\x4d\x27\xa9\xa1\x4a\x1e\x64\x1c\x6e\xff\x4f\x2e\x04\x44\x6a\x67\x43\xa1\x96\x16\x7e\x75\x29\xd4\x68\x98\xb4\x8c\xbb\x58\x01\x61\x1d\x3c\xcb\xc3\xe3\xdd\xb0\x30\xa9\xc1\x0a\xd9\x59\x61\x85\x11\x49\x79\xaf\x99\xfb\x40\xee\xd3\x45\x5a\x22\x23\xbf\xa3\x8f\xf9\x40\xf6\x85\x91\x96\x85\x13\xe6\xd1\xeb\xcb\x55\xaa\x8c\x24\x83\xa3\xf5\xf1\xfc\x07\x52\x65\x43\xa3\xca\xba\xfb\x85\x6e\x8c\xd6\x7f\xce\x83\x5a\xfa\xfb\x23\xdc\xfb\xb8\x2a\x48\xc1\x8f\x95\xa3\x71\xf2\xce\xad\x14\xaf\x94\x19\xdf\x39\xe9\x4d\x9d\x0b\x21\xf7\xb7\xcc\x8d\x77\xf3\xb8\x73\x5a\xaf\xf9\x90\xc4\xd4\xe1\x7d\xf8\x05\x3e\x77\xf8\xe0\xbe\x02\x00\x00\xff\xff\x4d\x1d\x5d\x50\x7e\x01\x00\x00")
   115  
   116  func docGoBytes() ([]byte, error) {
   117  	return bindataRead(
   118  		_docGo,
   119  		"doc.go",
   120  	)
   121  }
   122  
   123  func docGo() (*asset, error) {
   124  	bytes, err := docGoBytes()
   125  	if err != nil {
   126  		return nil, err
   127  	}
   128  
   129  	info := bindataFileInfo{name: "doc.go", size: 382, mode: os.FileMode(0644), modTime: time.Unix(1605625368, 0)}
   130  	a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc0, 0x2f, 0x1e, 0x64, 0x9, 0x93, 0xe4, 0x8b, 0xf2, 0x98, 0x5a, 0x45, 0xe2, 0x80, 0x88, 0x67, 0x7a, 0x2d, 0xd7, 0x4b, 0xd1, 0x73, 0xb6, 0x6d, 0x15, 0xc2, 0x0, 0x34, 0xcd, 0xa0, 0xdb, 0x20}}
   131  	return a, nil
   132  }
   133  
   134  // Asset loads and returns the asset for the given name.
   135  // It returns an error if the asset could not be found or
   136  // could not be loaded.
   137  func Asset(name string) ([]byte, error) {
   138  	canonicalName := strings.Replace(name, "\\", "/", -1)
   139  	if f, ok := _bindata[canonicalName]; ok {
   140  		a, err := f()
   141  		if err != nil {
   142  			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
   143  		}
   144  		return a.bytes, nil
   145  	}
   146  	return nil, fmt.Errorf("Asset %s not found", name)
   147  }
   148  
   149  // AssetString returns the asset contents as a string (instead of a []byte).
   150  func AssetString(name string) (string, error) {
   151  	data, err := Asset(name)
   152  	return string(data), err
   153  }
   154  
   155  // MustAsset is like Asset but panics when Asset would return an error.
   156  // It simplifies safe initialization of global variables.
   157  func MustAsset(name string) []byte {
   158  	a, err := Asset(name)
   159  	if err != nil {
   160  		panic("asset: Asset(" + name + "): " + err.Error())
   161  	}
   162  
   163  	return a
   164  }
   165  
   166  // MustAssetString is like AssetString but panics when Asset would return an
   167  // error. It simplifies safe initialization of global variables.
   168  func MustAssetString(name string) string {
   169  	return string(MustAsset(name))
   170  }
   171  
   172  // AssetInfo loads and returns the asset info for the given name.
   173  // It returns an error if the asset could not be found or
   174  // could not be loaded.
   175  func AssetInfo(name string) (os.FileInfo, error) {
   176  	canonicalName := strings.Replace(name, "\\", "/", -1)
   177  	if f, ok := _bindata[canonicalName]; ok {
   178  		a, err := f()
   179  		if err != nil {
   180  			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
   181  		}
   182  		return a.info, nil
   183  	}
   184  	return nil, fmt.Errorf("AssetInfo %s not found", name)
   185  }
   186  
   187  // AssetDigest returns the digest of the file with the given name. It returns an
   188  // error if the asset could not be found or the digest could not be loaded.
   189  func AssetDigest(name string) ([sha256.Size]byte, error) {
   190  	canonicalName := strings.Replace(name, "\\", "/", -1)
   191  	if f, ok := _bindata[canonicalName]; ok {
   192  		a, err := f()
   193  		if err != nil {
   194  			return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err)
   195  		}
   196  		return a.digest, nil
   197  	}
   198  	return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name)
   199  }
   200  
   201  // Digests returns a map of all known files and their checksums.
   202  func Digests() (map[string][sha256.Size]byte, error) {
   203  	mp := make(map[string][sha256.Size]byte, len(_bindata))
   204  	for name := range _bindata {
   205  		a, err := _bindata[name]()
   206  		if err != nil {
   207  			return nil, err
   208  		}
   209  		mp[name] = a.digest
   210  	}
   211  	return mp, nil
   212  }
   213  
   214  // AssetNames returns the names of the assets.
   215  func AssetNames() []string {
   216  	names := make([]string, 0, len(_bindata))
   217  	for name := range _bindata {
   218  		names = append(names, name)
   219  	}
   220  	return names
   221  }
   222  
   223  // _bindata is a table, holding each asset generator, mapped to its name.
   224  var _bindata = map[string]func() (*asset, error){
   225  	"1602502752_initial_schema.down.sql": _1602502752_initial_schemaDownSql,
   226  
   227  	"1602502752_initial_schema.up.sql": _1602502752_initial_schemaUpSql,
   228  
   229  	"doc.go": docGo,
   230  }
   231  
   232  // AssetDir returns the file names below a certain
   233  // directory embedded in the file by go-bindata.
   234  // For example if you run go-bindata on data/... and data contains the
   235  // following hierarchy:
   236  //     data/
   237  //       foo.txt
   238  //       img/
   239  //         a.png
   240  //         b.png
   241  // then AssetDir("data") would return []string{"foo.txt", "img"},
   242  // AssetDir("data/img") would return []string{"a.png", "b.png"},
   243  // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and
   244  // AssetDir("") will return []string{"data"}.
   245  func AssetDir(name string) ([]string, error) {
   246  	node := _bintree
   247  	if len(name) != 0 {
   248  		canonicalName := strings.Replace(name, "\\", "/", -1)
   249  		pathList := strings.Split(canonicalName, "/")
   250  		for _, p := range pathList {
   251  			node = node.Children[p]
   252  			if node == nil {
   253  				return nil, fmt.Errorf("Asset %s not found", name)
   254  			}
   255  		}
   256  	}
   257  	if node.Func != nil {
   258  		return nil, fmt.Errorf("Asset %s not found", name)
   259  	}
   260  	rv := make([]string, 0, len(node.Children))
   261  	for childName := range node.Children {
   262  		rv = append(rv, childName)
   263  	}
   264  	return rv, nil
   265  }
   266  
   267  type bintree struct {
   268  	Func     func() (*asset, error)
   269  	Children map[string]*bintree
   270  }
   271  
   272  var _bintree = &bintree{nil, map[string]*bintree{
   273  	"1602502752_initial_schema.down.sql": &bintree{_1602502752_initial_schemaDownSql, map[string]*bintree{}},
   274  	"1602502752_initial_schema.up.sql":   &bintree{_1602502752_initial_schemaUpSql, map[string]*bintree{}},
   275  	"doc.go":                             &bintree{docGo, map[string]*bintree{}},
   276  }}
   277  
   278  // RestoreAsset restores an asset under the given directory.
   279  func RestoreAsset(dir, name string) error {
   280  	data, err := Asset(name)
   281  	if err != nil {
   282  		return err
   283  	}
   284  	info, err := AssetInfo(name)
   285  	if err != nil {
   286  		return err
   287  	}
   288  	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
   289  	if err != nil {
   290  		return err
   291  	}
   292  	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
   293  	if err != nil {
   294  		return err
   295  	}
   296  	return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
   297  }
   298  
   299  // RestoreAssets restores an asset under the given directory recursively.
   300  func RestoreAssets(dir, name string) error {
   301  	children, err := AssetDir(name)
   302  	// File
   303  	if err != nil {
   304  		return RestoreAsset(dir, name)
   305  	}
   306  	// Dir
   307  	for _, child := range children {
   308  		err = RestoreAssets(dir, filepath.Join(name, child))
   309  		if err != nil {
   310  			return err
   311  		}
   312  	}
   313  	return nil
   314  }
   315  
   316  func _filePath(dir, name string) string {
   317  	canonicalName := strings.Replace(name, "\\", "/", -1)
   318  	return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...)
   319  }