mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-06 01:25:28 +00:00
add migration of users, user_contacts and email_opt_in
This commit is contained in:
parent
ab1dd4a2c8
commit
fde236aa43
@ -10,7 +10,7 @@ Decimal.set({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const constants = {
|
const constants = {
|
||||||
DB_VERSION: '0047-messages_tables',
|
DB_VERSION: '0048-add_user_contacts_table',
|
||||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0
|
||||||
LOG4JS_CONFIG: 'log4js-config.json',
|
LOG4JS_CONFIG: 'log4js-config.json',
|
||||||
// default log level on production should be info
|
// default log level on production should be info
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
export { User } from './0047-add_user_contacts_table/User'
|
export { User } from './0048-add_user_contacts_table/User'
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
export { UserContact } from './0047-add_user_contacts_table/UserContact'
|
export { UserContact } from './0048-add_user_contacts_table/UserContact'
|
||||||
|
|||||||
@ -63,8 +63,10 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||||
// reconstruct the previous email back from contacts to users table
|
// this step comes after verification and test
|
||||||
await queryFn('ALTER TABLE users ADD COLUMN email varchar(255) NULL AFTER privkey;')
|
await queryFn('ALTER TABLE users ADD COLUMN email varchar(255) NULL AFTER privkey;')
|
||||||
|
|
||||||
|
// reconstruct the previous email back from contacts to users table
|
||||||
const contacts = await queryFn(`SELECT c.id, c.email, c.user_id FROM user_contacts as c`)
|
const contacts = await queryFn(`SELECT c.id, c.email, c.user_id FROM user_contacts as c`)
|
||||||
for (const id in contacts) {
|
for (const id in contacts) {
|
||||||
const contact = contacts[id]
|
const contact = contacts[id]
|
||||||
Loading…
x
Reference in New Issue
Block a user