addresses 1.0.11 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/addresses/application_controller.rb +2 -0
- data/app/controllers/addresses/cities_controller.rb +3 -1
- data/app/controllers/addresses/neighborhoods_controller.rb +4 -2
- data/app/controllers/addresses/states_controller.rb +5 -5
- data/app/controllers/addresses/zipcodes_controller.rb +7 -5
- data/app/models/addresses/address.rb +5 -2
- data/app/models/addresses/city.rb +5 -1
- data/app/models/addresses/country.rb +3 -0
- data/app/models/addresses/neighborhood.rb +4 -0
- data/app/models/addresses/state.rb +4 -0
- data/app/models/addresses/zipcode.rb +11 -39
- data/config/routes.rb +2 -0
- data/db/migrate/20140327141509_create_addresses_countries.rb +2 -1
- data/db/migrate/20140327163801_create_addresses_states.rb +2 -1
- data/db/migrate/20140327171527_create_addresses_cities.rb +2 -1
- data/db/migrate/20140327190411_create_addresses_neighborhoods.rb +2 -1
- data/db/migrate/20140328120418_create_addresses_addresses.rb +3 -1
- data/db/migrate/20160920172944_create_addresses_zipcodes.rb +2 -0
- data/db/migrate/20160920174406_remove_zipcode_attributes_from_addresses.rb +2 -0
- data/db/migrate/20191008052817_add_indexes.rb +21 -0
- data/lib/addresses.rb +3 -1
- data/lib/addresses/engine.rb +4 -2
- data/lib/tasks/addresses_tasks.rake +6 -6
- data/lib/tasks/populate/br/cities.rake +5573 -0
- data/lib/tasks/populate/br/countries.rake +247 -0
- data/lib/tasks/populate/br/neighborhoods.rake +40825 -0
- data/lib/tasks/populate/br/states.rake +35 -0
- data/lib/tasks/populate/br/zipcodes.rake +40 -0
- data/spec/controllers/addresses/cities_controller_spec.rb +1 -1
- data/spec/controllers/addresses/neighborhoods_controller_spec.rb +1 -1
- data/spec/controllers/addresses/states_controller_spec.rb +1 -1
- data/spec/controllers/addresses/zipcodes_controller_spec.rb +1 -1
- data/spec/dummy/Gemfile +1 -1
- data/spec/dummy/Gemfile.lock +107 -84
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{20190614190958_create_addresses_countries.addresses.rb → 20191008054118_create_addresses_countries.addresses.rb} +1 -0
- data/spec/dummy/db/migrate/{20190614190959_create_addresses_states.addresses.rb → 20191008054119_create_addresses_states.addresses.rb} +1 -0
- data/spec/dummy/db/migrate/{20190614190960_create_addresses_cities.addresses.rb → 20191008054120_create_addresses_cities.addresses.rb} +1 -0
- data/spec/dummy/db/migrate/{20190614190961_create_addresses_neighborhoods.addresses.rb → 20191008054121_create_addresses_neighborhoods.addresses.rb} +1 -0
- data/spec/dummy/db/migrate/{20190614190962_create_addresses_addresses.addresses.rb → 20191008054122_create_addresses_addresses.addresses.rb} +2 -0
- data/spec/dummy/db/migrate/{20190614190963_create_addresses_zipcodes.addresses.rb → 20191008054123_create_addresses_zipcodes.addresses.rb} +2 -0
- data/spec/dummy/db/migrate/{20190614190964_remove_zipcode_attributes_from_addresses.addresses.rb → 20191008054124_remove_zipcode_attributes_from_addresses.addresses.rb} +2 -0
- data/spec/dummy/db/migrate/20191008054125_add_indexes.addresses.rb +22 -0
- data/spec/dummy/db/schema.rb +36 -26
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +463 -0
- data/spec/dummy/log/test.log +9374 -0
- data/spec/factories/addresses.rb +3 -3
- data/spec/factories/cities.rb +2 -2
- data/spec/factories/countries.rb +3 -3
- data/spec/factories/neighborhoods.rb +2 -2
- data/spec/factories/states.rb +3 -3
- data/spec/factories/zipcodes.rb +3 -3
- data/spec/fixtures/zipcodes/br/ceps.txt +0 -0
- data/spec/models/addresses/address_spec.rb +3 -3
- data/spec/models/addresses/city_spec.rb +1 -1
- data/spec/models/addresses/country_spec.rb +1 -1
- data/spec/models/addresses/neighborhood_spec.rb +1 -1
- data/spec/models/addresses/state_spec.rb +1 -1
- data/spec/models/addresses/zipcode_spec.rb +1 -30
- data/spec/{spec_helper.rb → rails_helper.rb} +3 -4
- data/spec/requests/cities_spec.rb +1 -1
- data/spec/requests/neighborhoods_spec.rb +1 -1
- data/spec/requests/zipcodes_spec.rb +11 -5
- data/spec/routing/cities_routing_spec.rb +1 -1
- data/spec/routing/neighborhoods_routing_spec.rb +1 -1
- data/spec/routing/zipcodes_routing_spec.rb +1 -1
- metadata +42 -54
- data/README.rdoc +0 -55
- data/app/assets/javascripts/addresses/application.js +0 -13
- data/app/assets/stylesheets/addresses/application.css +0 -13
- data/app/helpers/addresses/application_helper.rb +0 -4
- data/app/services/zipcode_service.rb +0 -42
- data/lib/tasks/natal_city.rake +0 -50
- data/lib/tasks/populate_cities.rake +0 -5570
- data/lib/tasks/populate_countries.rake +0 -243
- data/lib/tasks/populate_neighborhoods.rake +0 -40823
- data/lib/tasks/populate_states.rake +0 -32
- data/spec/dummy/db/migrate/20190614190716_create_addresses_countries.addresses.rb +0 -13
- data/spec/services/zipcode_service_spec.rb +0 -29
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
namespace :br do
|
4
|
+
desc 'Populate Brazilian States'
|
5
|
+
task states: [:environment] do
|
6
|
+
puts 'Populating States'
|
7
|
+
Addresses::State.find_or_create_by(id: '28', name: 'Acre', acronym: 'AC', country_id: 33)
|
8
|
+
Addresses::State.find_or_create_by(id: '29', name: 'Alagoas', acronym: 'AL', country_id: 33)
|
9
|
+
Addresses::State.find_or_create_by(id: '30', name: 'Amazonas', acronym: 'AM', country_id: 33)
|
10
|
+
Addresses::State.find_or_create_by(id: '31', name: 'Amapá', acronym: 'AP', country_id: 33)
|
11
|
+
Addresses::State.find_or_create_by(id: '32', name: 'Bahia', acronym: 'BA', country_id: 33)
|
12
|
+
Addresses::State.find_or_create_by(id: '33', name: 'Ceará', acronym: 'CE', country_id: 33)
|
13
|
+
Addresses::State.find_or_create_by(id: '34', name: 'Brasília', acronym: 'DF', country_id: 33)
|
14
|
+
Addresses::State.find_or_create_by(id: '35', name: 'Espírito Santo', acronym: 'ES', country_id: 33)
|
15
|
+
Addresses::State.find_or_create_by(id: '36', name: 'Goiás', acronym: 'GO', country_id: 33)
|
16
|
+
Addresses::State.find_or_create_by(id: '37', name: 'Maranhão', acronym: 'MA', country_id: 33)
|
17
|
+
Addresses::State.find_or_create_by(id: '38', name: 'Minas Gerais', acronym: 'MG', country_id: 33)
|
18
|
+
Addresses::State.find_or_create_by(id: '39', name: 'Mato Grosso do Sul', acronym: 'MS', country_id: 33)
|
19
|
+
Addresses::State.find_or_create_by(id: '40', name: 'Mato Grosso', acronym: 'MT', country_id: 33)
|
20
|
+
Addresses::State.find_or_create_by(id: '41', name: 'Pará', acronym: 'PA', country_id: 33)
|
21
|
+
Addresses::State.find_or_create_by(id: '42', name: 'Paraíba', acronym: 'PB', country_id: 33)
|
22
|
+
Addresses::State.find_or_create_by(id: '43', name: 'Pernambuco', acronym: 'PE', country_id: 33)
|
23
|
+
Addresses::State.find_or_create_by(id: '44', name: 'Piauí', acronym: 'PI', country_id: 33)
|
24
|
+
Addresses::State.find_or_create_by(id: '45', name: 'Paraná', acronym: 'PR', country_id: 33)
|
25
|
+
Addresses::State.find_or_create_by(id: '46', name: 'Rio de Janeiro', acronym: 'RJ', country_id: 33)
|
26
|
+
Addresses::State.find_or_create_by(id: '47', name: 'Rio Grande do Norte', acronym: 'RN', country_id: 33)
|
27
|
+
Addresses::State.find_or_create_by(id: '48', name: 'Rondônia', acronym: 'RO', country_id: 33)
|
28
|
+
Addresses::State.find_or_create_by(id: '49', name: 'Roraima', acronym: 'RR', country_id: 33)
|
29
|
+
Addresses::State.find_or_create_by(id: '50', name: 'Rio Grande do Sul', acronym: 'RS', country_id: 33)
|
30
|
+
Addresses::State.find_or_create_by(id: '51', name: 'Santa Catarina', acronym: 'SC', country_id: 33)
|
31
|
+
Addresses::State.find_or_create_by(id: '52', name: 'Sergipe', acronym: 'SE', country_id: 33)
|
32
|
+
Addresses::State.find_or_create_by(id: '53', name: 'São Paulo', acronym: 'SP', country_id: 33)
|
33
|
+
Addresses::State.find_or_create_by(id: '54', name: 'Tocantins', acronym: 'TO', country_id: 33)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
namespace :populate do
|
4
|
+
namespace :br do
|
5
|
+
desc 'Populate Brazilian Zipcodes'
|
6
|
+
task zipcodes: [:environment] do
|
7
|
+
puts 'Populating Zipcodes'
|
8
|
+
File.readlines("#{Addresses::Engine.root}/fixtures/zipcodes/br/ceps.txt").each do |line|
|
9
|
+
zipcode_number, city_state, neighborhood_name, street_name = line.split(/\t/)
|
10
|
+
|
11
|
+
city_name = city_state.strip.split('/')[0]
|
12
|
+
state_acronym = city_state.split('/')[1][0..1]
|
13
|
+
|
14
|
+
next unless Addresses::Zipcode.find_by(number: zipcode_number.strip).nil?
|
15
|
+
|
16
|
+
state = Addresses::State.find_by(acronym: state_acronym)
|
17
|
+
|
18
|
+
city = state.cities.find_or_create_by(name: city_name)
|
19
|
+
|
20
|
+
unless neighborhood_name.blank?
|
21
|
+
neighborhood = city.neighborhoods.find_by(name: neighborhood_name.strip)
|
22
|
+
neighborhood = city.neighborhoods.create!(name: neighborhood_name) if neighborhood.nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
zipcode = Addresses::Zipcode.new
|
26
|
+
zipcode.city_id = city.id
|
27
|
+
zipcode.neighborhood_id = neighborhood.try(:id)
|
28
|
+
zipcode.street = street_name.strip
|
29
|
+
zipcode.number = zipcode_number.strip
|
30
|
+
|
31
|
+
if zipcode.valid?
|
32
|
+
zipcode.save!
|
33
|
+
else
|
34
|
+
puts "#{zipcode.inspect} invalid"
|
35
|
+
next
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/spec/dummy/Gemfile
CHANGED
data/spec/dummy/Gemfile.lock
CHANGED
@@ -1,113 +1,136 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
2
|
+
remote: ../..
|
3
3
|
specs:
|
4
|
-
addresses (
|
5
|
-
rails (~>
|
4
|
+
addresses (2.0)
|
5
|
+
rails (~> 6.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (
|
11
|
-
actionpack (=
|
12
|
-
nio4r (~>
|
13
|
-
websocket-driver (
|
14
|
-
|
15
|
-
actionpack (=
|
16
|
-
|
17
|
-
|
10
|
+
actioncable (6.0.0)
|
11
|
+
actionpack (= 6.0.0)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailbox (6.0.0)
|
15
|
+
actionpack (= 6.0.0)
|
16
|
+
activejob (= 6.0.0)
|
17
|
+
activerecord (= 6.0.0)
|
18
|
+
activestorage (= 6.0.0)
|
19
|
+
activesupport (= 6.0.0)
|
20
|
+
mail (>= 2.7.1)
|
21
|
+
actionmailer (6.0.0)
|
22
|
+
actionpack (= 6.0.0)
|
23
|
+
actionview (= 6.0.0)
|
24
|
+
activejob (= 6.0.0)
|
18
25
|
mail (~> 2.5, >= 2.5.4)
|
19
26
|
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (
|
21
|
-
actionview (=
|
22
|
-
activesupport (=
|
27
|
+
actionpack (6.0.0)
|
28
|
+
actionview (= 6.0.0)
|
29
|
+
activesupport (= 6.0.0)
|
23
30
|
rack (~> 2.0)
|
24
|
-
rack-test (
|
31
|
+
rack-test (>= 0.6.3)
|
25
32
|
rails-dom-testing (~> 2.0)
|
26
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
27
|
-
|
28
|
-
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
34
|
+
actiontext (6.0.0)
|
35
|
+
actionpack (= 6.0.0)
|
36
|
+
activerecord (= 6.0.0)
|
37
|
+
activestorage (= 6.0.0)
|
38
|
+
activesupport (= 6.0.0)
|
39
|
+
nokogiri (>= 1.8.5)
|
40
|
+
actionview (6.0.0)
|
41
|
+
activesupport (= 6.0.0)
|
29
42
|
builder (~> 3.1)
|
30
|
-
|
43
|
+
erubi (~> 1.4)
|
31
44
|
rails-dom-testing (~> 2.0)
|
32
|
-
rails-html-sanitizer (~> 1.
|
33
|
-
activejob (
|
34
|
-
activesupport (=
|
45
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
46
|
+
activejob (6.0.0)
|
47
|
+
activesupport (= 6.0.0)
|
35
48
|
globalid (>= 0.3.6)
|
36
|
-
activemodel (
|
37
|
-
activesupport (=
|
38
|
-
activerecord (
|
39
|
-
activemodel (=
|
40
|
-
activesupport (=
|
41
|
-
|
42
|
-
|
49
|
+
activemodel (6.0.0)
|
50
|
+
activesupport (= 6.0.0)
|
51
|
+
activerecord (6.0.0)
|
52
|
+
activemodel (= 6.0.0)
|
53
|
+
activesupport (= 6.0.0)
|
54
|
+
activestorage (6.0.0)
|
55
|
+
actionpack (= 6.0.0)
|
56
|
+
activejob (= 6.0.0)
|
57
|
+
activerecord (= 6.0.0)
|
58
|
+
marcel (~> 0.3.1)
|
59
|
+
activesupport (6.0.0)
|
43
60
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
-
i18n (
|
61
|
+
i18n (>= 0.7, < 2)
|
45
62
|
minitest (~> 5.1)
|
46
63
|
tzinfo (~> 1.1)
|
47
|
-
|
48
|
-
builder (3.2.
|
49
|
-
concurrent-ruby (1.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
64
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
65
|
+
builder (3.2.3)
|
66
|
+
concurrent-ruby (1.1.5)
|
67
|
+
crass (1.0.4)
|
68
|
+
erubi (1.9.0)
|
69
|
+
globalid (0.4.2)
|
70
|
+
activesupport (>= 4.2.0)
|
71
|
+
i18n (1.7.0)
|
72
|
+
concurrent-ruby (~> 1.0)
|
73
|
+
loofah (2.3.0)
|
74
|
+
crass (~> 1.0.2)
|
55
75
|
nokogiri (>= 1.5.9)
|
56
|
-
mail (2.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
rack (
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
actionmailer (=
|
75
|
-
actionpack (=
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
76
|
+
mail (2.7.1)
|
77
|
+
mini_mime (>= 0.1.1)
|
78
|
+
marcel (0.3.3)
|
79
|
+
mimemagic (~> 0.3.2)
|
80
|
+
method_source (0.9.2)
|
81
|
+
mimemagic (0.3.3)
|
82
|
+
mini_mime (1.0.2)
|
83
|
+
mini_portile2 (2.4.0)
|
84
|
+
minitest (5.12.2)
|
85
|
+
nio4r (2.5.2)
|
86
|
+
nokogiri (1.10.4)
|
87
|
+
mini_portile2 (~> 2.4.0)
|
88
|
+
rack (2.0.7)
|
89
|
+
rack-test (1.1.0)
|
90
|
+
rack (>= 1.0, < 3)
|
91
|
+
rails (6.0.0)
|
92
|
+
actioncable (= 6.0.0)
|
93
|
+
actionmailbox (= 6.0.0)
|
94
|
+
actionmailer (= 6.0.0)
|
95
|
+
actionpack (= 6.0.0)
|
96
|
+
actiontext (= 6.0.0)
|
97
|
+
actionview (= 6.0.0)
|
98
|
+
activejob (= 6.0.0)
|
99
|
+
activemodel (= 6.0.0)
|
100
|
+
activerecord (= 6.0.0)
|
101
|
+
activestorage (= 6.0.0)
|
102
|
+
activesupport (= 6.0.0)
|
103
|
+
bundler (>= 1.3.0)
|
104
|
+
railties (= 6.0.0)
|
83
105
|
sprockets-rails (>= 2.0.0)
|
84
|
-
rails-dom-testing (2.0.
|
85
|
-
activesupport (>= 4.2.0
|
86
|
-
nokogiri (
|
87
|
-
rails-html-sanitizer (1.0
|
88
|
-
loofah (~> 2.
|
89
|
-
railties (
|
90
|
-
actionpack (=
|
91
|
-
activesupport (=
|
106
|
+
rails-dom-testing (2.0.3)
|
107
|
+
activesupport (>= 4.2.0)
|
108
|
+
nokogiri (>= 1.6)
|
109
|
+
rails-html-sanitizer (1.3.0)
|
110
|
+
loofah (~> 2.3)
|
111
|
+
railties (6.0.0)
|
112
|
+
actionpack (= 6.0.0)
|
113
|
+
activesupport (= 6.0.0)
|
92
114
|
method_source
|
93
115
|
rake (>= 0.8.7)
|
94
|
-
thor (>= 0.
|
95
|
-
rake (
|
96
|
-
sprockets (3.7.
|
116
|
+
thor (>= 0.20.3, < 2.0)
|
117
|
+
rake (13.0.0)
|
118
|
+
sprockets (3.7.2)
|
97
119
|
concurrent-ruby (~> 1.0)
|
98
120
|
rack (> 1, < 3)
|
99
|
-
sprockets-rails (3.2.
|
121
|
+
sprockets-rails (3.2.1)
|
100
122
|
actionpack (>= 4.0)
|
101
123
|
activesupport (>= 4.0)
|
102
124
|
sprockets (>= 3.0.0)
|
103
|
-
sqlite3 (1.
|
104
|
-
thor (0.
|
105
|
-
thread_safe (0.3.
|
106
|
-
tzinfo (1.2.
|
125
|
+
sqlite3 (1.4.1)
|
126
|
+
thor (0.20.3)
|
127
|
+
thread_safe (0.3.6)
|
128
|
+
tzinfo (1.2.5)
|
107
129
|
thread_safe (~> 0.1)
|
108
|
-
websocket-driver (0.
|
130
|
+
websocket-driver (0.7.1)
|
109
131
|
websocket-extensions (>= 0.1.0)
|
110
|
-
websocket-extensions (0.1.
|
132
|
+
websocket-extensions (0.1.4)
|
133
|
+
zeitwerk (2.1.10)
|
111
134
|
|
112
135
|
PLATFORMS
|
113
136
|
ruby
|
@@ -117,4 +140,4 @@ DEPENDENCIES
|
|
117
140
|
sqlite3
|
118
141
|
|
119
142
|
BUNDLED WITH
|
120
|
-
1.
|
143
|
+
1.17.3
|
@@ -3,6 +3,7 @@ require File.expand_path('../boot', __FILE__)
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
5
|
Bundler.require(*Rails.groups)
|
6
|
+
|
6
7
|
require "addresses"
|
7
8
|
|
8
9
|
module Dummy
|
@@ -24,4 +25,3 @@ module Dummy
|
|
24
25
|
# Store::Engine.config.18n.default_locale = config.i18n.default_locale
|
25
26
|
end
|
26
27
|
end
|
27
|
-
|
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This migration comes from addresses (originally 20191008052817)
|
3
|
+
|
4
|
+
class AddIndexes < ActiveRecord::Migration[6.0]
|
5
|
+
def change
|
6
|
+
add_index :addresses_neighborhoods, :name
|
7
|
+
add_index :addresses_neighborhoods, [:name, :city_id]
|
8
|
+
|
9
|
+
add_index :addresses_countries, :name
|
10
|
+
add_index :addresses_countries, :acronym
|
11
|
+
|
12
|
+
add_index :addresses_cities, :name
|
13
|
+
add_index :addresses_cities, [:name, :state_id]
|
14
|
+
|
15
|
+
add_index :addresses_states, :name
|
16
|
+
add_index :addresses_states, [:name, :country_id]
|
17
|
+
|
18
|
+
add_index :addresses_zipcodes, :number
|
19
|
+
|
20
|
+
add_index :addresses_addresses, [:addressable_id, :addressable_type], name: :index_addresses_addressable
|
21
|
+
end
|
22
|
+
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -2,69 +2,79 @@
|
|
2
2
|
# of editing this file, please use the migrations feature of Active Record to
|
3
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# from scratch.
|
9
|
-
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `rails
|
6
|
+
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2019_10_08_054125) do
|
14
14
|
|
15
15
|
create_table "addresses_addresses", force: :cascade do |t|
|
16
|
-
t.string
|
17
|
-
t.string
|
18
|
-
t.integer
|
19
|
-
t.string
|
16
|
+
t.string "number"
|
17
|
+
t.string "complement"
|
18
|
+
t.integer "addressable_id"
|
19
|
+
t.string "addressable_type"
|
20
20
|
t.datetime "created_at"
|
21
21
|
t.datetime "updated_at"
|
22
|
-
t.integer
|
22
|
+
t.integer "zipcode_id"
|
23
|
+
t.index ["addressable_id", "addressable_type"], name: "index_addresses_addressable"
|
23
24
|
t.index ["addressable_id"], name: "index_addresses_addresses_on_addressable_id"
|
24
25
|
t.index ["zipcode_id"], name: "index_addresses_addresses_on_zipcode_id"
|
25
26
|
end
|
26
27
|
|
27
28
|
create_table "addresses_cities", force: :cascade do |t|
|
28
|
-
t.string
|
29
|
-
t.integer
|
29
|
+
t.string "name"
|
30
|
+
t.integer "state_id"
|
30
31
|
t.datetime "created_at"
|
31
32
|
t.datetime "updated_at"
|
33
|
+
t.index ["name", "state_id"], name: "index_addresses_cities_on_name_and_state_id"
|
34
|
+
t.index ["name"], name: "index_addresses_cities_on_name"
|
32
35
|
t.index ["state_id"], name: "index_addresses_cities_on_state_id"
|
33
36
|
end
|
34
37
|
|
35
38
|
create_table "addresses_countries", force: :cascade do |t|
|
36
|
-
t.string
|
37
|
-
t.string
|
39
|
+
t.string "name"
|
40
|
+
t.string "acronym"
|
38
41
|
t.datetime "created_at"
|
39
42
|
t.datetime "updated_at"
|
43
|
+
t.index ["acronym"], name: "index_addresses_countries_on_acronym"
|
44
|
+
t.index ["name"], name: "index_addresses_countries_on_name"
|
40
45
|
end
|
41
46
|
|
42
47
|
create_table "addresses_neighborhoods", force: :cascade do |t|
|
43
|
-
t.integer
|
44
|
-
t.string
|
48
|
+
t.integer "city_id"
|
49
|
+
t.string "name"
|
45
50
|
t.datetime "created_at"
|
46
51
|
t.datetime "updated_at"
|
47
52
|
t.index ["city_id"], name: "index_addresses_neighborhoods_on_city_id"
|
53
|
+
t.index ["name", "city_id"], name: "index_addresses_neighborhoods_on_name_and_city_id"
|
54
|
+
t.index ["name"], name: "index_addresses_neighborhoods_on_name"
|
48
55
|
end
|
49
56
|
|
50
57
|
create_table "addresses_states", force: :cascade do |t|
|
51
|
-
t.string
|
52
|
-
t.string
|
53
|
-
t.integer
|
58
|
+
t.string "name"
|
59
|
+
t.string "acronym"
|
60
|
+
t.integer "country_id"
|
54
61
|
t.datetime "created_at"
|
55
62
|
t.datetime "updated_at"
|
56
63
|
t.index ["country_id"], name: "index_addresses_states_on_country_id"
|
64
|
+
t.index ["name", "country_id"], name: "index_addresses_states_on_name_and_country_id"
|
65
|
+
t.index ["name"], name: "index_addresses_states_on_name"
|
57
66
|
end
|
58
67
|
|
59
68
|
create_table "addresses_zipcodes", force: :cascade do |t|
|
60
|
-
t.string
|
61
|
-
t.integer
|
62
|
-
t.integer
|
63
|
-
t.string
|
64
|
-
t.datetime "created_at",
|
65
|
-
t.datetime "updated_at",
|
69
|
+
t.string "street"
|
70
|
+
t.integer "city_id"
|
71
|
+
t.integer "neighborhood_id"
|
72
|
+
t.string "number"
|
73
|
+
t.datetime "created_at", null: false
|
74
|
+
t.datetime "updated_at", null: false
|
66
75
|
t.index ["city_id"], name: "index_addresses_zipcodes_on_city_id"
|
67
76
|
t.index ["neighborhood_id"], name: "index_addresses_zipcodes_on_neighborhood_id"
|
77
|
+
t.index ["number"], name: "index_addresses_zipcodes_on_number"
|
68
78
|
end
|
69
79
|
|
70
80
|
end
|