lookup_by 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -0
  4. data/Rakefile +0 -1
  5. data/lib/lookup_by.rb +3 -0
  6. data/lib/lookup_by/association.rb +9 -4
  7. data/lib/lookup_by/cache.rb +30 -15
  8. data/lib/lookup_by/lookup.rb +42 -13
  9. data/lib/lookup_by/version.rb +1 -1
  10. data/spec/dummy/Rakefile +8 -0
  11. data/spec/dummy/app/models/account.rb +0 -2
  12. data/spec/dummy/app/models/city.rb +0 -2
  13. data/spec/dummy/app/models/email_address.rb +0 -2
  14. data/spec/dummy/app/models/ip_address.rb +0 -2
  15. data/spec/dummy/app/models/path.rb +5 -0
  16. data/spec/dummy/app/models/postal_code.rb +0 -2
  17. data/spec/dummy/app/models/state.rb +0 -2
  18. data/spec/dummy/app/models/status.rb +0 -2
  19. data/spec/dummy/app/models/street.rb +0 -2
  20. data/spec/dummy/app/models/user_agent.rb +3 -0
  21. data/spec/dummy/bin/bundle +3 -0
  22. data/spec/dummy/bin/rails +4 -0
  23. data/spec/dummy/bin/rake +4 -0
  24. data/spec/dummy/config/application.rb +18 -10
  25. data/spec/dummy/config/boot.rb +4 -8
  26. data/spec/dummy/config/environment.rb +2 -2
  27. data/spec/dummy/config/environments/development.rb +19 -5
  28. data/spec/dummy/config/environments/production.rb +80 -0
  29. data/spec/dummy/config/environments/test.rb +25 -5
  30. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  32. data/spec/dummy/config/initializers/inflections.rb +16 -0
  33. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  34. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  35. data/spec/dummy/config/initializers/session_store.rb +3 -0
  36. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  37. data/spec/dummy/config/locales/en.yml +23 -0
  38. data/spec/dummy/config/routes.rb +56 -0
  39. data/spec/dummy/db/migrate/20121019040009_create_tables.rb +9 -6
  40. data/spec/dummy/db/seeds.rb +1 -0
  41. data/spec/dummy/db/structure.sql +616 -0
  42. data/spec/lookup_by_spec.rb +29 -2
  43. data/spec/spec_helper.rb +14 -1
  44. data/spec/support/shared_examples_for_a_lookup.rb +10 -8
  45. metadata +35 -3
  46. data/spec/dummy/db/schema.rb +0 -71
@@ -0,0 +1,80 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
21
+
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
24
+
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
28
+
29
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
47
+
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
+ # config.action_controller.asset_host = "http://assets.example.com"
59
+
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
+ # config.action_mailer.raise_delivery_errors = false
67
+
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Disable automatic flushing of the log to improve performance.
76
+ # config.autoflush_log = false
77
+
78
+ # Use default logging formatter so that PID and timestamp are not suppressed.
79
+ config.log_formatter = ::Logger::Formatter.new
80
+ end
@@ -1,16 +1,36 @@
1
1
  Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
2
4
  # The test environment is used exclusively to run your application's
3
5
  # test suite. You never need to work with it otherwise. Remember that
4
6
  # your test database is "scratch space" for the test suite and is wiped
5
7
  # and recreated between test runs. Don't rely on the data there!
6
8
  config.cache_classes = true
7
9
 
8
- # Log error messages when you accidentally call methods on nil
9
- config.whiny_nils = true
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
10
28
 
11
- # Raise exception on mass assignment protection for Active Record models
12
- config.active_record.mass_assignment_sanitizer = :strict
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
13
33
 
14
- # Print deprecation notices to the stderr
34
+ # Print deprecation notices to the stderr.
15
35
  config.active_support.deprecation = :stderr
