Class: CreateGoogleSafeBrowsingShavar

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/rails/generators/google/model/templates/create_google_safe_browsing_shavar.rb

Class Method Summary collapse

Class Method Details

.downObject



22
23
24
# File 'lib/rails/generators/google/model/templates/create_google_safe_browsing_shavar.rb', line 22

def down
  drop_table :google_safe_browsing_shavars
end

.upObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rails/generators/google/model/templates/create_google_safe_browsing_shavar.rb', line 4

def up
  create_table :google_safe_browsing_shavars do |t|
    t.integer :chunk_num
    t.string :chunk_type, :limit => 1  # "a" or "s"
    t.string :host_key
    t.integer :add_chunk_num  # Only for sub shavar data, add shavar data will have it as NULL
    t.string :prefix
    t.integer :google_safe_browsing_list_id  # malware or phishing
  end

  add_index :google_safe_browsing_shavars, [:chunk_type, :host_key], :name => 'index_chunk_type_host'
  add_index :google_safe_browsing_shavars, [:chunk_type, :host_key, :prefix], :name => 'index_chunk_type_host_prefix'
  add_index :google_safe_browsing_shavars, [:chunk_type, :add_chunk_num, :host_key, :prefix], :name => 'index_add_chunk_host_prefix'

  add_index :google_safe_browsing_shavars, \
            [:google_safe_browsing_list_id, :chunk_type, :chunk_num, :host_key, :add_chunk_num, :prefix], :unique => true, :name => 'index_chunk_host_prefix'
end