Skip to content

Commit

Permalink
made everything use memtx
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-ares committed Mar 24, 2023
1 parent 16d14f8 commit bd10aac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
12 changes: 6 additions & 6 deletions tokenomics/DDL.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,28 @@ box.execute([[CREATE INDEX IF NOT EXISTS balances_amount_words_ix ON balances (a
--************************************************************************************************************************************
-- processed_add_balance_commands
box.execute([[CREATE TABLE IF NOT EXISTS processed_add_balance_commands (
user_id STRING NOT NULL,
user_id STRING NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
key STRING NOT NULL,
PRIMARY KEY (user_id, key)
)
WITH ENGINE = 'vinyl';]])
WITH ENGINE = 'memtx';]])
--************************************************************************************************************************************
-- processed_seen_news
box.execute([[CREATE TABLE IF NOT EXISTS processed_seen_news (
user_id STRING NOT NULL,
user_id STRING NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
news_id STRING NOT NULL,
PRIMARY KEY (user_id, news_id)
)
WITH ENGINE = 'vinyl';]])
WITH ENGINE = 'memtx';]])
--************************************************************************************************************************************
-- mining_sessions_dlq
for worker_index=0,%[2]v do
box.execute([[CREATE TABLE IF NOT EXISTS mining_sessions_dlq_]] .. worker_index .. [[ (
id STRING NOT NULL PRIMARY KEY,
user_id STRING NOT NULL,
user_id STRING NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
message STRING NOT NULL
)
WITH ENGINE = 'vinyl';]])
WITH ENGINE = 'memtx';]])
end
--************************************************************************************************************************************
-- extra_bonuses
Expand Down
15 changes: 0 additions & 15 deletions tokenomics/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,6 @@ func (s *usersTableSource) deleteUser(ctx context.Context, usr *users.User) erro
if _, err := storage.CheckSQLDMLResponse(s.db.PrepareExecute(sql, params)); err != nil {
return errors.Wrapf(err, "failed to delete userID:%v", usr.ID)
}
sql = `DELETE FROM processed_add_balance_commands
WHERE user_id = :user_id`
if _, err := storage.CheckSQLDMLResponse(s.db.PrepareExecute(sql, params)); err != nil {
return errors.Wrapf(err, "failed to delete processed_add_balance_commands userID:%v", usr.ID)
}
sql = `DELETE FROM processed_seen_news
WHERE user_id = :user_id`
if _, err := storage.CheckSQLDMLResponse(s.db.PrepareExecute(sql, params)); err != nil {
return errors.Wrapf(err, "failed to delete processed_seen_news userID:%v", usr.ID)
}
sql = fmt.Sprintf(`DELETE FROM mining_sessions_dlq_%v
WHERE user_id = :user_id`, usr.HashCode%s.cfg.WorkerCount)
if _, err := storage.CheckSQLDMLResponse(s.db.PrepareExecute(sql, params)); err != nil {
return errors.Wrapf(err, "failed to delete mining_sessions_dlq_%v userID:%v", usr.HashCode%s.cfg.WorkerCount, usr.ID)
}

return nil
}
Expand Down

0 comments on commit bd10aac

Please sign in to comment.