Sha256: 9845fff887f84520682c734bbeaf75458214059834b608a1b5b8d8aff9048120

Contents?: true

Size: 912 Bytes

Versions: 56

Compression:

Stored size: 912 Bytes

Contents

class CreateActionTextTables < ActiveRecord::Migration[6.0]
  def change
    # Use Active Record's configured type for primary and foreign keys
    primary_key_type, foreign_key_type = primary_and_foreign_key_types

    create_table :action_text_rich_texts, id: primary_key_type do |t|
      t.string     :name, null: false
      t.text       :body, size: :long
      t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type

      t.timestamps

      t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true
    end
  end

  private
    def primary_and_foreign_key_types
      config = Rails.configuration.generators
      setting = config.options[config.orm][:primary_key_type]
      primary_key_type = setting || :primary_key
      foreign_key_type = setting || :bigint
      [primary_key_type, foreign_key_type]
    end
end

Version data entries

56 entries across 53 versions & 6 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/actiontext-7.1.3.4/db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.5.1 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.0.8.7 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.5 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.4.2 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.0.8.6 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.4.1 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.0.8.5 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.4 db/migrate/20180528164100_create_action_text_tables.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actiontext-7.1.3.4/db/migrate/20180528164100_create_action_text_tables.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actiontext-7.0.8.4/db/migrate/20180528164100_create_action_text_tables.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/actiontext-7.0.5.1/db/migrate/20180528164100_create_action_text_tables.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/actiontext-7.0.5.1/db/migrate/20180528164100_create_action_text_tables.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/actiontext-7.0.5.1/db/migrate/20180528164100_create_action_text_tables.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/actiontext-7.1.3.4/db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.3.4 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.0.8.4 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.3.2 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.1.3.1 db/migrate/20180528164100_create_action_text_tables.rb
actiontext-7.0.8.1 db/migrate/20180528164100_create_action_text_tables.rb