Class: CreateFiles

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/watch_tower/server/db/migrate/002_create_files.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/watch_tower/server/db/migrate/002_create_files.rb', line 4

def change
  create_table :files do |t|
    t.references :project, null: false
    t.string :path, null: false
    t.integer :elapsed_time, default: 0
    t.integer :time_entries_count
    t.integer :durations_count

    t.timestamps
  end

  add_index :files, :project_id
  add_index :files, :path, unique: true
end