Sha256: e2824fd1e9825cfd2080334e41052ec5e28f8f8eca9ee4b5838b55bc56de38ed

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

class CreateLoggableActivities < ActiveRecord::Migration[7.1]
  def change
    create_table :loggable_activities, id: :uuid, default: 'gen_random_uuid()' do |t|
      t.string :action
      t.references :actor, polymorphic: true, null: true, type: :uuid
      t.string :actor_display_name
      t.string :record_display_name
      t.references :record, polymorphic: true, null: true, type: :uuid

      t.timestamps
    end

    create_table :loggable_payloads, id: :uuid, default: 'gen_random_uuid()' do |t|
      t.references :activity, foreign_key: { to_table: 'loggable_activities', class_name: '::LoggableActivity::Activity' }, type: :uuid
      t.references :encryption_key, null: false, foreign_key: { to_table: 'loggable_encryption_keys', class_name: '::LoggableActivity::EncryptionKey' }, type: :uuid
      t.references :record, polymorphic: true, null: true, type: :uuid
      t.json :encrypted_attrs
      t.integer :related_to_activity_as, default: 0
      t.string :route
    end

    create_table :loggable_encryption_keys, id: :uuid, default: 'gen_random_uuid()' do |t|
      t.string :secret_key
      # t.references :parent_key, foreign_key: { to_table: 'loggable_encryption_keys', type: :uuid }
      # t.references :record, polymorphic: true, type: :uuid
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
loggable_activity-0.2.1c lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb
loggable_activity-0.2.1 lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb
loggable_activity-0.1.59 lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb
loggable_activity-0.1.58 lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb