mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-14 18:17:33 +02:00
Adding mysql support to the database (#301)
* Adding mysql support * Fixing other test cases * Tests passing on mysql * Fix the row number generation * Adding blocks_history table * merging the migrations in one single set of files * Passing mysql tests * Fixing default encoding on mysql * Simplifying things * Removing from the blocks table all deleted blocks * Better indentation * Moving db types to constants to make it less error prone * reducing duplicated code * Removing log line * Now sql tests are running properly in mysql, sqlite and postgres
This commit is contained in:
parent
4a5d7c4a64
commit
2d261fde59
@ -3,6 +3,7 @@ package integrationtests
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/focalboard/server/client"
|
||||
@ -16,11 +17,22 @@ type TestHelper struct {
|
||||
}
|
||||
|
||||
func getTestConfig() *config.Configuration {
|
||||
dbType := os.Getenv("FB_STORE_TEST_DB_TYPE")
|
||||
if dbType == "" {
|
||||
dbType = "sqlite3"
|
||||
}
|
||||
|
||||
connectionString := os.Getenv("FB_STORE_TEST_CONN_STRING")
|
||||
if connectionString == "" {
|
||||
connectionString = ":memory:"
|
||||
}
|
||||
|
||||
return &config.Configuration{
|
||||
ServerRoot: "http://localhost:8888",
|
||||
Port: 8888,
|
||||
DBType: "sqlite3",
|
||||
DBConfigString: ":memory:",
|
||||
DBType: dbType,
|
||||
DBConfigString: connectionString,
|
||||
DBTablePrefix: "test_",
|
||||
WebPath: "./pack",
|
||||
FilesPath: "./files",
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package sqlstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@ -14,16 +15,6 @@ import (
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
func (s *SQLStore) latestsBlocksSubquery(c store.Container) sq.SelectBuilder {
|
||||
internalQuery := sq.Select("*", "ROW_NUMBER() OVER (PARTITION BY id ORDER BY insert_at DESC) AS rn").From(s.tablePrefix + "blocks")
|
||||
|
||||
return sq.Select("*").
|
||||
FromSelect(internalQuery, "a").
|
||||
Where(sq.Eq{"rn": 1}).
|
||||
Where(sq.Eq{"delete_at": 0}).
|
||||
Where(sq.Eq{"coalesce(workspace_id, '0')": c.WorkspaceID})
|
||||
}
|
||||
|
||||
func (s *SQLStore) GetBlocksWithParentAndType(c store.Container, parentID string, blockType string) ([]model.Block, error) {
|
||||
query := s.getQueryBuilder().
|
||||
Select(
|
||||
@ -31,15 +22,16 @@ func (s *SQLStore) GetBlocksWithParentAndType(c store.Container, parentID string
|
||||
"parent_id",
|
||||
"root_id",
|
||||
"modified_by",
|
||||
"schema",
|
||||
s.escapeField("schema"),
|
||||
"type",
|
||||
"title",
|
||||
"COALESCE(\"fields\", '{}')",
|
||||
"COALESCE(fields, '{}')",
|
||||
"create_at",
|
||||
"update_at",
|
||||
"delete_at",
|
||||
).
|
||||
FromSelect(s.latestsBlocksSubquery(c), "latest").
|
||||
From(s.tablePrefix + "blocks").
|
||||
Where(sq.Eq{"COALESCE(workspace_id, '0')": c.WorkspaceID}).
|
||||
Where(sq.Eq{"parent_id": parentID}).
|
||||
Where(sq.Eq{"type": blockType})
|
||||
|
||||
@ -60,16 +52,17 @@ func (s *SQLStore) GetBlocksWithParent(c store.Container, parentID string) ([]mo
|
||||
"parent_id",
|
||||
"root_id",
|
||||
"modified_by",
|
||||
"schema",
|
||||
s.escapeField("schema"),
|
||||
"type",
|
||||
"title",
|
||||
"COALESCE(\"fields\", '{}')",
|
||||
"COALESCE(fields, '{}')",
|
||||
"create_at",
|
||||
"update_at",
|
||||
"delete_at",
|
||||
).
|
||||
FromSelect(s.latestsBlocksSubquery(c), "latest").
|
||||
Where(sq.Eq{"parent_id": parentID})
|
||||
From(s.tablePrefix + "blocks").
|
||||
Where(sq.Eq{"parent_id": parentID}).
|
||||
Where(sq.Eq{"coalesce(workspace_id, '0')": c.WorkspaceID})
|
||||
|
||||
rows, err := query.Query()
|
||||
if err != nil {
|
||||
@ -88,16 +81,17 @@ func (s *SQLStore) GetBlocksWithType(c store.Container, blockType string) ([]mod
|
||||
"parent_id",
|
||||
"root_id",
|
||||
"modified_by",
|
||||
"schema",
|
||||
s.escapeField("schema"),
|
||||
"type",
|
||||
"title",
|
||||
"COALESCE(\"fields\", '{}')",
|
||||
"COALESCE(fields, '{}')",
|
||||
"create_at",
|
||||
"update_at",
|
||||
"delete_at",
|
||||
).
|
||||
FromSelect(s.latestsBlocksSubquery(c), "latest").
|
||||
Where(sq.Eq{"type": blockType})
|
||||
From(s.tablePrefix + "blocks").
|
||||
Where(sq.Eq{"type": blockType}).
|
||||
Where(sq.Eq{"coalesce(workspace_id, '0')": c.WorkspaceID})
|
||||
|
||||
rows, err := query.Query()
|
||||
if err != nil {
|
||||
@ -117,16 +111,17 @@ func (s *SQLStore) GetSubTree2(c store.Container, blockID string) ([]model.Block
|
||||
"parent_id",
|
||||
"root_id",
|
||||
"modified_by",
|
||||
"schema",
|
||||
s.escapeField("schema"),
|
||||
"type",
|
||||
"title",
|
||||
"COALESCE(\"fields\", '{}')",
|
||||
"COALESCE(fields, '{}')",
|
||||
"create_at",
|
||||
"update_at",
|
||||
"delete_at",
|
||||
).
|
||||
FromSelect(s.latestsBlocksSubquery(c), "latest").
|
||||
Where(sq.Or{sq.Eq{"id": blockID}, sq.Eq{"parent_id": blockID}})
|
||||
From(s.tablePrefix + "blocks").
|
||||
Where(sq.Or{sq.Eq{"id": blockID}, sq.Eq{"parent_id": blockID}}).
|
||||
Where(sq.Eq{"coalesce(workspace_id, '0')": c.WorkspaceID})
|
||||
|
||||
rows, err := query.Query()
|
||||
if err != nil {
|
||||
@ -141,12 +136,12 @@ func (s *SQLStore) GetSubTree2(c store.Container, blockID string) ([]model.Block
|
||||
// GetSubTree3 returns blocks within 3 levels of the given blockID
|
||||
func (s *SQLStore) GetSubTree3(c store.Container, blockID string) ([]model.Block, error) {
|
||||
// This first subquery returns repeated blocks
|
||||
subquery1 := sq.Select(
|
||||
query := s.getQueryBuilder().Select(
|
||||
"l3.id",
|
||||
"l3.parent_id",
|
||||
"l3.root_id",
|
||||
"l3.modified_by",
|
||||
"l3.schema",
|
||||
"l3."+s.escapeField("schema"),
|
||||
"l3.type",
|
||||
"l3.title",
|
||||
"l3.fields",
|
||||
@ -154,31 +149,17 @@ func (s *SQLStore) GetSubTree3(c store.Container, blockID string) ([]model.Block
|
||||
"l3.update_at",
|
||||
"l3.delete_at",
|
||||
).
|
||||
FromSelect(s.latestsBlocksSubquery(c), "l1").
|
||||
JoinClause(s.latestsBlocksSubquery(c).Prefix("JOIN (").Suffix(") l2 on l2.parent_id = l1.id or l2.id = l1.id")).
|
||||
JoinClause(s.latestsBlocksSubquery(c).Prefix("JOIN (").Suffix(") l3 on l3.parent_id = l2.id or l3.id = l2.id")).
|
||||
Where(sq.Eq{"l1.id": blockID})
|
||||
From(s.tablePrefix + "blocks as l1").
|
||||
Join(s.tablePrefix + "blocks as l2 on l2.parent_id = l1.id or l2.id = l1.id").
|
||||
Join(s.tablePrefix + "blocks as l3 on l3.parent_id = l2.id or l3.id = l2.id").
|
||||
Where(sq.Eq{"l1.id": blockID}).
|
||||
Where(sq.Eq{"COALESCE(l3.workspace_id, '0')": c.WorkspaceID})
|
||||
|
||||
// This second subquery is used to return distinct blocks
|
||||
// We can't use DISTINCT because JSON columns in Postgres don't support it, and SQLite doesn't support DISTINCT ON
|
||||
subquery2 := sq.Select("*", "ROW_NUMBER() OVER (PARTITION BY id) AS rn").
|
||||
FromSelect(subquery1, "sub1")
|
||||
|
||||
query := s.getQueryBuilder().Select(
|
||||
"id",
|
||||
"parent_id",
|
||||
"root_id",
|
||||
"modified_by",
|
||||
"schema",
|
||||
"type",
|
||||
"title",
|
||||
"COALESCE(\"fields\", '{}')",
|
||||
"create_at",
|
||||
"update_at",
|
||||
"delete_at",
|
||||
).
|
||||
FromSelect(subquery2, "sub2").
|
||||
Where(sq.Eq{"rn": 1})
|
||||
if s.dbType == postgresDBType {
|
||||
query = query.Options("DISTINCT ON (l3.id)")
|
||||
} else {
|
||||
query = query.Distinct()
|
||||
}
|
||||
|
||||
rows, err := query.Query()
|
||||
if err != nil {
|
||||
@ -197,15 +178,15 @@ func (s *SQLStore) GetAllBlocks(c store.Container) ([]model.Block, error) {
|
||||
"parent_id",
|
||||
"root_id",
|
||||
"modified_by",
|
||||
"schema",
|
||||
s.escapeField("schema"),
|
||||
"type",
|
||||
"title",
|
||||
"COALESCE(\"fields\", '{}')",
|
||||
"COALESCE(fields, '{}')",
|
||||
"create_at",
|
||||
"update_at",
|
||||
"delete_at",
|
||||
).
|
||||
FromSelect(s.latestsBlocksSubquery(c), "latest")
|
||||
From(s.tablePrefix + "blocks")
|
||||
|
||||
rows, err := query.Query()
|
||||
if err != nil {
|
||||
@ -266,8 +247,9 @@ func blocksFromRows(rows *sql.Rows) ([]model.Block, error) {
|
||||
|
||||
func (s *SQLStore) GetRootID(c store.Container, blockID string) (string, error) {
|
||||
query := s.getQueryBuilder().Select("root_id").
|
||||
FromSelect(s.latestsBlocksSubquery(c), "latest").
|
||||
Where(sq.Eq{"id": blockID})
|
||||
From(s.tablePrefix + "blocks").
|
||||
Where(sq.Eq{"id": blockID}).
|
||||
Where(sq.Eq{"coalesce(workspace_id, '0')": c.WorkspaceID})
|
||||
|
||||
row := query.QueryRow()
|
||||
|
||||
@ -283,8 +265,9 @@ func (s *SQLStore) GetRootID(c store.Container, blockID string) (string, error)
|
||||
|
||||
func (s *SQLStore) GetParentID(c store.Container, blockID string) (string, error) {
|
||||
query := s.getQueryBuilder().Select("parent_id").
|
||||
FromSelect(s.latestsBlocksSubquery(c), "latest").
|
||||
Where(sq.Eq{"id": blockID})
|
||||
From(s.tablePrefix + "blocks").
|
||||
Where(sq.Eq{"id": blockID}).
|
||||
Where(sq.Eq{"coalesce(workspace_id, '0')": c.WorkspaceID})
|
||||
|
||||
row := query.QueryRow()
|
||||
|
||||
@ -308,14 +291,20 @@ func (s *SQLStore) InsertBlock(c store.Container, block model.Block) error {
|
||||
return err
|
||||
}
|
||||
|
||||
query := s.getQueryBuilder().Insert(s.tablePrefix+"blocks").
|
||||
ctx := context.Background()
|
||||
tx, err := s.db.BeginTx(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
query := s.getQueryBuilder().Insert("").
|
||||
Columns(
|
||||
"workspace_id",
|
||||
"id",
|
||||
"parent_id",
|
||||
"root_id",
|
||||
"modified_by",
|
||||
"schema",
|
||||
s.escapeField("schema"),
|
||||
"type",
|
||||
"title",
|
||||
"fields",
|
||||
@ -337,7 +326,27 @@ func (s *SQLStore) InsertBlock(c store.Container, block model.Block) error {
|
||||
block.DeleteAt,
|
||||
)
|
||||
|
||||
_, err = query.Exec()
|
||||
// TODO: migrate this delete/insert to an upsert
|
||||
deleteQuery := s.getQueryBuilder().Delete(s.tablePrefix + "blocks").Where(sq.Eq{"id": block.ID})
|
||||
_, err = sq.ExecContextWith(ctx, tx, deleteQuery)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = sq.ExecContextWith(ctx, tx, query.Into(s.tablePrefix+"blocks"))
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = sq.ExecContextWith(ctx, tx, query.Into(s.tablePrefix+"blocks_history"))
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -346,8 +355,14 @@ func (s *SQLStore) InsertBlock(c store.Container, block model.Block) error {
|
||||
}
|
||||
|
||||
func (s *SQLStore) DeleteBlock(c store.Container, blockID string, modifiedBy string) error {
|
||||
ctx := context.Background()
|
||||
tx, err := s.db.BeginTx(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
now := time.Now().Unix()
|
||||
query := s.getQueryBuilder().Insert(s.tablePrefix+"blocks").
|
||||
insertQuery := s.getQueryBuilder().Insert(s.tablePrefix+"blocks_history").
|
||||
Columns(
|
||||
"workspace_id",
|
||||
"id",
|
||||
@ -363,7 +378,21 @@ func (s *SQLStore) DeleteBlock(c store.Container, blockID string, modifiedBy str
|
||||
now,
|
||||
)
|
||||
|
||||
_, err := query.Exec()
|
||||
_, err = sq.ExecContextWith(ctx, tx, insertQuery)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
deleteQuery := s.getQueryBuilder().Delete(s.tablePrefix + "blocks").Where(sq.Eq{"id": blockID})
|
||||
|
||||
_, err = sq.ExecContextWith(ctx, tx, deleteQuery)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/golang-migrate/migrate/v4"
|
||||
"github.com/golang-migrate/migrate/v4/database"
|
||||
"github.com/golang-migrate/migrate/v4/database/mysql"
|
||||
"github.com/golang-migrate/migrate/v4/database/postgres"
|
||||
"github.com/golang-migrate/migrate/v4/database/sqlite3"
|
||||
"github.com/golang-migrate/migrate/v4/source"
|
||||
@ -25,31 +26,36 @@ type PrefixedMigration struct {
|
||||
prefix string
|
||||
postgres bool
|
||||
sqlite bool
|
||||
mysql bool
|
||||
}
|
||||
|
||||
func init() {
|
||||
source.Register("prefixed-migrations", &PrefixedMigration{})
|
||||
}
|
||||
|
||||
func (pm *PrefixedMigration) executeTemplate(r io.ReadCloser, identifier string) (io.ReadCloser, string, error) {
|
||||
data, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
tmpl, err := template.New("sql").Parse(string(data))
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
buffer := bytes.NewBufferString("")
|
||||
err = tmpl.Execute(buffer, map[string]interface{}{"prefix": pm.prefix, "postgres": pm.postgres, "sqlite": pm.sqlite, "mysql": pm.mysql})
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return ioutil.NopCloser(bytes.NewReader(buffer.Bytes())), identifier, nil
|
||||
}
|
||||
|
||||
func (pm *PrefixedMigration) ReadUp(version uint) (io.ReadCloser, string, error) {
|
||||
r, identifier, err := pm.Bindata.ReadUp(version)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
data, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
tmpl, err := template.New("sql").Parse(string(data))
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
buffer := bytes.NewBufferString("")
|
||||
err = tmpl.Execute(buffer, map[string]interface{}{"prefix": pm.prefix, "postgres": pm.postgres, "sqlite": pm.sqlite})
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return ioutil.NopCloser(bytes.NewReader(buffer.Bytes())), identifier, nil
|
||||
return pm.executeTemplate(r, identifier)
|
||||
}
|
||||
|
||||
func (pm *PrefixedMigration) ReadDown(version uint) (io.ReadCloser, string, error) {
|
||||
@ -57,20 +63,7 @@ func (pm *PrefixedMigration) ReadDown(version uint) (io.ReadCloser, string, erro
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
data, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
tmpl, err := template.New("sql").Parse(string(data))
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
buffer := bytes.NewBufferString("")
|
||||
err = tmpl.Execute(buffer, map[string]interface{}{"prefix": pm.prefix, "postgres": pm.postgres, "sqlite": pm.sqlite})
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
return ioutil.NopCloser(bytes.NewReader(buffer.Bytes())), identifier, nil
|
||||
return pm.executeTemplate(r, identifier)
|
||||
}
|
||||
|
||||
func (s *SQLStore) Migrate() error {
|
||||
@ -78,20 +71,27 @@ func (s *SQLStore) Migrate() error {
|
||||
var err error
|
||||
migrationsTable := fmt.Sprintf("%sschema_migrations", s.tablePrefix)
|
||||
|
||||
if s.dbType == "sqlite3" {
|
||||
if s.dbType == sqliteDBType {
|
||||
driver, err = sqlite3.WithInstance(s.db, &sqlite3.Config{MigrationsTable: migrationsTable})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if s.dbType == "postgres" {
|
||||
if s.dbType == postgresDBType {
|
||||
driver, err = postgres.WithInstance(s.db, &postgres.Config{MigrationsTable: migrationsTable})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if s.dbType == mysqlDBType {
|
||||
driver, err = mysql.WithInstance(s.db, &mysql.Config{MigrationsTable: migrationsTable})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
bresource := bindata.Resource(migrations.AssetNames(), migrations.Asset)
|
||||
|
||||
d, err := bindata.WithInstance(bresource)
|
||||
@ -101,8 +101,9 @@ func (s *SQLStore) Migrate() error {
|
||||
prefixedData := &PrefixedMigration{
|
||||
Bindata: d.(*bindata.Bindata),
|
||||
prefix: s.tablePrefix,
|
||||
postgres: s.dbType == "postgres",
|
||||
sqlite: s.dbType == "sqlite3",
|
||||
postgres: s.dbType == postgresDBType,
|
||||
sqlite: s.dbType == sqliteDBType,
|
||||
mysql: s.dbType == mysqlDBType,
|
||||
}
|
||||
|
||||
m, err := migrate.NewWithInstance("prefixed-migration", prefixedData, s.dbType, driver)
|
||||
|
@ -1,21 +1,23 @@
|
||||
// Code generated by go-bindata. DO NOT EDIT.
|
||||
// sources:
|
||||
// migrations_files/000001_init.down.sql (30B)
|
||||
// migrations_files/000001_init.up.sql (414B)
|
||||
// migrations_files/000001_init.up.sql (606B)
|
||||
// migrations_files/000002_system_settings_table.down.sql (39B)
|
||||
// migrations_files/000002_system_settings_table.up.sql (108B)
|
||||
// migrations_files/000002_system_settings_table.up.sql (176B)
|
||||
// migrations_files/000003_blocks_rootid.down.sql (51B)
|
||||
// migrations_files/000003_blocks_rootid.up.sql (62B)
|
||||
// migrations_files/000004_auth_table.down.sql (61B)
|
||||
// migrations_files/000004_auth_table.up.sql (586B)
|
||||
// migrations_files/000004_auth_table.up.sql (719B)
|
||||
// migrations_files/000005_blocks_modifiedby.down.sql (55B)
|
||||
// migrations_files/000005_blocks_modifiedby.up.sql (66B)
|
||||
// migrations_files/000006_sharing_table.down.sql (31B)
|
||||
// migrations_files/000006_sharing_table.up.sql (170B)
|
||||
// migrations_files/000006_sharing_table.up.sql (238B)
|
||||
// migrations_files/000007_workspaces_table.down.sql (34B)
|
||||
// migrations_files/000007_workspaces_table.up.sql (225B)
|
||||
// migrations_files/000007_workspaces_table.up.sql (290B)
|
||||
// migrations_files/000008_teams.down.sql (173B)
|
||||
// migrations_files/000008_teams.up.sql (304B)
|
||||
// migrations_files/000009_blocks_history.down.sql (97B)
|
||||
// migrations_files/000009_blocks_history.up.sql (1.188kB)
|
||||
|
||||
package migrations
|
||||
|
||||
@ -99,12 +101,12 @@ func _000001_initDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000001_init.down.sql", size: 30, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000001_init.down.sql", size: 30, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc3, 0xa, 0x75, 0x74, 0x21, 0x4f, 0xed, 0x29, 0xf4, 0xfb, 0x14, 0x9a, 0xda, 0x7a, 0x6c, 0x3b, 0x58, 0x34, 0x7c, 0xcd, 0x48, 0xf4, 0x9, 0x5c, 0x96, 0xa1, 0xb9, 0xb2, 0x43, 0xfd, 0x76, 0xa2}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __000001_initUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x50\x4f\x6b\xfa\x40\x10\x3d\x27\x9f\x62\x2e\x21\x09\x44\x2f\x3f\xf8\x1d\xec\x69\xd5\xb5\xa6\xcd\x1f\x49\xc6\xaa\xbd\x48\xea\x4e\xda\xa5\x51\x43\x76\x0b\x2d\x61\xbf\x7b\x59\xc1\x0a\xf1\x36\xf3\xe6\xf1\xe6\xbd\x37\x2b\x38\x43\x0e\xc8\xa6\x09\x87\x78\x01\x59\x8e\xc0\xb7\x71\x89\x25\xf4\xfd\xb8\xed\xa8\x96\xdf\xc6\xbc\x35\xe7\xc3\xa7\x82\xc0\x75\xa4\x80\x17\x56\xcc\x96\xac\x08\xfe\xfd\x0f\x23\x17\x00\x40\x9e\x14\x75\x7a\x5f\x69\xe8\x7b\x59\xc3\xb8\x3d\x2b\xfd\xde\x91\x32\x06\xe3\x94\x97\xc8\xd2\x15\xbe\x5e\x94\xb3\x75\x92\xc0\x9c\x2f\xd8\x3a\x41\xc8\xf2\x4d\x10\xf6\x3d\x35\x8a\x8c\x99\x33\xe4\x96\x7d\x47\x0b\x4a\x2c\x16\xf6\x12\xf8\xde\x6e\xe4\x1d\x47\x9e\x00\x6f\x39\xf1\xd2\x89\x57\xfb\x11\xf8\x59\xbe\xf1\x43\x2b\x73\x12\xc6\x44\xae\xd3\x56\x1d\x9d\xf4\x7e\xe8\xd3\x51\x87\x0f\x3a\x56\x30\x8d\x1f\xe3\x0c\x23\xd7\xd1\x3f\x2d\x01\xf2\xed\x65\x96\xba\xb9\x2e\x36\x50\x2d\xa9\x11\xea\x2e\xcd\x53\x99\x67\x57\xbf\x96\x7c\x7b\x7a\xe8\xa8\xd2\x64\x1b\xf8\xd3\xff\x6a\xc5\x10\x12\xd4\xd0\x00\x5a\x15\x71\xca\x8a\x1d\x3c\xf3\x1d\x04\x52\x44\xb7\x2e\x43\x37\x7c\x70\x7f\x03\x00\x00\xff\xff\x10\xcb\x0a\xd7\x9e\x01\x00\x00")
|
||||
var __000001_initUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\xd2\xcf\x6f\x9b\x30\x14\x07\xf0\x33\xfc\x15\xef\x82\x00\x89\xf6\xb2\x29\x9a\xba\x93\x4b\x9d\x95\x8d\x1f\x15\xb8\x6b\xb3\x0b\xa5\xf8\xb1\x59\x03\x42\xb1\x23\x2d\xb2\xfc\xbf\x4f\x64\x24\xca\x92\xf4\xc6\x7b\x58\x1f\xbf\xf7\x95\xc3\x9c\x12\x46\x81\x91\xdb\x98\x42\xb4\x84\x34\x63\x40\x9f\xa3\x82\x15\xa0\xf5\xf5\x30\x62\x23\xfe\x18\xf3\xda\xae\xeb\xdf\x12\x3c\xdb\x12\x1c\xbe\x93\x3c\xbc\x27\xb9\xf7\x61\xe1\x07\xb6\xa5\xb5\x68\xe0\x7a\x58\x4b\xf5\x73\x44\x69\x8c\xe8\x25\x8e\xaa\xac\x14\xb0\x28\xa1\x05\x23\xc9\x03\xfb\xb1\x63\xd3\xc7\x38\x86\x3b\xba\x24\x8f\x31\x83\x34\x7b\xf2\xfc\x40\x6b\xec\xb9\x31\x7b\x45\xbe\xb5\x42\xe1\xb1\x71\x47\x18\x9d\x9c\x33\xc0\x2b\x58\xbe\x9c\xfe\x78\xae\xb3\xba\x72\xba\x2b\x87\x83\x73\x7f\xe3\x24\x37\x4e\xe3\x06\xe0\xa6\xd9\x93\xeb\x9f\x5d\xd0\x6d\xe5\x5b\x7b\xc9\xf7\x16\xfe\xe5\x19\x17\x47\xc6\x50\x8d\xd8\xab\xf2\x9d\x08\x66\xfb\x45\xd6\xbf\xb0\xab\x5e\xb4\xc6\x56\xa2\x31\xff\xca\xd9\x80\xdb\xe8\x4b\x94\xb2\xc0\xb6\xd4\x76\x40\x60\xf4\x79\xf7\x2d\x54\x7b\x28\x1a\x81\x2d\x97\x70\x1a\xeb\xd7\x22\x4b\xf7\xe4\x74\x72\x06\x03\xdb\xaa\x47\xac\x14\x4e\xcb\x1c\xf0\xcd\xc0\x4f\x5b\x1c\x5b\x3c\x69\x3d\xe4\x51\x42\xf2\x15\x7c\xa3\x2b\xf0\x04\x0f\xe0\x10\x8b\x6f\xfb\xff\xed\x34\xed\x4a\x42\x46\x73\x28\x28\x83\x8d\x6a\x3e\x75\xaf\x1f\x21\xcc\xe2\x78\x7a\x3b\x73\x5d\x6e\x7a\x51\xaf\x39\x96\xb5\x98\x87\xfb\x6c\xff\x0d\x00\x00\xff\xff\x89\x6c\x55\x1c\x5e\x02\x00\x00")
|
||||
|
||||
func _000001_initUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@ -119,8 +121,8 @@ func _000001_initUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000001_init.up.sql", size: 414, mode: os.FileMode(0644), modTime: time.Unix(1618744796, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xaa, 0x5e, 0xd9, 0x39, 0x7a, 0x33, 0xc4, 0x31, 0x1c, 0x17, 0x8a, 0x1c, 0xd3, 0xa4, 0xc8, 0x7f, 0x26, 0x92, 0x19, 0xc3, 0xb3, 0x1d, 0x8f, 0xd2, 0x23, 0x41, 0xf1, 0x36, 0xb1, 0x4, 0xa5, 0x2d}}
|
||||
info := bindataFileInfo{name: "000001_init.up.sql", size: 606, mode: os.FileMode(0644), modTime: time.Unix(1619000795, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x43, 0xd1, 0x62, 0x7b, 0x92, 0x98, 0x5d, 0x31, 0x51, 0x2c, 0xcc, 0xbe, 0x31, 0x80, 0x5a, 0xa1, 0xec, 0x9e, 0x99, 0x3f, 0x18, 0xe6, 0x1f, 0xfe, 0x15, 0x1d, 0x27, 0x2b, 0x3f, 0xc6, 0x45, 0x5f}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@ -139,12 +141,12 @@ func _000002_system_settings_tableDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000002_system_settings_table.down.sql", size: 39, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000002_system_settings_table.down.sql", size: 39, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x28, 0x3, 0x29, 0x5d, 0x28, 0xad, 0x1c, 0x15, 0xd, 0x2e, 0x84, 0xc8, 0xda, 0x3a, 0xd, 0x2f, 0xd8, 0x1e, 0xd1, 0x7f, 0xa1, 0xa1, 0x8d, 0x8b, 0xf3, 0x71, 0xa5, 0xc, 0x2d, 0x3a, 0x61, 0x62}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __000002_system_settings_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x0e\x72\x75\x0c\x71\x55\x08\x71\x74\xf2\x71\x55\xf0\x74\x53\xf0\xf3\x0f\x51\x70\x8d\xf0\x0c\x0e\x09\x56\xa8\xae\xd6\x2b\x28\x4a\x4d\xcb\xac\xa8\xad\x2d\xae\x2c\x2e\x49\xcd\x8d\x2f\x4e\x2d\x29\xc9\xcc\x4b\x2f\x56\xd0\xe0\xe2\xcc\x4c\x51\x08\x73\x0c\x72\xf6\x70\x0c\xd2\x30\x34\x30\xd0\xd4\xe1\xe2\x2c\x4b\xcc\x29\x4d\x55\x08\x71\x8d\x08\xd1\xe1\xe2\x0c\x08\xf2\xf4\x75\x0c\x8a\x54\xf0\x76\x8d\x54\xd0\xc8\x4c\xd1\xe4\xd2\xb4\xe6\x02\x04\x00\x00\xff\xff\xe4\x3d\xdb\x86\x6c\x00\x00\x00")
|
||||
var __000002_system_settings_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2c\xce\x4f\x6b\x83\x30\x18\x80\xf1\xb3\xf9\x14\xef\x51\x41\xc4\xc1\x0e\x83\x9d\xb2\xf0\x8e\xc9\xdc\x2c\xf1\xa5\xe8\x49\x5a\x13\x4b\x40\xed\x9f\xc4\x52\x09\xf9\xee\x45\xe8\xf1\x39\x3c\xf0\x13\x12\x39\x21\x10\xff\x2a\x11\x8a\x6f\xf8\xaf\x08\xb0\x29\x6a\xaa\xc1\xfb\xec\x72\xd3\x83\x79\x84\x60\x57\xeb\xf4\xd4\x59\xed\x9c\x99\x4f\x16\x62\x16\x19\x05\x7b\x2e\xc5\x0f\x97\xf1\x5b\x9e\x27\x29\x8b\xee\x87\x71\xd1\x40\xd8\x50\xca\xa2\x9d\x2c\xfe\xb8\x6c\xe1\x17\x5b\x88\x8d\x4a\x58\xe2\xbd\x19\x20\x9b\x56\x7b\x1d\x43\xd8\x3e\x2e\x08\x25\xd4\x48\xb0\xb8\xe1\x63\x3a\xbe\x83\xa8\xca\x72\xd3\xbc\xba\x5b\x66\xd3\x9f\x95\xee\x7a\xe3\xbd\x9e\x55\x08\x9f\xec\x19\x00\x00\xff\xff\x8e\xa2\x4f\x97\xb0\x00\x00\x00")
|
||||
|
||||
func _000002_system_settings_tableUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@ -159,8 +161,8 @@ func _000002_system_settings_tableUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000002_system_settings_table.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd3, 0xc5, 0xab, 0xe8, 0x30, 0x86, 0xbd, 0x6d, 0x70, 0x20, 0x8b, 0xc1, 0x7d, 0xc, 0xfa, 0xba, 0x3a, 0x71, 0x4b, 0xb7, 0x97, 0x5f, 0x39, 0x46, 0xa8, 0x50, 0x2f, 0x90, 0xfb, 0x1d, 0x45, 0xc}}
|
||||
info := bindataFileInfo{name: "000002_system_settings_table.up.sql", size: 176, mode: os.FileMode(0644), modTime: time.Unix(1618999481, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x40, 0x72, 0x7d, 0x99, 0x40, 0xa5, 0xcd, 0xcf, 0xb, 0x99, 0x78, 0xdc, 0x9f, 0x42, 0x2d, 0x60, 0x6, 0x7c, 0x77, 0x5b, 0x8, 0x1c, 0x2, 0x4f, 0x70, 0x57, 0x29, 0xfb, 0x24, 0x7f, 0x13, 0xce}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@ -179,7 +181,7 @@ func _000003_blocks_rootidDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000003_blocks_rootid.down.sql", size: 51, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000003_blocks_rootid.down.sql", size: 51, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdb, 0xfc, 0x77, 0x1b, 0xf7, 0x2e, 0x8c, 0xe9, 0x96, 0x14, 0x46, 0xde, 0xdc, 0x63, 0x52, 0x28, 0x40, 0xa6, 0x92, 0xda, 0x8c, 0x1, 0x31, 0x7, 0xa6, 0x61, 0x8a, 0x57, 0x6c, 0x58, 0x88, 0xe3}}
|
||||
return a, nil
|
||||
}
|
||||
@ -199,7 +201,7 @@ func _000003_blocks_rootidUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000003_blocks_rootid.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000003_blocks_rootid.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe1, 0x4c, 0xe5, 0xb, 0xa4, 0x83, 0xfc, 0x49, 0x39, 0x1d, 0x5b, 0xd0, 0xcf, 0xa3, 0x5e, 0x1f, 0x5c, 0x90, 0x97, 0x13, 0x1c, 0xcc, 0xd3, 0x6f, 0x3f, 0xa5, 0x6, 0x67, 0xfd, 0x4d, 0xc0, 0x55}}
|
||||
return a, nil
|
||||
}
|
||||
@ -219,12 +221,12 @@ func _000004_auth_tableDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000004_auth_table.down.sql", size: 61, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000004_auth_table.down.sql", size: 61, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7a, 0xd8, 0xba, 0x1, 0x9f, 0x51, 0xfb, 0x45, 0xd8, 0x3, 0xd8, 0xf7, 0x73, 0xee, 0x74, 0x38, 0x32, 0x52, 0x74, 0x99, 0xb7, 0xda, 0xc6, 0x7c, 0xcb, 0xe1, 0x68, 0x6a, 0x88, 0xea, 0x82, 0x70}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __000004_auth_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x90\x4d\x6b\xf3\x30\x10\x84\xcf\xd1\xaf\xd8\xa3\x0d\x21\xe4\x0d\xe4\xf4\x9e\x9c\xa0\xb6\xee\x87\x53\x6c\x51\x92\x93\x11\xd6\xba\x15\xf5\x87\xd0\x2a\x6d\x41\xe8\xbf\x17\x53\x68\xc0\x76\xa1\x97\xee\xf1\x99\xdd\x1d\x66\xf6\x39\x4f\x04\x07\x91\xec\xee\x39\xa4\x57\x90\x1d\x04\xf0\x63\x5a\x88\x02\xbc\x5f\x19\x8b\xb5\xfe\x08\xe1\x4c\x68\x09\x22\xb6\xd0\x0a\x9e\x92\x7c\x7f\x93\xe4\xd1\xbf\xf5\x3a\x5e\xb2\xc5\x20\x75\xb2\xc5\x31\xc7\x56\xea\xe6\x1b\x6e\xb6\xdb\x01\x1a\x49\xf4\xde\xdb\xc9\x93\xb6\x96\x25\x61\x65\xd1\x8d\x15\x79\x76\x2f\x25\xa1\x7d\xd3\xd5\xc5\x62\x73\x91\x94\x74\x72\xe4\x02\x00\x60\x6c\x6f\x08\xbe\xc6\x7b\x5d\xc3\xca\xf4\xe4\x9e\x2d\x52\x08\xb7\xc5\x21\xf3\x1e\x1b\xc2\x10\x04\x3f\x0a\xef\xb1\x53\x21\x2c\xd9\xa2\xb2\x28\x1d\x96\xd2\x0d\x67\xbb\xf4\x3a\xcd\xc4\x90\xd0\xa8\x19\xaa\xb0\xc1\x29\x7d\xcc\xd3\x87\x24\x3f\xc1\x1d\x3f\x41\xa4\x55\xcc\xe2\xff\x8c\xfd\xae\x63\x42\x22\xdd\x77\x3f\xd4\xec\xfa\x57\xec\xe6\xba\x2f\xa7\xbb\x7f\x1f\x7e\x2e\xe6\x67\x00\x00\x00\xff\xff\x12\x88\x10\xd4\x4a\x02\x00\x00")
|
||||
var __000004_auth_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x91\x4d\x4b\x33\x31\x14\x85\xd7\x9d\x5f\x71\x97\x2d\x94\xd2\xb7\xbc\x05\xc1\xd5\x74\x88\x3a\x5a\x5b\x99\x09\xd2\xae\x86\x38\xb9\xa3\xc1\xf9\x32\x37\xe3\x07\x21\xff\x5d\x42\x8b\x85\x4e\x05\x37\xcd\x2e\xcf\x49\x72\x6e\xce\x89\x12\x16\x72\x06\x3c\x5c\x2c\x19\xc4\x57\xb0\x5a\x73\x60\x9b\x38\xe5\x29\x58\x3b\x69\x35\x16\xea\xd3\xb9\x8e\x50\x13\x0c\x83\x81\x92\xf0\x18\x26\xd1\x4d\x98\x0c\xff\x4d\xa7\xa3\x71\x30\xf0\x52\x2d\x2a\x3c\xe6\x58\x09\x55\xfe\xc0\xd9\x7c\xee\x61\x2b\x88\x3e\x1a\xdd\x7b\xa4\x2a\x44\x46\x98\x6b\x34\xc7\x8a\xe8\xcc\x4b\x46\xa8\xdf\x55\x7e\xb0\x98\x1d\x24\x29\x8c\xe8\xb9\xe8\xa6\x25\xd8\x2d\x6b\x55\x01\x93\xb6\x21\xf3\xac\x91\x9c\xbb\x4d\xd7\x2b\x6b\xb1\x24\x74\x8e\xb3\x0d\xb7\x16\x6b\xe9\xdc\x38\x18\xe4\x1a\x85\xc1\x4c\x18\x7f\x6d\x11\x5f\xc7\x2b\xee\xbf\xd7\xca\x13\x54\x62\x89\x7d\xfa\x90\xc4\xf7\x61\xb2\x85\x3b\xb6\x85\xa1\x92\xa3\x60\xb4\x73\xaf\xbe\xe8\xad\x74\xce\x8f\x18\x46\x9c\x25\x90\x32\x0e\x9d\x29\x2e\xaa\xa7\xff\x10\xad\x97\x4b\xdf\xc0\x7e\x9f\x75\xb5\xca\x1b\x89\x59\xae\xf6\xa3\x5d\x06\xc1\xdf\x4a\x22\x24\x52\x4d\xfd\x4b\x4f\xa6\x79\xc5\xfa\x54\x79\x59\xff\xec\xf9\x03\x3c\x57\x54\xdf\x01\x00\x00\xff\xff\xdb\x28\x46\xba\xcf\x02\x00\x00")
|
||||
|
||||
func _000004_auth_tableUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@ -239,8 +241,8 @@ func _000004_auth_tableUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000004_auth_table.up.sql", size: 586, mode: os.FileMode(0644), modTime: time.Unix(1618744810, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf7, 0x6a, 0x32, 0x84, 0x81, 0xf1, 0xb5, 0x51, 0x66, 0xea, 0x48, 0x31, 0xc9, 0x75, 0x2c, 0x6d, 0xdf, 0x72, 0xe3, 0x5, 0x6b, 0xbd, 0x6, 0x5d, 0x65, 0xeb, 0x92, 0x81, 0xdc, 0x54, 0x44, 0xdd}}
|
||||
info := bindataFileInfo{name: "000004_auth_table.up.sql", size: 719, mode: os.FileMode(0644), modTime: time.Unix(1618999481, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0x2a, 0x2f, 0x56, 0xeb, 0xae, 0x3, 0xbc, 0x18, 0xe5, 0xd4, 0x55, 0x31, 0x7c, 0x3c, 0x5a, 0x11, 0x56, 0x3, 0xe3, 0x9d, 0xa6, 0xe2, 0xcc, 0x90, 0x99, 0x5c, 0x29, 0xc0, 0x7b, 0x3d, 0x4e}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@ -259,7 +261,7 @@ func _000005_blocks_modifiedbyDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000005_blocks_modifiedby.down.sql", size: 55, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000005_blocks_modifiedby.down.sql", size: 55, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x76, 0x4b, 0x62, 0xaa, 0x59, 0xd0, 0x49, 0xb4, 0x9f, 0x2e, 0xfd, 0xe7, 0xad, 0x59, 0x4b, 0xb7, 0x8d, 0x94, 0xa2, 0x87, 0x42, 0xd3, 0x68, 0xc9, 0x61, 0x59, 0x8d, 0x68, 0xff, 0x3b, 0xd5, 0xdb}}
|
||||
return a, nil
|
||||
}
|
||||
@ -279,7 +281,7 @@ func _000005_blocks_modifiedbyUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000005_blocks_modifiedby.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000005_blocks_modifiedby.up.sql", size: 66, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8e, 0x1, 0xd8, 0x3, 0x3a, 0xc0, 0x92, 0x34, 0xa8, 0xd, 0x85, 0x3, 0x86, 0x9c, 0x16, 0x13, 0x2f, 0x83, 0xc7, 0x70, 0xed, 0xcb, 0x63, 0xca, 0xba, 0xd5, 0x94, 0x99, 0x39, 0xfd, 0xf8, 0x35}}
|
||||
return a, nil
|
||||
}
|
||||
@ -299,12 +301,12 @@ func _000006_sharing_tableDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000006_sharing_table.down.sql", size: 31, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000006_sharing_table.down.sql", size: 31, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x31, 0x98, 0x81, 0xe, 0xc8, 0x13, 0xd0, 0x6a, 0x21, 0xec, 0x11, 0x2b, 0x65, 0x78, 0x8b, 0x69, 0x2e, 0x94, 0xa2, 0xe7, 0xf9, 0xc4, 0xbd, 0x18, 0xfc, 0x2, 0x2, 0x5b, 0xc5, 0xdc, 0x78, 0x38}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __000006_sharing_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\xcc\x41\x0b\x82\x30\x14\x00\xe0\xf3\xf6\x2b\xde\x51\x41\xc2\x08\xba\x74\x9a\xb2\x6a\x64\x1a\x73\x44\x9e\x64\xb2\x67\x3d\x2a\x15\x33\x28\xc4\xff\x1e\x5d\x3a\x74\xff\xf8\x62\x2d\x85\x91\x60\x44\x94\x48\x50\x6b\x48\x33\x03\xf2\xa4\x72\x93\xc3\x38\xce\xba\x1e\x6b\x7a\x4d\xd3\xe3\x62\x7b\x6a\xce\xe0\x71\x46\x0e\x8e\x42\xc7\x5b\xa1\xbd\xc5\xd2\x0f\x38\xc3\xc6\x56\x37\x74\x10\x65\x59\x22\x45\x1a\x70\x36\xb4\x57\x6c\x7e\x6a\x1e\x86\x5f\x76\x6f\x1d\xd5\x84\xae\xac\xde\x7f\xc1\xb3\x73\x76\xc0\xd2\x0e\x10\xa9\x8d\x4a\x4d\xc0\xd9\x41\xab\xbd\xd0\x05\xec\x64\x01\x1e\x39\x9f\xfb\x2b\xfe\x09\x00\x00\xff\xff\x7b\xf0\x53\xc5\xaa\x00\x00\x00")
|
||||
var __000006_sharing_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\xcf\x51\x4b\x84\x40\x14\x05\xe0\x67\xe7\x57\xdc\x47\x05\x59\x36\x8a\x08\x7a\x1a\x65\xaa\x21\xd3\x18\x87\x68\x9f\x44\xf7\x5e\xeb\xd2\x3a\x6e\xbb\x0a\xc9\x30\xff\x3d\x84\xe8\x61\x1f\x0f\x7c\xe7\xc0\xc9\x8d\x92\x56\x81\x95\x59\xa1\x40\x3f\x40\x59\x59\x50\xef\xba\xb6\x35\x78\xbf\x39\x9e\xa8\xe7\x9f\x10\xce\x9f\xed\x89\xdd\x07\xc4\x22\x62\x84\x37\x69\xf2\x27\x69\xe2\xeb\xdb\x24\x15\x11\xb9\xb6\x3b\x10\x42\x56\x55\x85\x92\x65\x2a\xa2\x69\xfc\x22\xf7\xaf\xae\xb6\xdb\x95\x0d\x23\x72\xcf\x84\x4d\xb7\x5c\x0c\xcc\x47\x6c\x27\x6a\xda\x09\x32\xfd\xa8\x4b\x9b\x8a\xe8\xd5\xe8\x17\x69\x76\xf0\xac\x76\x10\x33\x26\x22\xf1\x9e\x7b\xd8\x0c\xcb\xf9\xfb\x10\xc2\x5a\x96\xb9\x55\x06\x6a\x65\x61\x9e\xfa\xbb\xa1\xbb\x81\xbc\x2a\x8a\xf5\xcb\x5f\x6e\x66\xc7\xfb\x11\xa9\xd9\xb3\xf7\xe4\x30\x84\x7b\xf1\x1b\x00\x00\xff\xff\xc9\xca\x17\x02\xee\x00\x00\x00")
|
||||
|
||||
func _000006_sharing_tableUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@ -319,8 +321,8 @@ func _000006_sharing_tableUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000006_sharing_table.up.sql", size: 170, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x35, 0xdc, 0x29, 0xae, 0x1f, 0xe1, 0x7f, 0xf5, 0x9, 0xa0, 0xb3, 0x72, 0x3c, 0xbe, 0x7e, 0x40, 0x9c, 0x8d, 0xab, 0x6c, 0x1a, 0x71, 0xf1, 0xaa, 0x4d, 0x17, 0x7c, 0x23, 0xf1, 0x52, 0x78, 0x88}}
|
||||
info := bindataFileInfo{name: "000006_sharing_table.up.sql", size: 238, mode: os.FileMode(0644), modTime: time.Unix(1618999481, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc2, 0x4f, 0x32, 0xd, 0xa9, 0xaf, 0x1d, 0x24, 0xb4, 0x4c, 0x57, 0x8e, 0x73, 0xa9, 0xb7, 0xd1, 0xd1, 0xb7, 0x38, 0x71, 0xd7, 0x56, 0x15, 0xdb, 0xdf, 0xf4, 0x9b, 0xa2, 0xc9, 0x8e, 0x73, 0x2b}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@ -339,12 +341,12 @@ func _000007_workspaces_tableDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000007_workspaces_table.down.sql", size: 34, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000007_workspaces_table.down.sql", size: 34, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfc, 0xb1, 0x2b, 0x90, 0x8a, 0xcb, 0xe0, 0xd8, 0x87, 0x62, 0xcf, 0x86, 0x6b, 0xc9, 0x9c, 0x86, 0x21, 0xa4, 0x87, 0xad, 0x47, 0x49, 0xc5, 0x49, 0x34, 0xe2, 0x24, 0x49, 0x4e, 0x9a, 0x3d, 0x5a}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __000007_workspaces_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\xcd\x31\x4b\xc4\x30\x18\x87\xf1\xb9\xf9\x14\xff\xb1\x85\x72\x9c\x08\x2e\x4e\xb9\x23\x6a\xb4\xf6\x24\x8d\x72\x37\x95\x6a\xde\x96\x70\xda\x84\x26\x45\x25\xe4\xbb\x0b\x0e\x0e\xce\x0f\x3c\xbf\xbd\x12\x5c\x0b\x68\xbe\x6b\x04\xe4\x0d\xda\x83\x86\x38\xca\x4e\x77\x48\x69\xe3\x17\x1a\xed\x57\xce\x9f\x6e\x39\x07\x3f\xbc\x51\x40\xc9\x0a\x6b\xf0\xc2\xd5\xfe\x8e\xab\xf2\xf2\xaa\xaa\x59\x11\xec\x34\xaf\xbe\x8f\xee\x4c\xf3\x5f\xba\xd8\x6e\xab\xdf\x5d\xfb\xdc\x34\x35\x03\x80\x40\x31\xda\x79\x0a\x48\xc9\x8e\xd8\x78\x17\xe2\xb4\x50\xc8\xf9\xbe\x3b\xb4\x29\xd1\x7b\xa0\x9c\xb5\x38\xea\x94\x68\x36\x39\xd7\xac\xf8\x70\xc6\x8e\x96\x4c\xff\xfa\xfd\x0f\x5d\xbd\x19\x22\xf5\x43\xc4\x4e\xde\xca\x56\xd7\xac\x78\x52\xf2\x91\xab\x13\x1e\xc4\x09\xa5\x35\x15\xab\xae\xd9\x4f\x00\x00\x00\xff\xff\xa9\xe8\x77\xfe\xe1\x00\x00\x00")
|
||||
var __000007_workspaces_tableUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8f\x51\x4f\x83\x30\x14\x85\x9f\xe9\xaf\xb8\x8f\x90\x90\x65\x46\x63\x4c\x7c\xea\x48\x55\x14\xc1\x94\x6a\xb6\x27\xc2\xe8\x85\x34\x1b\x50\x69\x89\x2e\x4d\xff\xbb\x41\x17\x1f\xf6\x78\x73\xcf\x39\xdf\x39\x09\x67\x54\x30\x10\x74\x93\x31\x48\x1f\x20\x2f\x04\xb0\x6d\x5a\x8a\x12\x9c\x5b\xe9\x09\x5b\xf5\xed\xfd\xd7\x38\x1d\x8c\xae\x1b\x34\x10\x92\x40\x49\xf8\xa0\x3c\x79\xa2\x3c\xbc\xbe\x8d\x62\x12\x18\xd5\x0d\xb3\xae\xec\x78\xc0\xe1\xff\x75\xb5\x5e\x47\xbf\x71\xf9\x7b\x96\x2d\x22\xb4\x56\x0d\x9d\x01\xe7\x54\x0b\x2b\x3d\x1a\xdb\x4d\x68\xbc\x7f\x2e\x8b\xdc\x39\x3c\x1a\xf4\x5e\xb0\xad\x70\x0e\x07\xe9\x7d\x4c\x82\x7e\x94\xaa\x55\x28\xab\xfd\xe9\x82\x38\x6b\x59\x5b\xac\x6a\x0b\x9b\xf4\x31\xcd\x45\x4c\x82\x37\x9e\xbe\x52\xbe\x83\x17\xb6\x83\x50\xc9\x88\x44\x7f\xa0\xfe\x64\x3e\x8f\xde\x2f\x66\x9a\x08\xc6\xa1\x64\x02\x66\xdb\xde\xf5\xfb\x1b\x48\x8a\x2c\x5b\xf6\x9f\xef\x6a\x1e\x54\x33\x4a\xac\x1a\x75\x6e\x71\x4f\x7e\x02\x00\x00\xff\xff\x26\xb1\xb4\x1a\x22\x01\x00\x00")
|
||||
|
||||
func _000007_workspaces_tableUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
@ -359,8 +361,8 @@ func _000007_workspaces_tableUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000007_workspaces_table.up.sql", size: 225, mode: os.FileMode(0644), modTime: time.Unix(1618744821, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9d, 0x1d, 0x53, 0xf9, 0xc1, 0x96, 0x7d, 0xe6, 0x71, 0x1e, 0x8e, 0x9c, 0x66, 0x1b, 0x43, 0xbd, 0xd9, 0x95, 0x7e, 0x6e, 0xc7, 0xab, 0x3c, 0x63, 0x22, 0x14, 0xd2, 0x4f, 0x3b, 0xec, 0x9e, 0x88}}
|
||||
info := bindataFileInfo{name: "000007_workspaces_table.up.sql", size: 290, mode: os.FileMode(0644), modTime: time.Unix(1618999481, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6a, 0x56, 0x7c, 0x1c, 0x3f, 0x9c, 0xde, 0x4d, 0x7e, 0x8f, 0xf7, 0xdd, 0x8c, 0x67, 0x79, 0xd6, 0x84, 0x9c, 0x35, 0xd9, 0x38, 0x59, 0xde, 0xed, 0x80, 0xe6, 0xec, 0xb7, 0x20, 0xe6, 0x1d, 0x25}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
@ -379,7 +381,7 @@ func _000008_teamsDownSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000008_teams.down.sql", size: 173, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000008_teams.down.sql", size: 173, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x71, 0xde, 0xad, 0x3b, 0xef, 0xf1, 0xd1, 0x17, 0x44, 0xee, 0x1d, 0x30, 0x33, 0x15, 0xa9, 0x84, 0x99, 0xe7, 0x6e, 0xbf, 0x8c, 0xa4, 0x4, 0xd6, 0x68, 0xab, 0x77, 0x68, 0x13, 0x74, 0x1, 0x5d}}
|
||||
return a, nil
|
||||
}
|
||||
@ -399,11 +401,51 @@ func _000008_teamsUpSql() (*asset, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000008_teams.up.sql", size: 304, mode: os.FileMode(0644), modTime: time.Unix(1618643384, 0)}
|
||||
info := bindataFileInfo{name: "000008_teams.up.sql", size: 304, mode: os.FileMode(0644), modTime: time.Unix(1618930216, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xad, 0x91, 0xe6, 0xdf, 0x66, 0x76, 0x63, 0x68, 0x70, 0x8c, 0x30, 0x66, 0xf0, 0xc3, 0xa8, 0x76, 0xff, 0xe3, 0x59, 0x99, 0x49, 0xd, 0x90, 0xf5, 0xf4, 0x10, 0xeb, 0x6e, 0x0, 0x2c, 0x67, 0xeb}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __000009_blocks_historyDownSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x72\x09\xf2\x0f\x50\x08\x71\x74\xf2\x71\x55\xa8\xae\xd6\x2b\x28\x4a\x4d\xcb\xac\xa8\xad\x4d\xca\xc9\x4f\xce\x2e\xb6\xe6\x72\xf4\x09\x71\x0d\xc2\x25\x1d\x9f\x91\x59\x5c\x92\x5f\x54\xa9\x10\xe4\xea\xe7\xe8\xeb\xaa\x10\xe2\x8f\xcd\x08\x40\x00\x00\x00\xff\xff\x38\xe5\xec\x7a\x61\x00\x00\x00")
|
||||
|
||||
func _000009_blocks_historyDownSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__000009_blocks_historyDownSql,
|
||||
"000009_blocks_history.down.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _000009_blocks_historyDownSql() (*asset, error) {
|
||||
bytes, err := _000009_blocks_historyDownSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000009_blocks_history.down.sql", size: 97, mode: os.FileMode(0644), modTime: time.Unix(1618999481, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x78, 0x56, 0x8b, 0xdc, 0x49, 0x6, 0xe2, 0x3a, 0x1f, 0x77, 0xd4, 0xb3, 0xd0, 0x8e, 0xac, 0xb9, 0xfe, 0xa0, 0x69, 0x42, 0x7c, 0xb2, 0x25, 0xa7, 0x1e, 0x29, 0xce, 0xe0, 0x27, 0x38, 0x2, 0x45}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var __000009_blocks_historyUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x93\x41\x6f\x9b\x4c\x10\x86\xcf\xe6\x57\xcc\x05\x19\x3e\x39\xd1\x27\xb5\x8a\xaa\x58\xaa\x44\xf0\xd8\xde\x16\x76\xa3\x65\xd3\xc4\xbd\x10\x1b\x96\x7a\x15\x6c\x08\x8b\x95\x5a\x88\xff\x5e\x91\x62\xc7\xc1\xb6\x7a\xa8\x7a\x63\x76\x96\x67\xde\x99\x79\xd7\xf1\x04\x72\x10\xce\x8d\x87\x50\x55\x97\x79\x21\x13\xf5\xb3\xae\x17\x69\x16\x3d\x69\xe0\x48\x1d\x1f\x41\xb0\xe3\x5c\xb8\x54\xba\xcc\x8a\xed\xd0\x70\x39\x3a\x02\x5b\x06\x19\x03\x65\x02\xf0\x81\x04\x22\x38\x41\xb4\x8c\x9e\x8a\xe1\x9b\xc3\xdd\xa9\xc3\xad\x0f\x57\xf6\xc0\xe8\x55\x95\x4a\xe0\x32\xcf\x74\xf9\xa3\x90\xba\xae\xd5\x5a\xcb\xa2\x0c\xe7\x25\x08\xe2\x63\x20\x1c\xff\x56\x7c\x7f\xc5\xd2\x3b\xcf\x83\x11\x8e\x9d\x3b\x4f\x00\x65\xf7\x96\x3d\xa8\x2a\xb9\x8e\xeb\x7a\x47\xd1\xcf\xa9\x2a\xe5\x21\x63\xe4\x08\x6c\x38\x47\x00\x2b\x10\x7c\xdc\x64\xac\xbe\x39\xbb\x30\x57\x17\x66\x0c\xe6\xf4\xda\xf4\xaf\xcd\xa4\x3f\x80\x3e\x65\xf7\x7d\xfb\xa8\xc0\x6a\xab\x9f\xd3\x53\x7c\xeb\xca\x3e\xad\xf1\xea\x80\x91\xcf\x0b\xb9\x2e\xc3\x33\x23\x68\xd9\x8f\x3a\x5a\xca\xd5\xfc\xb1\xaa\x64\xaa\x65\x5d\xff\x0e\x5b\x06\xdc\x90\x09\xa1\x62\x60\xf4\xca\x6d\x2e\x41\xe0\xc3\xeb\xb7\x2a\xd3\x7d\x90\x28\x99\xc6\x1a\xba\x63\xfd\x12\x30\xba\x43\x36\x37\x5b\xe0\xc0\xe8\x45\x85\x9c\x97\xb2\x69\x66\x0f\xdf\xe4\x71\xf7\x28\x96\xa9\xec\x1c\x15\x59\x76\xa2\x99\x55\x16\xab\x44\xc9\x38\x5c\x6c\x3b\x99\x97\xac\x78\xd2\xf9\x3c\x92\xc7\x3f\xdd\x72\xe2\x3b\x7c\x06\x5f\x71\x06\x96\x8a\x6d\xc3\x7e\x37\x93\xe6\xa6\xe3\x36\x5e\x0d\x50\xc0\xa6\x4c\x3e\xad\x16\x1f\xc1\x65\x9e\xd7\x78\xaf\x8d\xc3\xcd\x5a\x45\x59\x2c\xc3\x48\xb5\xcd\x0d\x0d\xe3\x1d\xc6\x20\x34\x40\x2e\x80\x4c\x28\xe3\x08\x84\x9e\xb2\x36\x58\x01\x7a\xe8\x0a\xf8\x0f\xc6\x9c\xf9\xe7\xbd\x0f\x8c\x8f\x90\xc3\xcd\x0c\x0e\xec\x80\x81\x6b\x0f\x8d\xdd\xc6\xbb\x4b\xd8\x0b\xf8\x47\x95\x81\x51\x70\x19\x1d\x7b\xc4\x15\x30\x62\x8d\x23\xa7\x84\x4e\xba\x82\x76\xcf\x64\x27\x87\xf1\x3f\x8c\xe4\x2f\x75\xbd\xd5\x1f\xa1\x87\x02\xcf\x60\xe0\x65\x29\x0b\x09\x6f\x4e\xfb\x0c\xff\x0f\x8d\x5f\x01\x00\x00\xff\xff\x65\x8e\xe8\x4e\xa4\x04\x00\x00")
|
||||
|
||||
func _000009_blocks_historyUpSqlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
__000009_blocks_historyUpSql,
|
||||
"000009_blocks_history.up.sql",
|
||||
)
|
||||
}
|
||||
|
||||
func _000009_blocks_historyUpSql() (*asset, error) {
|
||||
bytes, err := _000009_blocks_historyUpSqlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "000009_blocks_history.up.sql", size: 1188, mode: os.FileMode(0644), modTime: time.Unix(1619002349, 0)}
|
||||
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8f, 0x40, 0x97, 0x74, 0xb5, 0xd, 0x55, 0x3d, 0x3c, 0xb6, 0x9d, 0xfb, 0xec, 0xab, 0xe5, 0x1a, 0xb7, 0x1f, 0xca, 0xd2, 0x23, 0x20, 0x27, 0x48, 0xc, 0xda, 0xd6, 0x5f, 0xcc, 0x66, 0x35, 0xa6}}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
@ -511,6 +553,8 @@ var _bindata = map[string]func() (*asset, error){
|
||||
"000007_workspaces_table.up.sql": _000007_workspaces_tableUpSql,
|
||||
"000008_teams.down.sql": _000008_teamsDownSql,
|
||||
"000008_teams.up.sql": _000008_teamsUpSql,
|
||||
"000009_blocks_history.down.sql": _000009_blocks_historyDownSql,
|
||||
"000009_blocks_history.up.sql": _000009_blocks_historyUpSql,
|
||||
}
|
||||
|
||||
// AssetDebug is true if the assets were built with the debug flag enabled.
|
||||
@ -573,6 +617,8 @@ var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"000007_workspaces_table.up.sql": {_000007_workspaces_tableUpSql, map[string]*bintree{}},
|
||||
"000008_teams.down.sql": {_000008_teamsDownSql, map[string]*bintree{}},
|
||||
"000008_teams.up.sql": {_000008_teamsUpSql, map[string]*bintree{}},
|
||||
"000009_blocks_history.down.sql": {_000009_blocks_historyDownSql, map[string]*bintree{}},
|
||||
"000009_blocks_history.up.sql": {_000009_blocks_historyUpSql, map[string]*bintree{}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory.
|
||||
|
@ -1,8 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS {{.prefix}}blocks (
|
||||
id VARCHAR(36),
|
||||
insert_at {{if .postgres}}TIMESTAMPTZ NOT NULL DEFAULT NOW(){{else}}DATETIME NOT NULL DEFAULT(STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')){{end}},
|
||||
{{if .postgres}}insert_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),{{end}}
|
||||
{{if .sqlite}}insert_at DATETIME NOT NULL DEFAULT(STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')),{{end}}
|
||||
{{if .mysql}}insert_at DATETIME(6) NOT NULL DEFAULT NOW(6),{{end}}
|
||||
parent_id VARCHAR(36),
|
||||
schema BIGINT,
|
||||
{{if .mysql}}`schema`{{else}}schema{{end}} BIGINT,
|
||||
type TEXT,
|
||||
title TEXT,
|
||||
fields {{if .postgres}}JSON{{else}}TEXT{{end}},
|
||||
@ -10,4 +12,4 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}blocks (
|
||||
update_at BIGINT,
|
||||
delete_at BIGINT,
|
||||
PRIMARY KEY (id, insert_at)
|
||||
);
|
||||
){{if .mysql}}CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci{{end}};
|
||||
|
@ -2,4 +2,4 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}system_settings (
|
||||
id VARCHAR(100),
|
||||
value TEXT,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
){{if .mysql}}CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci{{end}};
|
||||
|
@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}users (
|
||||
update_at BIGINT,
|
||||
delete_at BIGINT,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
){{if .mysql}}CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci{{end}};
|
||||
|
||||
CREATE TABLE IF NOT EXISTS {{.prefix}}sessions (
|
||||
id VARCHAR(100),
|
||||
@ -21,4 +21,4 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}sessions (
|
||||
create_at BIGINT,
|
||||
update_at BIGINT,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
){{if .mysql}}CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci{{end}};
|
||||
|
@ -5,4 +5,4 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}sharing (
|
||||
modified_by VARCHAR(36),
|
||||
update_at BIGINT,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
){{if .mysql}}CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci{{end}};
|
||||
|
@ -5,4 +5,4 @@ CREATE TABLE IF NOT EXISTS {{.prefix}}workspaces (
|
||||
modified_by VARCHAR(36),
|
||||
update_at BIGINT,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
){{if .mysql}}CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci{{end}};
|
||||
|
@ -0,0 +1,2 @@
|
||||
DROP TABLE {{.prefix}}blocks;
|
||||
ALTER TABLE {{.prefix}}blocks_history RENAME TO {{.prefix}}blocks;
|
@ -0,0 +1,30 @@
|
||||
ALTER TABLE {{.prefix}}blocks RENAME TO {{.prefix}}blocks_history;
|
||||
CREATE TABLE IF NOT EXISTS {{.prefix}}blocks (
|
||||
id VARCHAR(36),
|
||||
{{if .postgres}}insert_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),{{end}}
|
||||
{{if .sqlite}}insert_at DATETIME NOT NULL DEFAULT(STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')),{{end}}
|
||||
{{if .mysql}}insert_at DATETIME(6) NOT NULL DEFAULT NOW(6),{{end}}
|
||||
parent_id VARCHAR(36),
|
||||
{{if .mysql}}`schema`{{else}}schema{{end}} BIGINT,
|
||||
type TEXT,
|
||||
title TEXT,
|
||||
fields {{if .postgres}}JSON{{else}}TEXT{{end}},
|
||||
create_at BIGINT,
|
||||
update_at BIGINT,
|
||||
delete_at BIGINT,
|
||||
root_id VARCHAR(36),
|
||||
modified_by VARCHAR(36),
|
||||
workspace_id VARCHAR(36),
|
||||
PRIMARY KEY (id)
|
||||
){{if .mysql}}CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci{{end}};
|
||||
|
||||
{{if .mysql}}
|
||||
INSERT IGNORE INTO {{.prefix}}blocks (SELECT * FROM {{.prefix}}blocks_history ORDER BY insert_at DESC);
|
||||
{{end}}
|
||||
{{if .postgres}}
|
||||
INSERT INTO {{.prefix}}blocks (SELECT * FROM {{.prefix}}blocks_history ORDER BY insert_at DESC) ON CONFLICT DO NOTHING;
|
||||
{{end}}
|
||||
{{if .sqlite}}
|
||||
INSERT OR IGNORE INTO {{.prefix}}blocks SELECT * FROM {{.prefix}}blocks_history ORDER BY insert_at DESC;
|
||||
{{end}}
|
||||
DELETE FROM {{.prefix}}blocks where delete_at > 0;
|
@ -0,0 +1,2 @@
|
||||
DROP TABLE {{.prefix}}blocks;
|
||||
ALTER TABLE {{.prefix}}blocks_history RENAME TO {{.prefix}}blocks;
|
@ -0,0 +1,2 @@
|
||||
DROP TABLE {{.prefix}}blocks;
|
||||
ALTER TABLE {{.prefix}}blocks_history RENAME TO {{.prefix}}blocks;
|
@ -27,8 +27,12 @@ func (s *SQLStore) UpsertSharing(c store.Container, sharing model.Sharing) error
|
||||
sharing.Token,
|
||||
sharing.ModifiedBy,
|
||||
now,
|
||||
).
|
||||
Suffix("ON CONFLICT (id) DO UPDATE SET enabled = EXCLUDED.enabled, token = EXCLUDED.token, modified_by = EXCLUDED.modified_by, update_at = EXCLUDED.update_at")
|
||||
)
|
||||
if s.dbType == mysqlDBType {
|
||||
query = query.Suffix("ON DUPLICATE KEY UPDATE enabled = ?, token = ?, modified_by = ?, update_at = ?", sharing.Enabled, sharing.Token, sharing.ModifiedBy, now)
|
||||
} else {
|
||||
query = query.Suffix("ON CONFLICT (id) DO UPDATE SET enabled = EXCLUDED.enabled, token = EXCLUDED.token, modified_by = EXCLUDED.modified_by, update_at = EXCLUDED.update_at")
|
||||
}
|
||||
|
||||
_, err := query.Exec()
|
||||
return err
|
||||
|
@ -7,6 +7,12 @@ import (
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
)
|
||||
|
||||
const (
|
||||
mysqlDBType = "mysql"
|
||||
sqliteDBType = "sqlite3"
|
||||
postgresDBType = "postgres"
|
||||
)
|
||||
|
||||
// SQLStore is a SQL database.
|
||||
type SQLStore struct {
|
||||
db *sql.DB
|
||||
@ -62,7 +68,20 @@ func (s *SQLStore) Shutdown() error {
|
||||
}
|
||||
|
||||
func (s *SQLStore) getQueryBuilder() sq.StatementBuilderType {
|
||||
builder := sq.StatementBuilder.PlaceholderFormat(sq.Dollar)
|
||||
builder := sq.StatementBuilder
|
||||
if s.dbType == postgresDBType || s.dbType == sqliteDBType {
|
||||
builder = builder.PlaceholderFormat(sq.Dollar)
|
||||
}
|
||||
|
||||
return builder.RunWith(s.db)
|
||||
}
|
||||
|
||||
func (s *SQLStore) escapeField(fieldName string) string {
|
||||
if s.dbType == mysqlDBType {
|
||||
return "`" + fieldName + "`"
|
||||
}
|
||||
if s.dbType == postgresDBType || s.dbType == sqliteDBType {
|
||||
return "\"" + fieldName + "\""
|
||||
}
|
||||
return fieldName
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
func SetupTests(t *testing.T) (store.Store, func()) {
|
||||
dbType := os.Getenv("FB_STORE_TEST_DB_TYPE")
|
||||
if dbType == "" {
|
||||
dbType = "sqlite3"
|
||||
dbType = sqliteDBType
|
||||
}
|
||||
|
||||
connectionString := os.Getenv("FB_STORE_TEST_CONN_STRING")
|
||||
|
@ -26,8 +26,12 @@ func (s *SQLStore) UpsertWorkspaceSignupToken(workspace model.Workspace) error {
|
||||
workspace.SignupToken,
|
||||
workspace.ModifiedBy,
|
||||
now,
|
||||
).
|
||||
Suffix("ON CONFLICT (id) DO UPDATE SET signup_token = EXCLUDED.signup_token, modified_by = EXCLUDED.modified_by, update_at = EXCLUDED.update_at")
|
||||
)
|
||||
if s.dbType == mysqlDBType {
|
||||
query = query.Suffix("ON DUPLICATE KEY UPDATE signup_token = ?, modified_by = ?, update_at = ?", workspace.SignupToken, workspace.ModifiedBy, now)
|
||||
} else {
|
||||
query = query.Suffix("ON CONFLICT (id) DO UPDATE SET signup_token = EXCLUDED.signup_token, modified_by = EXCLUDED.modified_by, update_at = EXCLUDED.update_at")
|
||||
}
|
||||
|
||||
_, err := query.Exec()
|
||||
return err
|
||||
@ -54,8 +58,12 @@ func (s *SQLStore) UpsertWorkspaceSettings(workspace model.Workspace) error {
|
||||
settingsJSON,
|
||||
workspace.ModifiedBy,
|
||||
now,
|
||||
).
|
||||
Suffix("ON CONFLICT (id) DO UPDATE SET settings = EXCLUDED.settings, modified_by = EXCLUDED.modified_by, update_at = EXCLUDED.update_at")
|
||||
)
|
||||
if s.dbType == mysqlDBType {
|
||||
query = query.Suffix("ON DUPLICATE KEY UPDATE settings = ?, modified_by = ?, update_at = ?", settingsJSON, workspace.ModifiedBy, now)
|
||||
} else {
|
||||
query = query.Suffix("ON CONFLICT (id) DO UPDATE SET settings = EXCLUDED.settings, modified_by = EXCLUDED.modified_by, update_at = EXCLUDED.update_at")
|
||||
}
|
||||
|
||||
_, err = query.Exec()
|
||||
return err
|
||||
@ -68,7 +76,7 @@ func (s *SQLStore) GetWorkspace(ID string) (*model.Workspace, error) {
|
||||
Select(
|
||||
"id",
|
||||
"signup_token",
|
||||
"COALESCE(\"settings\", '{}')",
|
||||
"COALESCE(settings, '{}')",
|
||||
"modified_by",
|
||||
"update_at",
|
||||
).
|
||||
|
@ -146,6 +146,7 @@ func testGetSubTree2(t *testing.T, store store.Store, container store.Container)
|
||||
}
|
||||
|
||||
InsertBlocks(t, store, container, blocksToInsert)
|
||||
defer DeleteBlocks(t, store, container, blocksToInsert, "test")
|
||||
|
||||
blocks, err = store.GetAllBlocks(container)
|
||||
require.NoError(t, err)
|
||||
@ -221,6 +222,7 @@ func testGetSubTree3(t *testing.T, store store.Store, container store.Container)
|
||||
}
|
||||
|
||||
InsertBlocks(t, store, container, blocksToInsert)
|
||||
defer DeleteBlocks(t, store, container, blocksToInsert, "test")
|
||||
|
||||
blocks, err = store.GetAllBlocks(container)
|
||||
require.NoError(t, err)
|
||||
@ -299,6 +301,7 @@ func testGetRootID(t *testing.T, store store.Store, container store.Container) {
|
||||
}
|
||||
|
||||
InsertBlocks(t, store, container, blocksToInsert)
|
||||
defer DeleteBlocks(t, store, container, blocksToInsert, "test")
|
||||
|
||||
blocks, err = store.GetAllBlocks(container)
|
||||
require.NoError(t, err)
|
||||
@ -368,6 +371,7 @@ func testGetParentID(t *testing.T, store store.Store, container store.Container)
|
||||
}
|
||||
|
||||
InsertBlocks(t, store, container, blocksToInsert)
|
||||
defer DeleteBlocks(t, store, container, blocksToInsert, "test")
|
||||
|
||||
blocks, err = store.GetAllBlocks(container)
|
||||
require.NoError(t, err)
|
||||
@ -416,6 +420,7 @@ func testDeleteBlock(t *testing.T, store store.Store, container store.Container)
|
||||
},
|
||||
}
|
||||
InsertBlocks(t, store, container, blocksToInsert)
|
||||
defer DeleteBlocks(t, store, container, blocksToInsert, "test")
|
||||
|
||||
blocks, err = store.GetAllBlocks(container)
|
||||
require.NoError(t, err)
|
||||
|
Loading…
Reference in New Issue
Block a user