lamassu-server/migrations/1607009558538-create-notifications-table.js
Cesar c457faab40 Chore: make notification center UI
Chore: fiatBalancesNotify refactor

Chore: removed now-unused code in some files

Feat: change column "detail" in database to use jsonb

Chore: add notification center background and button

Chore: notifications screen scaffolding

Fix: change position of notification UI

Feat: join backend and frontend

Feat: notification icons and machine names

Feat: add clear all button, stripe overlay on invalid notification

Fix: rework notification styles

Feat: use popper to render notifications

Feat: make notification center UI

Fix: fix css on notification center

Fix: fix invalidateNotification

Chore: apply PR requested changes

Fix: PR fixes

Fix: make toggleable body/root styles be handled by react

Chore: delete old notifier file

Fix: undo variable name changes for cryptobalance notifs
2021-02-04 15:48:23 +00:00

38 lines
926 B
JavaScript

var db = require('./db')
const singleQuotify = (item) => `'${item}'`
var types = [
'highValueTransaction',
'fiatBalance',
'cryptoBalance',
'compliance',
'error'
]
.map(singleQuotify)
.join(',')
exports.up = function (next) {
const sql = [
`
CREATE TYPE notification_type AS ENUM ${'(' + types + ')'};
CREATE TABLE "notifications" (
"id" uuid NOT NULL PRIMARY KEY,
"type" notification_type NOT NULL,
"detail" JSONB,
"message" TEXT NOT NULL,
"created" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
"read" BOOLEAN NOT NULL DEFAULT 'false',
"valid" BOOLEAN NOT NULL DEFAULT 'true',
"modified" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX ON notifications (valid);
CREATE INDEX ON notifications (read);`
]
db.multi(sql, next)
}
exports.down = function (next) {
next()
}