Class: CreateTables

Inherits:
Sequel::Migration
  • Object
show all
Defined in:
lib/lumix/schema/001_create_tables.rb

Instance Method Summary collapse

Instance Method Details

#downObject



30
31
32
33
# File 'lib/lumix/schema/001_create_tables.rb', line 30

def down
  drop_table :assoc
  drop_table :texts
end

#upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/lumix/schema/001_create_tables.rb', line 3

def up
  create_table :texts do
    primary_key :id
    String :digest
    String :text
    String :tagged
    String :filename
    String :tagged_filename

    index :digest
  end

  create_table :assoc do
    primary_key :id
    Integer :text_id, :references => :texts
    Integer :position
    Integer :src_begin
    Integer :src_end
    Integer :tagged_begin
    Integer :tagged_end

    index [:text_id, :tagged_end]
    index [:text_id, :tagged_begin]
    index [:text_id, :position]
  end
end