Sha256: 5eab723b78a483dd1bf0b4f56ea0d14f20df3df411cff4eac1eb790f97193693

Contents?: true

Size: 1.58 KB

Versions: 5

Compression:

Stored size: 1.58 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.3.2 db/migrate/02_active_metadata_migrations.rb
active_metadata-0.3.1 db/migrate/02_active_metadata_migrations.rb
active_metadata-0.3.0 db/migrate/02_active_metadata_migrations.rb
active_metadata-0.2.4 db/migrate/02_active_metadata_migrations.rb
active_metadata-0.2.3 db/migrate/02_active_metadata_migrations.rb