Sha256: 08ae7ff6552227258c74cea7ac227b4ea3c043abdb59c0f101ead84189ce9e68

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

class ActiveMetadataMigrations < ActiveRecord::Migration
  def self.up

    create_table :notes do |t|
      t.text :note
      t.string :label
      t.string :document_class
      t.integer :document_id
      t.integer :created_by
      t.integer :updated_by      
      t.timestamps
    end

    add_index :notes, :document_id
    add_index :notes, :label
    add_index :notes, :updated_at

    create_table :histories do |t|
      t.text :value
      t.string :label
      t.string :document_class
      t.integer :document_id
      t.integer :created_by
      t.timestamps
    end

    add_index :histories, :document_id
    add_index :histories, :label
    add_index :histories, :created_at

    create_table :attachments do |t|
      t.string :label
      t.integer :document_id
      t.string :document_class
      t.integer :created_by
      t.integer :updated_by
      t.integer :counter
      t.string :attach_file_name
      t.string :attach_content_type
      t.integer :attach_file_size
      t.datetime :attach_updated_at
      t.timestamps
    end

    add_index :attachments, :document_id
    add_index :attachments, :label
    add_index :attachments, :attach_updated_at

    create_table :watchers do |t|
      t.integer :owner_id
      t.string :label
      t.string :document_class
      t.integer :document_id
      t.timestamps
    end

    add_index :watchers, :document_id
    add_index :watchers, :label
    add_index :watchers, :owner_id
    add_index :watchers, :created_at
        
  end

  def self.down
    drop_table :notes
    drop_table :histories
	drop_table :attachments
	drop_table :watchers
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_metadata-0.5.2 lib/templates/active_metadata_migrations
active_metadata-0.5.1 lib/templates/active_metadata_migrations
active_metadata-0.5.0 lib/templates/active_metadata_migrations
active_metadata-0.4.2 lib/templates/active_metadata_migrations
active_metadata-0.4.1 lib/templates/active_metadata_migrations