Sha256: 0d5b53a116d1869a7462cd97f119c70f60ad0c6967b009ecf2546d1f6b3347f8

Contents?: true

Size: 1.48 KB

Versions: 9

Compression:

Stored size: 1.48 KB

Contents

class ActiveMetadataMigrations < ActiveRecord::Migration
  def self.up

    create_table :notes do |t|
      t.text :note
      t.string :label
      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.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.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.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

9 entries across 9 versions & 1 rubygems

Version Path
active_metadata-0.3.2 lib/templates/active_metadata_migrations
active_metadata-0.3.1 lib/templates/active_metadata_migrations
active_metadata-0.3.0 lib/templates/active_metadata_migrations
active_metadata-0.2.4 lib/templates/active_metadata_migrations
active_metadata-0.2.3 lib/templates/active_metadata_migrations
active_metadata-0.2.2 lib/templates/active_metadata_migrations
active_metadata-0.2.1 lib/templates/active_metadata_migrations
active_metadata-0.2.0 lib/templates/active_metadata_migrations
active_metadata-0.1.9 lib/templates/active_metadata_migrations