Method: FreeZipcodeData::CountyTable#build

Defined in:
lib/free_zipcode_data/county_table.rb

#buildObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/free_zipcode_data/county_table.rb', line 7

def build
  schema = "    create table \#{tablename} (\n      id integer not null primary key,\n      state_id integer,\n      abbr varchar(255),\n      name varchar(255),\n      county_seat varchar(255)\n    )\n  SQL\n  database.execute_batch(schema)\n\n  ndx = <<-SQL\n    CREATE UNIQUE INDEX \"main\".\"unique_county\"\n    ON \#{tablename} (state_id, abbr, name COLLATE NOCASE ASC);\n  SQL\n  database.execute_batch(ndx)\nend\n"