v12.0.0 - initial commit
This commit is contained in:
commit
e2c49ea43c
1145 changed files with 97211 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
var db = require('./db')
|
||||
|
||||
const singleQuotify = item => `'${item}'`
|
||||
|
||||
var types = [
|
||||
'highValueTransaction',
|
||||
'transaction',
|
||||
'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'
|
||||
);
|
||||
CREATE INDEX ON notifications (valid);
|
||||
CREATE INDEX ON notifications (read);`,
|
||||
]
|
||||
|
||||
db.runAll(sql, next)
|
||||
}
|
||||
|
||||
exports.down = function (next) {
|
||||
next()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue