Class: Support

Inherits:
Netfira::WebConnect::Migration show all
Defined in:
lib/netfira/web_connect/db_schema/20140514_support.rb

Instance Method Summary collapse

Methods inherited from Netfira::WebConnect::Migration

#add_localized_string, #add_table_def, #create_file_table, #create_l10n_table, #create_record_table, #create_relation_table, #create_table, #schema_migrations_table_name, #write

Instance Method Details

#changeObject



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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/netfira/web_connect/db_schema/20140514_support.rb', line 4

def change

  create_table :_tables do |t|
    t.string :name, limit: 50, index: true
    t.string :origin_key, limit: 20
    t.boolean :file
    t.boolean :writable
    t.boolean :sendable
  end

  create_table :_shops do |t|
    t.string :name
    t.index :name, unique: true
  end

  Netfira::WebConnect::Models::Shop.create id: 0

  create_table :_settings do |t|
    t.references :shop, index: true
    t.string :key
    t.binary :value, limit: 0x10000
    t.string :content_type
  end

  create_table :_custom_fields do |t|
    t.references :shop
    t.references :table
    t.references :record
    t.string :key
    t.binary :value, limit: 0x10000
    t.index [:shop_id, :table_id, :record_id], name: 'index_custom_fields'
    t.index [:shop_id, :table_id, :record_id, :key], name: 'index_custom_fields_with_keys', unique: true
  end

  create_table :_sessions do |t|
    t.references :shop, index: true
    t.string :token, limit: 40, index: true
    t.datetime :expires_at
  end

end