16
36
  end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ Dummy::Application.config.secret_key_base = 'dd1f177df9ee969a1650a95ccd09916cd7df6779d28eb863b5ab89f5635e9ee69a1394a79628e3ca005b2333a1419a3e1c17f1086179d48a8a6f6ff6ac3d6bec'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,56 @@
1
+ Dummy::Application.routes.draw do
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+ # See how all your routes lay out with "rake routes".
4
+
5
+ # You can have the root of your site routed with "root"
6
+ # root 'welcome#index'
7
+
8
+ # Example of regular route:
9
+ # get 'products/:id' => 'catalog#view'
10
+
11
+ # Example of named route that can be invoked with purchase_url(id: product.id)
12
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
+
14
+ # Example resource route (maps HTTP verbs to controller actions automatically):
15
+ # resources :products
16
+
17
+ # Example resource route with options:
18
+ # resources :products do
19
+ # member do
20
+ # get 'short'
21
+ # post 'toggle'
22
+ # end
23
+ #
24
+ # collection do
25
+ # get 'sold'
26
+ # end
27
+ # end
28
+
29
+ # Example resource route with sub-resources:
30
+ # resources :products do
31
+ # resources :comments, :sales
32
+ # resource :seller
33
+ # end
34
+
35
+ # Example resource route with more complex sub-resources:
36
+ # resources :products do
37
+ # resources :comments
38
+ # resources :sales do
39
+ # get 'recent', on: :collection
40
+ # end
41
+ # end
42
+
43
+ # Example resource route with concerns:
44
+ # concern :toggleable do
45
+ # post 'toggle'
46
+ # end
47
+ # resources :posts, concerns: :toggleable
48
+ # resources :photos, concerns: :toggleable
49
+
50
+ # Example resource route within a namespace:
51
+ # namespace :admin do
52
+ # # Directs /admin/products/* to Admin::ProductsController
53
+ # # (app/controllers/admin/products_controller.rb)
54
+ # resources :products
55
+ # end
56
+ end
@@ -2,22 +2,25 @@ class CreateTables < ActiveRecord::Migration
2
2
  def up
3
3
  create_lookup_tables :cities, :states, :postal_codes, :streets
4
4
 
5
- create_lookup_table :ip_addresses
5
+ create_lookup_table :user_agents
6
6
  create_lookup_table :email_addresses
7
7
 
8
8
  create_lookup_table :accounts
9
9
  create_lookup_table :statuses
10
10
 
11
+ create_lookup_table :ip_addresses, lookup_type: :inet
12
+
13
+ enable_extension 'uuid-ossp'
14
+
15
+ execute 'CREATE SCHEMA traffic;'
16
+
17
+ create_lookup_table :paths, schema: 'traffic', id: :uuid
18
+
11
19
  create_table :addresses, primary_key: "address_id" do |t|
12
20
  t.belongs_to :city
13
21
  t.belongs_to :state
14
22
  t.belongs_to :postal_code
15
23
  t.belongs_to :street
16
24
  end
17
-
18
- State.create(name: "AL")
19
- end
20
-
21
- def down
22
25
  end
23
26
  end
