Sha256: 0cf9f3f0dfbc37cdd6cf7efc7c7edf5502cff9c00208cfa7e7abe7a139a0a9ca

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 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 :encrypted_actor_display_name
      t.string :encrypted_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 :record, polymorphic: true, null: true, type: :uuid
      t.json :encrypted_attrs
      t.integer :payload_type, default: 0
      t.boolean :data_owner, default: false
      t.references :activity, type: :uuid, foreign_key: { to_table: 'loggable_activities', class_name: 'LoggableActivity::Activity' }

      t.timestamps
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loggable_activity-0.1.56 lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb
loggable_activity-0.1.55 lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb
loggable_activity-0.1.54 lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb