create migration script for old data
This commit is contained in:
@@ -42,7 +42,9 @@ func NewLogsDatabase(cfg server.Config) (*Database, error) {
|
||||
|
||||
qqdb := sq.NewDB(xdb)
|
||||
|
||||
qqdb.AddListener(dbtools.DBLogger{})
|
||||
if conf.EnableLogger {
|
||||
qqdb.AddListener(dbtools.DBLogger{})
|
||||
}
|
||||
|
||||
pp, err := dbtools.NewDBPreprocessor(qqdb)
|
||||
if err != nil {
|
||||
@@ -56,6 +58,10 @@ func NewLogsDatabase(cfg server.Config) (*Database, error) {
|
||||
return scndb, nil
|
||||
}
|
||||
|
||||
func (db *Database) DB() sq.DB {
|
||||
return db.db
|
||||
}
|
||||
|
||||
func (db *Database) Migrate(ctx context.Context) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 24*time.Second)
|
||||
defer cancel()
|
||||
|
@@ -91,11 +91,12 @@ func (db *Database) CreateChannel(ctx TxContext, userid models.UserID, dispName
|
||||
|
||||
channelid := models.NewChannelID()
|
||||
|
||||
_, err = tx.Exec(ctx, "INSERT INTO channels (channel_id, owner_user_id, display_name, internal_name, subscribe_key, send_key, timestamp_created) VALUES (:cid, :ouid, :dnam, :inam, :subkey, :sendkey, :ts)", sq.PP{
|
||||
_, err = tx.Exec(ctx, "INSERT INTO channels (channel_id, owner_user_id, display_name, internal_name, description_name, subscribe_key, send_key, timestamp_created) VALUES (:cid, :ouid, :dnam, :inam, :hnam, :subkey, :sendkey, :ts)", sq.PP{
|
||||
"cid": channelid,
|
||||
"ouid": userid,
|
||||
"dnam": dispName,
|
||||
"inam": intName,
|
||||
"hnam": nil,
|
||||
"subkey": subscribeKey,
|
||||
"sendkey": sendKey,
|
||||
"ts": time2DB(now),
|
||||
|
@@ -42,7 +42,9 @@ func NewPrimaryDatabase(cfg server.Config) (*Database, error) {
|
||||
|
||||
qqdb := sq.NewDB(xdb)
|
||||
|
||||
qqdb.AddListener(dbtools.DBLogger{})
|
||||
if conf.EnableLogger {
|
||||
qqdb.AddListener(dbtools.DBLogger{})
|
||||
}
|
||||
|
||||
pp, err := dbtools.NewDBPreprocessor(qqdb)
|
||||
if err != nil {
|
||||
@@ -56,6 +58,10 @@ func NewPrimaryDatabase(cfg server.Config) (*Database, error) {
|
||||
return scndb, nil
|
||||
}
|
||||
|
||||
func (db *Database) DB() sq.DB {
|
||||
return db.db
|
||||
}
|
||||
|
||||
func (db *Database) Migrate(ctx context.Context) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 24*time.Second)
|
||||
defer cancel()
|
||||
|
@@ -42,7 +42,9 @@ func NewRequestsDatabase(cfg server.Config) (*Database, error) {
|
||||
|
||||
qqdb := sq.NewDB(xdb)
|
||||
|
||||
qqdb.AddListener(dbtools.DBLogger{})
|
||||
if conf.EnableLogger {
|
||||
qqdb.AddListener(dbtools.DBLogger{})
|
||||
}
|
||||
|
||||
pp, err := dbtools.NewDBPreprocessor(qqdb)
|
||||
if err != nil {
|
||||
@@ -56,6 +58,10 @@ func NewRequestsDatabase(cfg server.Config) (*Database, error) {
|
||||
return scndb, nil
|
||||
}
|
||||
|
||||
func (db *Database) DB() sq.DB {
|
||||
return db.db
|
||||
}
|
||||
|
||||
func (db *Database) Migrate(ctx context.Context) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 24*time.Second)
|
||||
defer cancel()
|
||||
|
Reference in New Issue
Block a user