mirror of https://github.com/zulip/zulip.git
migrations: Update 0516 to handle invites with non-default streams.
We update the existing migration, because any deployment which had invitations with non-default streams in this state cannot have proceeded past this migration yet.
This commit is contained in:
parent
3f80bc1b41
commit
a1a14527db
|
@ -30,16 +30,18 @@ WHERE id IN (WITH too_many_confirmations
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
NO_CONFIRMATIONS = """
|
NO_CONFIRMATIONS_TEMP_TABLE = """
|
||||||
DELETE FROM zerver_preregistrationuser
|
CREATE TEMPORARY TABLE zerver_0516_no_confirmations AS (
|
||||||
WHERE NOT EXISTS(SELECT 1
|
SELECT id FROM zerver_preregistrationuser
|
||||||
FROM confirmation_confirmation
|
WHERE NOT EXISTS(SELECT 1
|
||||||
WHERE content_type_id = (SELECT id
|
FROM confirmation_confirmation
|
||||||
FROM django_content_type
|
WHERE content_type_id = (SELECT id
|
||||||
WHERE app_label = 'zerver'
|
FROM django_content_type
|
||||||
AND model = 'preregistrationuser')
|
WHERE app_label = 'zerver'
|
||||||
AND object_id = zerver_preregistrationuser.id)
|
AND model = 'preregistrationuser')
|
||||||
AND referred_by_id IS NOT NULL
|
AND object_id = zerver_preregistrationuser.id)
|
||||||
|
AND referred_by_id IS NOT NULL
|
||||||
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,5 +57,14 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RunSQL(TOO_MANY_CONFIRMATIONS, elidable=True),
|
migrations.RunSQL(TOO_MANY_CONFIRMATIONS, elidable=True),
|
||||||
migrations.RunSQL(NO_CONFIRMATIONS, elidable=True),
|
migrations.RunSQL(NO_CONFIRMATIONS_TEMP_TABLE, elidable=True),
|
||||||
|
migrations.RunSQL(
|
||||||
|
"DELETE FROM zerver_preregistrationuser_streams WHERE preregistrationuser_id IN (SELECT id FROM zerver_0516_no_confirmations)",
|
||||||
|
elidable=True,
|
||||||
|
),
|
||||||
|
migrations.RunSQL(
|
||||||
|
"DELETE FROM zerver_preregistrationuser WHERE id IN (SELECT id FROM zerver_0516_no_confirmations)",
|
||||||
|
elidable=True,
|
||||||
|
),
|
||||||
|
migrations.RunSQL("DROP TABLE zerver_0516_no_confirmations", elidable=True),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue