Skip to content

Add NOT NULL constraint to track and series columns

What does this MR do and why?

The only case when track and series could be NULL if build_ios_app_guide_email experiment was enabled. However this experiment has never been enabled. Accordingly to Database Lab there are 0 records with empty track or series in production. Also based on the original issue it's only SaaS feature. And with the cleanup we removed the only place where empty track or series occur. So I believe it's safe to add NOT NULL back to these fields

Migrate
== 20231121133727 ChangeMarketingEmailsNullConditions: migrating ==============
-- current_schema(nil)
   -> 0.0012s
-- transaction_open?(nil)
   -> 0.0000s
-- transaction_open?(nil)
   -> 0.0000s
-- execute("ALTER TABLE in_product_marketing_emails\nADD CONSTRAINT check_c9bb978e4b\nCHECK ( track IS NOT NULL )\nNOT VALID;\n")
   -> 0.0028s
-- current_schema(nil)
   -> 0.0006s
-- transaction_open?(nil)
   -> 0.0000s
-- transaction_open?(nil)
   -> 0.0000s
-- execute("ALTER TABLE in_product_marketing_emails\nADD CONSTRAINT check_ee6c42a107\nCHECK ( series IS NOT NULL )\nNOT VALID;\n")
   -> 0.0021s
== 20231121133727 ChangeMarketingEmailsNullConditions: migrated (0.0734s) =====
Rollback
== 20231121133727 ChangeMarketingEmailsNullConditions: reverting ==============
-- transaction_open?(nil)
   -> 0.0000s
-- transaction_open?(nil)
   -> 0.0000s
-- execute("            ALTER TABLE in_product_marketing_emails\n            DROP CONSTRAINT IF EXISTS check_c9bb978e4b\n")
   -> 0.0030s
-- transaction_open?(nil)
   -> 0.0000s
-- transaction_open?(nil)
   -> 0.0000s
-- execute("            ALTER TABLE in_product_marketing_emails\n            DROP CONSTRAINT IF EXISTS check_ee6c42a107\n")
   -> 0.0005s
== 20231121133727 ChangeMarketingEmailsNullConditions: reverted (0.0305s) =====

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #430949 (closed)

Edited by Serhii Yarynovskyi

Merge request reports