@@ -0,0 +1 @@
1
+ State.create(name: 'AL')
@@ -0,0 +1,616 @@
1
+ --
2
+ -- PostgreSQL database dump
3
+ --
4
+
5
+ SET statement_timeout = 0;
6
+ SET lock_timeout = 0;
7
+ SET client_encoding = 'UTF8';
8
+ SET standard_conforming_strings = on;
9
+ SET check_function_bodies = false;
10
+ SET client_min_messages = warning;
11
+
12
+ --
13
+ -- Name: traffic; Type: SCHEMA; Schema: -; Owner: -
14
+ --
15
+
16
+ CREATE SCHEMA traffic;
17
+
18
+
19
+ --
20
+ -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
21
+ --
22
+
23
+ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
24
+
25
+
26
+ --
27
+ -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
28
+ --
29
+
30
+ COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
31
+
32
+
33
+ --
34
+ -- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
35
+ --
36
+
37
+ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
38
+
39
+
40
+ --
41
+ -- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
42
+ --
43
+
44
+ COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
45
+
46
+
47
+ SET search_path = public, pg_catalog;
48
+
49
+ SET default_tablespace = '';
50
+
51
+ SET default_with_oids = false;
52
+
53
+ --
54
+ -- Name: accounts; Type: TABLE; Schema: public; Owner: -; Tablespace:
55
+ --
56
+
57
+ CREATE TABLE accounts (
58
+ account_id integer NOT NULL,
59
+ account text NOT NULL
60
+ );
61
+
62
+
63
+ --
64
+ -- Name: accounts_account_id_seq; Type: SEQUENCE; Schema: public; Owner: -
65
+ --
66
+
67
+ CREATE SEQUENCE accounts_account_id_seq
68
+ START WITH 1
69
+ INCREMENT BY 1
70
+ NO MINVALUE
71
+ NO MAXVALUE
72
+ CACHE 1;
73
+
74
+
75
+ --
76
+ -- Name: accounts_account_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
77
+ --
78
+
79
+ ALTER SEQUENCE accounts_account_id_seq OWNED BY accounts.account_id;
80
+
81
+
82
+ --
83
+ -- Name: addresses; Type: TABLE; Schema: public; Owner: -; Tablespace:
84
+ --
85
+
86
+ CREATE TABLE addresses (
87
+ address_id integer NOT NULL,
88
+ city_id integer,
89
+ state_id integer,
90
+ postal_code_id integer,
91
+ street_id integer
92
+ );
93
+
94
+
95
+ --
96
+ -- Name: addresses_address_id_seq; Type: SEQUENCE; Schema: public; Owner: -
97
+ --
98
+
99
+ CREATE SEQUENCE addresses_address_id_seq
100
+ START WITH 1
101
+ INCREMENT BY 1
102
+ NO MINVALUE
103
+ NO MAXVALUE
104
+ CACHE 1;
105
+
106
+
107
+ --
108
+ -- Name: addresses_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
109
+ --
110
+
111
+ ALTER SEQUENCE addresses_address_id_seq OWNED BY addresses.address_id;
112
+
113
+
114
+ --
115
+ -- Name: cities; Type: TABLE; Schema: public; Owner: -; Tablespace:
116
+ --
117
+
118
+ CREATE TABLE cities (
119
+ city_id integer NOT NULL,
120
+ city text NOT NULL
121
+ );
122
+
123
+
124
+ --
125
+ -- Name: cities_city_id_seq; Type: SEQUENCE; Schema: public; Owner: -
126
+ --
127
+
128
+ CREATE SEQUENCE cities_city_id_seq
129
+ START WITH 1
130
+ INCREMENT BY 1
131
+ NO MINVALUE
132
+ NO MAXVALUE
133
+ CACHE 1;
134
+
135
+
136
+ --
137
+ -- Name: cities_city_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
138
+ --
139
+
140
+ ALTER SEQUENCE cities_city_id_seq OWNED BY cities.city_id;
141
+
142
+
143
+ --
144
+ -- Name: email_addresses; Type: TABLE; Schema: public; Owner: -; Tablespace:
145
+ --
146
+
147
+ CREATE TABLE email_addresses (
148
+ email_address_id integer NOT NULL,
149
+ email_address text NOT NULL
150
+ );
151
+
152
+
153
+ --
154
+ -- Name: email_addresses_email_address_id_seq; Type: SEQUENCE; Schema: public; Owner: -
155
+ --
156
+
157
+ CREATE SEQUENCE email_addresses_email_address_id_seq
158
+ START WITH 1
159
+ INCREMENT BY 1
160
+ NO MINVALUE
161
+ NO MAXVALUE
162
+ CACHE 1;
163
+
164
+
165
+ --
166
+ -- Name: email_addresses_email_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
167
+ --
168
+
169
+ ALTER SEQUENCE email_addresses_email_address_id_seq OWNED BY email_addresses.email_address_id;
170
+
171
+
172
+ --
173
+ -- Name: ip_addresses; Type: TABLE; Schema: public; Owner: -; Tablespace:
174
+ --
175
+
176
+ CREATE TABLE ip_addresses (
177
+ ip_address_id integer NOT NULL,
178
+ ip_address inet NOT NULL
179
+ );
180
+
181
+
182
+ --
183
+ -- Name: ip_addresses_ip_address_id_seq; Type: SEQUENCE; Schema: public; Owner: -
184
+ --
185
+
186
+ CREATE SEQUENCE ip_addresses_ip_address_id_seq
187
+ START WITH 1
188
+ INCREMENT BY 1
189
+ NO MINVALUE
190
+ NO MAXVALUE
191
+ CACHE 1;
192
+
193
+
194
+ --
195
+ -- Name: ip_addresses_ip_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
196
+ --
197
+
198
+ ALTER SEQUENCE ip_addresses_ip_address_id_seq OWNED BY ip_addresses.ip_address_id;
199
+
200
+
201
+ --
202
+ -- Name: postal_codes; Type: TABLE; Schema: public; Owner: -; Tablespace:
203
+ --
204
+
205
+ CREATE TABLE postal_codes (
206
+ postal_code_id integer NOT NULL,
207
+ postal_code text NOT NULL
208
+ );
209
+
210
+
211
+ --
212
+ -- Name: postal_codes_postal_code_id_seq; Type: SEQUENCE; Schema: public; Owner: -
213
+ --
214
+
215
+ CREATE SEQUENCE postal_codes_postal_code_id_seq
216
+ START WITH 1
217
+ INCREMENT BY 1
218
+ NO MINVALUE
219
+ NO MAXVALUE
220
+ CACHE 1;
221
+
222
+
223
+ --
224
+ -- Name: postal_codes_postal_code_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
225
+ --
226
+
227
+ ALTER SEQUENCE postal_codes_postal_code_id_seq OWNED BY postal_codes.postal_code_id;
228
+
229
+
230
+ --
231
+ -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
232
+ --
233
+
234
+ CREATE TABLE schema_migrations (
235
+ version character varying(255) NOT NULL
236
+ );
237
+
238
+
239
+ --
240
+ -- Name: states; Type: TABLE; Schema: public; Owner: -; Tablespace:
241
+ --
242
+
243
+ CREATE TABLE states (
244
+ state_id integer NOT NULL,
245
+ state text NOT NULL
246
+ );
247
+
248
+
249
+ --
250
+ -- Name: states_state_id_seq; Type: SEQUENCE; Schema: public; Owner: -
251
+ --
252
+
253
+ CREATE SEQUENCE states_state_id_seq
254
+ START WITH 1
255
+ INCREMENT BY 1
256
+ NO MINVALUE
257
+ NO MAXVALUE
258
+ CACHE 1;
259
+
260
+
261
+ --
262
+ -- Name: states_state_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
263
+ --
264
+
265
+ ALTER SEQUENCE states_state_id_seq OWNED BY states.state_id;
266
+
267
+
268
+ --
269
+ -- Name: statuses; Type: TABLE; Schema: public; Owner: -; Tablespace:
270
+ --
271
+
272
+ CREATE TABLE statuses (
273
+ status_id integer NOT NULL,
274
+ status text NOT NULL
275
+ );
276
+
277
+
278
+ --
279
+ -- Name: statuses_status_id_seq; Type: SEQUENCE; Schema: public; Owner: -
280
+ --
281
+
282
+ CREATE SEQUENCE statuses_status_id_seq
283
+ START WITH 1
284
+ INCREMENT BY 1
285
+ NO MINVALUE
286
+ NO MAXVALUE
287
+ CACHE 1;
288
+
289
+
290
+ --
291
+ -- Name: statuses_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
292
+ --
293
+
294
+ ALTER SEQUENCE statuses_status_id_seq OWNED BY statuses.status_id;
295
+
296
+
297
+ --
298
+ -- Name: streets; Type: TABLE; Schema: public; Owner: -; Tablespace:
299
+ --
300
+
301
+ CREATE TABLE streets (
302
+ street_id integer NOT NULL,
303
+ street text NOT NULL
304
+ );
305
+
306
+
307
+ --
308
+ -- Name: streets_street_id_seq; Type: SEQUENCE; Schema: public; Owner: -
309
+ --
310
+
311
+ CREATE SEQUENCE streets_street_id_seq
312
+ START WITH 1
313
+ INCREMENT BY 1
314
+ NO MINVALUE
315
+ NO MAXVALUE
316
+ CACHE 1;
317
+
318
+
319
+ --
320
+ -- Name: streets_street_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
321
+ --
322
+
323
+ ALTER SEQUENCE streets_street_id_seq OWNED BY streets.street_id;
324
+
325
+
326
+ --
327
+ -- Name: user_agents; Type: TABLE; Schema: public; Owner: -; Tablespace:
328
+ --
329
+
330
+ CREATE TABLE user_agents (
331
+ user_agent_id integer NOT NULL,
332
+ user_agent text NOT NULL
333
+ );
334
+
335
+
336
+ --
337
+ -- Name: user_agents_user_agent_id_seq; Type: SEQUENCE; Schema: public; Owner: -
338
+ --
339
+
340
+ CREATE SEQUENCE user_agents_user_agent_id_seq
341
+ START WITH 1
342
+ INCREMENT BY 1
343
+ NO MINVALUE
344
+ NO MAXVALUE
345
+ CACHE 1;
346
+
347
+
348
+ --
349
+ -- Name: user_agents_user_agent_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
350
+ --
351
+
352
+ ALTER SEQUENCE user_agents_user_agent_id_seq OWNED BY user_agents.user_agent_id;
353
+
354
+
355
+ SET search_path = traffic, pg_catalog;
356
+
357
+ --
358
+ -- Name: paths; Type: TABLE; Schema: traffic; Owner: -; Tablespace:
359
+ --
360
+
361
+ CREATE TABLE paths (
362
+ path_id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
363
+ path text NOT NULL
364
+ );
365
+
366
+
367
+ SET search_path = public, pg_catalog;
368
+
369
+ --
370
+ -- Name: account_id; Type: DEFAULT; Schema: public; Owner: -
371
+ --
372
+
373
+ ALTER TABLE ONLY accounts ALTER COLUMN account_id SET DEFAULT nextval('accounts_account_id_seq'::regclass);
374
+
375
+
376
+ --
377
+ -- Name: address_id; Type: DEFAULT; Schema: public; Owner: -
378
+ --
379
+
380
+ ALTER TABLE ONLY addresses ALTER COLUMN address_id SET DEFAULT nextval('addresses_address_id_seq'::regclass);
381
+
382
+
383
+ --
384
+ -- Name: city_id; Type: DEFAULT; Schema: public; Owner: -
385
+ --
386
+
387
+ ALTER TABLE ONLY cities ALTER COLUMN city_id SET DEFAULT nextval('cities_city_id_seq'::regclass);
388
+
389
+
390
+ --
391
+ -- Name: email_address_id; Type: DEFAULT; Schema: public; Owner: -
392
+ --
393
+
394
+ ALTER TABLE ONLY email_addresses ALTER COLUMN email_address_id SET DEFAULT nextval('email_addresses_email_address_id_seq'::regclass);
395
+
396
+
397
+ --
398
+ -- Name: ip_address_id; Type: DEFAULT; Schema: public; Owner: -
399
+ --
400
+
401
+ ALTER TABLE ONLY ip_addresses ALTER COLUMN ip_address_id SET DEFAULT nextval('ip_addresses_ip_address_id_seq'::regclass);
402
+
403
+
404
+ --
405
+ -- Name: postal_code_id; Type: DEFAULT; Schema: public; Owner: -
406
+ --
407
+
408
+ ALTER TABLE ONLY postal_codes ALTER COLUMN postal_code_id SET DEFAULT nextval('postal_codes_postal_code_id_seq'::regclass);
409
+
410
+
411
+ --
412
+ -- Name: state_id; Type: DEFAULT; Schema: public; Owner: -
413
+ --
414
+
415
+ ALTER TABLE ONLY states ALTER COLUMN state_id SET DEFAULT nextval('states_state_id_seq'::regclass);
416
+
417
+
418
+ --
419
+ -- Name: status_id; Type: DEFAULT; Schema: public; Owner: -
420
+ --
421
+
422
+ ALTER TABLE ONLY statuses ALTER COLUMN status_id SET DEFAULT nextval('statuses_status_id_seq'::regclass);
423
+
424
+
425
+ --
426
+ -- Name: street_id; Type: DEFAULT; Schema: public; Owner: -
427
+ --
428
+
429
+ ALTER TABLE ONLY streets ALTER COLUMN street_id SET DEFAULT nextval('streets_street_id_seq'::regclass);
430
+
431
+
432
+ --
433
+ -- Name: user_agent_id; Type: DEFAULT; Schema: public; Owner: -
434
+ --
435
+
436
+ ALTER TABLE ONLY user_agents ALTER COLUMN user_agent_id SET DEFAULT nextval('user_agents_user_agent_id_seq'::regclass);
437
+
438
+
439
+ --
440
+ -- Name: accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
441
+ --
442
+
443
+ ALTER TABLE ONLY accounts
444
+ ADD CONSTRAINT accounts_pkey PRIMARY KEY (account_id);
445
+
446
+
447
+ --
448
+ -- Name: addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
449
+ --
450
+
451
+ ALTER TABLE ONLY addresses
452
+ ADD CONSTRAINT addresses_pkey PRIMARY KEY (address_id);
453
+
454
+
455
+ --
456
+ -- Name: cities_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
457
+ --
458
+
459
+ ALTER TABLE ONLY cities
460
+ ADD CONSTRAINT cities_pkey PRIMARY KEY (city_id);
461
+
462
+
463
+ --
464
+ -- Name: email_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
465
+ --
466
+
467
+ ALTER TABLE ONLY email_addresses
468
+ ADD CONSTRAINT email_addresses_pkey PRIMARY KEY (email_address_id);
469
+
470
+
471
+ --
472
+ -- Name: ip_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
473
+ --
474
+
475
+ ALTER TABLE ONLY ip_addresses
476
+ ADD CONSTRAINT ip_addresses_pkey PRIMARY KEY (ip_address_id);
477
+
478
+
479
+ --
480
+ -- Name: postal_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
481
+ --
482
+
483
+ ALTER TABLE ONLY postal_codes
484
+ ADD CONSTRAINT postal_codes_pkey PRIMARY KEY (postal_code_id);
485
+
486
+
487
+ --
488
+ -- Name: states_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
489
+ --
490
+
491
+ ALTER TABLE ONLY states
492
+ ADD CONSTRAINT states_pkey PRIMARY KEY (state_id);
493
+
494
+
495
+ --
496
+ -- Name: statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
497
+ --
498
+
499
+ ALTER TABLE ONLY statuses
500
+ ADD CONSTRAINT statuses_pkey PRIMARY KEY (status_id);
501
+
502
+
503
+ --
504
+ -- Name: streets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
505
+ --
506
+
507
+ ALTER TABLE ONLY streets
508
+ ADD CONSTRAINT streets_pkey PRIMARY KEY (street_id);
509
+
510
+
511
+ --
512
+ -- Name: user_agents_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
513
+ --
514
+
515
+ ALTER TABLE ONLY user_agents
516
+ ADD CONSTRAINT user_agents_pkey PRIMARY KEY (user_agent_id);
517
+
518
+
519
+ SET search_path = traffic, pg_catalog;
520
+
521
+ --
522
+ -- Name: paths_pkey; Type: CONSTRAINT; Schema: traffic; Owner: -; Tablespace:
523
+ --
524
+
525
+ ALTER TABLE ONLY paths
526
+ ADD CONSTRAINT paths_pkey PRIMARY KEY (path_id);
527
+
528
+
529
+ SET search_path = public, pg_catalog;
530
+
531
+ --
532
+ -- Name: accounts__u_account; Type: INDEX; Schema: public; Owner: -; Tablespace:
533
+ --
534
+
535
+ CREATE UNIQUE INDEX accounts__u_account ON accounts USING btree (account);
536
+
537
+
538
+ --
539
+ -- Name: cities__u_city; Type: INDEX; Schema: public; Owner: -; Tablespace:
540
+ --
541
+
542
+ CREATE UNIQUE INDEX cities__u_city ON cities USING btree (city);
543
+
544
+
545
+ --
546
+ -- Name: email_addresses__u_email_address; Type: INDEX; Schema: public; Owner: -; Tablespace:
547
+ --
548
+
549
+ CREATE UNIQUE INDEX email_addresses__u_email_address ON email_addresses USING btree (email_address);
550
+
551
+
552
+ --
553
+ -- Name: ip_addresses__u_ip_address; Type: INDEX; Schema: public; Owner: -; Tablespace:
554
+ --
555
+
556
+ CREATE UNIQUE INDEX ip_addresses__u_ip_address ON ip_addresses USING btree (ip_address);
557
+
558
+
559
+ --
560
+ -- Name: postal_codes__u_postal_code; Type: INDEX; Schema: public; Owner: -; Tablespace:
561
+ --
562
+
563
+ CREATE UNIQUE INDEX postal_codes__u_postal_code ON postal_codes USING btree (postal_code);
564
+
565
+
566
+ --
567
+ -- Name: states__u_state; Type: INDEX; Schema: public; Owner: -; Tablespace:
568
+ --
569
+
570
+ CREATE UNIQUE INDEX states__u_state ON states USING btree (state);
571
+
572
+
573
+ --
574
+ -- Name: statuses__u_status; Type: INDEX; Schema: public; Owner: -; Tablespace:
575
+ --
576
+
577
+ CREATE UNIQUE INDEX statuses__u_status ON statuses USING btree (status);
578
+
579
+
580
+ --
581
+ -- Name: streets__u_street; Type: INDEX; Schema: public; Owner: -; Tablespace:
582
+ --
583
+
584
+ CREATE UNIQUE INDEX streets__u_street ON streets USING btree (street);
585
+
586
+
587
+ --
588
+ -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
589
+ --
590
+
591
+ CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
592
+
593
+
594
+ --
595
+ -- Name: user_agents__u_user_agent; Type: INDEX; Schema: public; Owner: -; Tablespace:
596
+ --
597
+
598
+ CREATE UNIQUE INDEX user_agents__u_user_agent ON user_agents USING btree (user_agent);
599
+
600
+
601
+ SET search_path = traffic, pg_catalog;
602
+
603
+ --
604
+ -- Name: paths__u_path; Type: INDEX; Schema: traffic; Owner: -; Tablespace:
605
+ --
606
+
607
+ CREATE UNIQUE INDEX paths__u_path ON paths USING btree (path);
608
+
609
+
610
+ --
611
+ -- PostgreSQL database dump complete
612
+ --
613
+
614
+ SET search_path TO "$user",public;
615
+
616
+ INSERT INTO schema_migrations (version) VALUES ('20121019040009');