class CreateSegmentorTables
Create the tables for the Segmentor
gem
Public Instance Methods
change()
click to toggle source
# File lib/generators/segmentor/templates/create_segmentor_tables.rb, line 5 def change create_table :segmentor_segments, force: true do |t| t.string :name t.string :description t.integer :generate_frequency, default: 0 t.integer :notify_frequency, default: 0 t.boolean :auto_activate, default: false t.timestamps end create_table :segmentor_sources, force: true do |t| t.string :type, null: false t.text :code, null: true t.references :segment, foreign_key: { to_table: :segmentor_segments }, index: { unique: true } t.timestamps end create_table :segmentor_notifier_contexts, force: true do |t| t.string :type, null: false t.references :segment, foreign_key: { to_table: :segmentor_segments } t.text :email_template, null: true # ::Segmentor::EmailNotifierContext t.text :template_name, null: true # ::Segmentor::PostmarkNotifierContext t.text :template_payload, null: true # ::Segmentor::PostmarkNotifierContext t.timestamps end create_table :segmentor_sessions, force: true do |t| t.references :segment, foreign_key: { to_table: :segmentor_segments } t.string :session_id, null: false, index: true t.text :reason, null: true t.integer :status, default: 0 t.timestamps end create_table :segmentor_targets, force: true do |t| t.references :session, foreign_key: { to_table: :segmentor_sessions } t.references :segment, foreign_key: { to_table: :segmentor_segments } t.integer :user_id t.json :payload t.timestamps end create_table :segmentor_receipts, force: true do |t| t.references :segment, foreign_key: { to_table: :segmentor_segments } t.integer :user_id, null: false t.json :metadata, null: true t.text :rendered_value, null: true t.datetime :sent_at t.timestamps end end