remove back ticks in sql statement

This commit is contained in:
Moriz Wahl 2022-09-29 04:38:33 +02:00
parent 5bb6fd048d
commit 0ed12f878f

View File

@ -41,13 +41,13 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis
// merge values from login_email_opt_in table with users.email in new user_contacts table // merge values from login_email_opt_in table with users.email in new user_contacts table
await queryFn(` await queryFn(`
INSERT INTO \`user_contacts\` INSERT INTO user_contacts
(type, user_id, email, email_verification_code, email_opt_in_type_id, email_resend_count, email_checked, created_at, updated_at, deleted_at) (type, user_id, email, email_verification_code, email_opt_in_type_id, email_resend_count, email_checked, created_at, updated_at, deleted_at)
SELECT 'EMAIL', \`users\`.id, \`users\`.email, optin.\`verification_code\`, optin.\`email_opt_in_type_id\`, optin.\`resend_count\`, users.\`email_checked\`, users.created, null, users.deletedAt SELECT 'EMAIL', users.id, users.email, optin.verification_code, optin.email_opt_in_type_id, optin.resend_count, users.email_checked, users.created, null, users.deletedAt
FROM users LEFT JOIN FROM users LEFT JOIN
(SELECT le.id, le.user_id, le.verification_code, le.email_opt_in_type_id, le.resend_count, le.created, le.updated, (SELECT le.id, le.user_id, le.verification_code, le.email_opt_in_type_id, le.resend_count, le.created, le.updated,
ROW_NUMBER() OVER (PARTITION BY le.user_id ORDER BY le.created DESC) AS row_num ROW_NUMBER() OVER (PARTITION BY le.user_id ORDER BY le.created DESC) AS row_num
FROM login_email_opt_in as le) AS optin ON users.id = optin.\`user_id\` AND row_num = 1;`) FROM login_email_opt_in as le) AS optin ON users.id = optin.user_id AND row_num = 1;`)
// insert in users table the email_id of the new created email-contacts // insert in users table the email_id of the new created email-contacts
const contacts = await queryFn(`SELECT c.id, c.user_id FROM user_contacts as c`) const contacts = await queryFn(`SELECT c.id, c.user_id FROM user_contacts as c`)