Fix missing status column in import that affects auto-migrated

installations.

In v0.7.0's automatic DB migration, the default value 'enabled'
of subscribers.status was missed incorrectly, causing imports to
break on auto-upgraded versions. This is now fixed by explictly
inserting the status field in CSV imports.
This commit is contained in:
Kailash Nadh 2020-09-02 11:40:34 +05:30
parent 26390e9994
commit d219f6549e
1 changed files with 2 additions and 2 deletions

View File

@ -75,8 +75,8 @@ SELECT id from sub;
-- Upserts a subscriber where existing subscribers get their names and attributes overwritten. -- Upserts a subscriber where existing subscribers get their names and attributes overwritten.
-- If $6 = true, update values, otherwise, skip. -- If $6 = true, update values, otherwise, skip.
WITH sub AS ( WITH sub AS (
INSERT INTO subscribers as s (uuid, email, name, attribs) INSERT INTO subscribers as s (uuid, email, name, attribs, status)
VALUES($1, $2, $3, $4) VALUES($1, $2, $3, $4, 'enabled')
ON CONFLICT (email) ON CONFLICT (email)
DO UPDATE SET DO UPDATE SET
name=(CASE WHEN $6 THEN $3 ELSE s.name END), name=(CASE WHEN $6 THEN $3 ELSE s.name END),