Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20210317104301_create_in_product_marketing_emails.rb')
-rw-r--r--db/migrate/20210317104301_create_in_product_marketing_emails.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/db/migrate/20210317104301_create_in_product_marketing_emails.rb b/db/migrate/20210317104301_create_in_product_marketing_emails.rb
new file mode 100644
index 00000000000..b8c6b952c97
--- /dev/null
+++ b/db/migrate/20210317104301_create_in_product_marketing_emails.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class CreateInProductMarketingEmails < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ UNIQUE_INDEX_NAME = 'index_in_product_marketing_emails_on_user_track_series'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ create_table :in_product_marketing_emails do |t|
+ t.bigint :user_id, null: false
+ t.datetime_with_timezone :cta_clicked_at
+ t.integer :track, null: false, limit: 2
+ t.integer :series, null: false, limit: 2
+
+ t.timestamps_with_timezone
+ end
+ end
+
+ add_index :in_product_marketing_emails, :user_id
+ add_index :in_product_marketing_emails, [:user_id, :track, :series], unique: true, name: UNIQUE_INDEX_NAME
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :in_product_marketing_emails
+ end
+ end
+end