slugs 1.3.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/Rakefile +5 -0
  4. data/lib/slugs.rb +36 -4
  5. data/lib/slugs/concern.rb +50 -0
  6. data/lib/slugs/configuration.rb +7 -0
  7. data/lib/slugs/extensions/action_dispatch/generator.rb +24 -0
  8. data/lib/slugs/extensions/action_dispatch/optimized_url_helper.rb +20 -0
  9. data/lib/slugs/extensions/active_record/base.rb +19 -0
  10. data/lib/slugs/railtie.rb +9 -1
  11. data/lib/slugs/version.rb +1 -1
  12. data/test/dummy/Rakefile +1 -2
  13. data/test/dummy/app/assets/javascripts/application.js +2 -2
  14. data/test/dummy/app/assets/stylesheets/application.css +6 -4
  15. data/test/dummy/app/models/category.rb +7 -0
  16. data/test/dummy/app/models/product.rb +8 -0
  17. data/test/dummy/app/models/shop.rb +5 -0
  18. data/test/dummy/app/models/user.rb +5 -0
  19. data/test/dummy/app/views/layouts/application.html.erb +9 -11
  20. data/test/dummy/bin/bundle +0 -0
  21. data/test/dummy/bin/rails +1 -1
  22. data/test/dummy/bin/rake +0 -0
  23. data/test/dummy/bin/setup +29 -0
  24. data/test/dummy/config.ru +1 -1
  25. data/test/dummy/config/application.rb +3 -1
  26. data/test/dummy/config/boot.rb +1 -1
  27. data/test/dummy/config/database.yml +4 -22
  28. data/test/dummy/config/database.yml.travis +12 -0
  29. data/test/dummy/config/environment.rb +1 -1
  30. data/test/dummy/config/environments/development.rb +14 -2
  31. data/test/dummy/config/environments/production.rb +20 -25
  32. data/test/dummy/config/environments/test.rb +8 -10
  33. data/test/dummy/config/initializers/assets.rb +11 -0
  34. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  35. data/test/dummy/config/initializers/mime_types.rb +1 -2
  36. data/test/dummy/config/initializers/session_store.rb +1 -1
  37. data/test/dummy/config/initializers/slugs.rb +5 -0
  38. data/test/dummy/config/routes.rb +2 -53
  39. data/test/dummy/config/secrets.yml +22 -0
  40. data/test/dummy/db/migrate/20161016174020_create_users.rb +9 -0
  41. data/test/dummy/db/migrate/20161016174126_create_shops.rb +8 -0
  42. data/test/dummy/db/migrate/20161016174202_create_products.rb +10 -0
  43. data/test/dummy/db/migrate/20161016174225_create_categories.rb +9 -0
  44. data/test/dummy/db/schema.rb +21 -26
  45. data/test/dummy/log/development.log +144 -0
  46. data/test/dummy/log/test.log +4190 -0
  47. data/test/dummy/public/404.html +20 -11
  48. data/test/dummy/public/422.html +20 -11
  49. data/test/dummy/public/500.html +19 -10
  50. data/test/records_test.rb +15 -103
  51. data/test/routes_test.rb +17 -0
  52. data/test/test_helper.rb +4 -12
  53. metadata +49 -54
  54. data/lib/slugs/active_record/base.rb +0 -82
  55. data/lib/slugs/active_record/finders.rb +0 -24
  56. data/lib/slugs/active_record/non_translatable.rb +0 -26
  57. data/lib/slugs/active_record/translatable.rb +0 -49
  58. data/test/dummy/README.rdoc +0 -28
  59. data/test/dummy/app/models/simple.rb +0 -5
  60. data/test/dummy/app/models/translatable.rb +0 -7
  61. data/test/dummy/app/models/translatable_translation.rb +0 -8
  62. data/test/dummy/app/models/without.rb +0 -2
  63. data/test/dummy/config/initializers/secret_token.rb +0 -13
  64. data/test/dummy/db/migrate/20130819183013_create_simples.rb +0 -11
  65. data/test/dummy/db/migrate/20130819183047_create_withouts.rb +0 -9
  66. data/test/dummy/db/migrate/20130819183119_create_translatables.rb +0 -8
  67. data/test/dummy/db/migrate/20130819183257_create_translatable_translations.rb +0 -15
@@ -0,0 +1,12 @@
1
+ mysql: &mysql
2
+ adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>mysql<%= '2' if RUBY_ENGINE != 'jruby' %>
3
+
4
+ postgres: &postgres
5
+ adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>postgresql
6
+
7
+ sqlite: &sqlite
8
+ adapter: <%= 'jdbc' if RUBY_ENGINE == 'jruby' %>sqlite3
9
+
10
+ test:
11
+ <<: *<%= ENV['DB'] %>
12
+ database: <%= ENV['DB'] == 'sqlite' ? 'db/travis.sqlite3' : 'travis' %>
@@ -2,4 +2,4 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  # Initialize the Rails application.
5
- Dummy::Application.initialize!
5
+ Rails.application.initialize!
@@ -10,7 +10,7 @@ Dummy::Application.configure do
10
10
  config.eager_load = false
11
11
 
12
12
  # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
13
+ config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
16
  # Don't care if the mailer can't send.
@@ -19,11 +19,23 @@ Dummy::Application.configure do
19
19
  # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Raise an error on page load if there are pending migrations
22
+ # Raise an error on page load if there are pending migrations.
23
23
  config.active_record.migration_error = :page_load
24
24
 
25
25
  # Debug mode disables concatenation and preprocessing of assets.
26
26
  # This option may cause significant delays in view rendering with a large
27
27
  # number of complex assets.
28
28
  config.assets.debug = true
29
+
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
33
+
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
38
+
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
29
41
  end
@@ -5,26 +5,24 @@ Dummy::Application.configure do
5
5
  config.cache_classes = true
6
6
 
7
7
  # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
8
+ # your application in memory, allowing both threaded web servers
9
9
  # and those relying on copy on write to perform better.
10
10
  # Rake tasks automatically ignore this option for performance.
11
11
  config.eager_load = true
12
12
 
13
13
  # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
14
+ config.consider_all_requests_local = false
15
15
  config.action_controller.perform_caching = true
16
16
 
17
17
  # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
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.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
20
21
  # config.action_dispatch.rack_cache = true
21
22
 
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
24
- config.serve_static_files = false
25
- else
26
- config.serve_static_assets = false
27
- end
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
26
 
29
27
  # Compress JavaScripts and CSS.
30
28
  config.assets.js_compressor = :uglifier
@@ -33,21 +31,22 @@ Dummy::Application.configure do
33
31
  # Do not fallback to assets pipeline if a precompiled asset is missed.
34
32
  config.assets.compile = false
35
33
 
36
- # Generate digests for assets URLs.
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
37
36
  config.assets.digest = true
38
37
 
39
- # Version of your assets, change this if you want to expire all your assets.
40
- config.assets.version = '1.0'
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
41
39
 
42
40
  # Specifies the header that your server uses for sending files.
43
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
44
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
45
43
 
46
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
47
45
  # config.force_ssl = true
48
46
 
49
- # Set to :debug to see everything in the log.
50
- config.log_level = :info
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
51
50
 
52
51
  # Prepend all log lines with the following tags.
53
52
  # config.log_tags = [ :subdomain, :uuid ]
@@ -59,26 +58,22 @@ Dummy::Application.configure do
59
58
  # config.cache_store = :mem_cache_store
60
59
 
61
60
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
62
- # config.action_controller.asset_host = "http://assets.example.com"
63
-
64
- # Precompile additional assets.
65
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
66
- # config.assets.precompile += %w( search.js )
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
67
62
 
68
63
  # Ignore bad email addresses and do not raise email delivery errors.
69
64
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
70
65
  # config.action_mailer.raise_delivery_errors = false
71
66
 
72
67
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
73
- # the I18n.default_locale when a translation can not be found).
68
+ # the I18n.default_locale when a translation cannot be found).
74
69
  config.i18n.fallbacks = true
75
70
 
76
71
  # Send deprecation notices to registered listeners.
77
72
  config.active_support.deprecation = :notify
78
73
 
79
- # Disable automatic flushing of the log to improve performance.
80
- # config.autoflush_log = false
81
-
82
74
  # Use default logging formatter so that PID and timestamp are not suppressed.
83
75
  config.log_formatter = ::Logger::Formatter.new
76
+
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
84
79
  end
@@ -12,13 +12,9 @@ Dummy::Application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
17
- config.serve_static_files = false
18
- else
19
- config.serve_static_assets = false
20
- end
21
- config.static_cache_control = "public, max-age=3600"
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
22
18
 
23
19
  # Show full error reports and disable caching.
24
20
  config.consider_all_requests_local = true
@@ -35,10 +31,12 @@ Dummy::Application.configure do
35
31
  # ActionMailer::Base.deliveries array.
36
32
  config.action_mailer.delivery_method = :test
37
33
 
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
38
37
  # Print deprecation notices to the stderr.
39
38
  config.active_support.deprecation = :stderr
40
39
 
41
- if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2
42
- config.active_support.test_order = :random
43
- end
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
44
42
  end
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,5 +1,4 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
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
4
+ # Mime::Type.register 'text/richtext', :rtf
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,5 @@
1
+ Slugs.configure do |config|
2
+ config.use_slug_proc = Proc.new do |record, params|
3
+ true
4
+ end
5
+ end
@@ -1,56 +1,5 @@
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".
1
+ Rails.application.routes.draw do
4
2
 
5
- # You can have the root of your site routed with "root"
6
- # root 'welcome#index'
3
+ resources :shops
7
4
 
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
5
  end
@@ -0,0 +1,22 @@
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 the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 921ea9f25943669d3a4b0a6c8762cb6a97a00c42732c84b3a4c80900d4f2be79081cad03e0ec8d5d0f2f293874b2bbd04c1444e7a6d6b9147de8f4ffb3acff11
15
+
16
+ test:
17
+ secret_key_base: 0e085a62fbfd58069441e0eb7dd8c3d0a7035017443181a5fba2c04041a03f8d0d427216ac56a51da79125898d125bb9fb8badb48404919fe3188eb309231570
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :first_name
5
+ t.string :last_name
6
+ t.string :slug
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ class CreateShops < ActiveRecord::Migration
2
+ def change
3
+ create_table :shops do |t|
4
+ t.string :name
5
+ t.string :slug
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ class CreateProducts < ActiveRecord::Migration
2
+ def change
3
+ create_table :products do |t|
4
+ t.string :name
5
+ t.integer :shop_id
6
+ t.integer :category_id
7
+ t.string :slug
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :categories do |t|
4
+ t.string :name
5
+ t.integer :shop_id
6
+ t.string :slug
7
+ end
8
+ end
9
+ end
@@ -9,40 +9,35 @@
9
9
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
10
  # you'll amass, the slower it'll run and the greater likelihood for issues).
11
11
  #
12
- # It's strongly recommended to check this file into your version control system.
12
+ # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130819183257) do
14
+ ActiveRecord::Schema.define(version: 20161016174225) do
15
15
 
16
- create_table "simples", :force => true do |t|
17
- t.string "name"
18
- t.integer "age"
19
- t.string "slug"
20
- t.datetime "created_at"
21
- t.datetime "updated_at"
22
- end
16
+ # These are extensions that must be enabled in order to support this database
17
+ enable_extension "plpgsql"
23
18
 
24
- create_table "translatable_translations", :force => true do |t|
25
- t.integer "translatable_id"
26
- t.string "locale"
27
- t.string "name"
28
- t.integer "age"
29
- t.string "slug"
30
- t.datetime "created_at"
31
- t.datetime "updated_at"
19
+ create_table "categories", force: :cascade do |t|
20
+ t.string "name"
21
+ t.integer "shop_id"
22
+ t.string "slug"
32
23
  end
33
24
 
34
- add_index "translatable_translations", ["locale"], :name => "index_translatable_translations_on_locale"
35
- add_index "translatable_translations", ["translatable_id"], :name => "index_translatable_translations_on_translatable_id"
25
+ create_table "products", force: :cascade do |t|
26
+ t.string "name"
27
+ t.integer "shop_id"
28
+ t.integer "category_id"
29
+ t.string "slug"
30
+ end
36
31
 
37
- create_table "translatables", :force => true do |t|
38
- t.datetime "created_at"
39
- t.datetime "updated_at"
32
+ create_table "shops", force: :cascade do |t|
33
+ t.string "name"
34
+ t.string "slug"
40
35
  end
41
36
 
42
- create_table "withouts", :force => true do |t|
43
- t.string "name"
44
- t.datetime "created_at"
45
- t.datetime "updated_at"
37
+ create_table "users", force: :cascade do |t|
38
+ t.string "first_name"
39
+ t.string "last_name"
40
+ t.string "slug"
46
41
  end
47
42
 
48
43
  end
@@ -0,0 +1,144 @@
1
+  (31.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
2
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
+ Migrating to CreateUsers (20161016174020)
5
+  (0.2ms) BEGIN
6
+  (20.8ms) CREATE TABLE "users" ("id" serial primary key, "first_name" character varying, "last_name" character varying) 
7
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174020"]]
8
+  (6.4ms) COMMIT
9
+ Migrating to CreateShops (20161016174126)
10
+  (6.2ms) BEGIN
11
+  (13.5ms) CREATE TABLE "shops" ("id" serial primary key, "name" character varying) 
12
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174126"]]
13
+  (5.1ms) COMMIT
14
+ Migrating to CreateProducts (20161016174202)
15
+  (6.2ms) BEGIN
16
+  (13.9ms) CREATE TABLE "products" ("id" serial primary key, "name" character varying, "shop_id" integer, "category_id" integer) 
17
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174202"]]
18
+  (0.5ms) COMMIT
19
+ Migrating to CreateCategories (20161016174225)
20
+  (6.2ms) BEGIN
21
+  (19.3ms) CREATE TABLE "categories" ("id" serial primary key, "name" character varying, "shop_id" integer) 
22
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174225"]]
23
+  (0.4ms) COMMIT
24
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
25
+  (1.7ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
26
+ FROM pg_constraint c
27
+ JOIN pg_class t1 ON c.conrelid = t1.oid
28
+ JOIN pg_class t2 ON c.confrelid = t2.oid
29
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
30
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
31
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
32
+ WHERE c.contype = 'f'
33
+ AND t1.relname = 'categories'
34
+ AND t3.nspname = ANY (current_schemas(false))
35
+ ORDER BY c.conname
36
+ 
37
+  (1.3ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
38
+ FROM pg_constraint c
39
+ JOIN pg_class t1 ON c.conrelid = t1.oid
40
+ JOIN pg_class t2 ON c.confrelid = t2.oid
41
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
42
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
43
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
44
+ WHERE c.contype = 'f'
45
+ AND t1.relname = 'products'
46
+ AND t3.nspname = ANY (current_schemas(false))
47
+ ORDER BY c.conname
48
+
49
+  (1.3ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
50
+ FROM pg_constraint c
51
+ JOIN pg_class t1 ON c.conrelid = t1.oid
52
+ JOIN pg_class t2 ON c.confrelid = t2.oid
53
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
54
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
55
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
56
+ WHERE c.contype = 'f'
57
+ AND t1.relname = 'shops'
58
+ AND t3.nspname = ANY (current_schemas(false))
59
+ ORDER BY c.conname
60
+ 
61
+  (1.2ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
62
+ FROM pg_constraint c
63
+ JOIN pg_class t1 ON c.conrelid = t1.oid
64
+ JOIN pg_class t2 ON c.confrelid = t2.oid
65
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
66
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
67
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
68
+ WHERE c.contype = 'f'
69
+ AND t1.relname = 'users'
70
+ AND t3.nspname = ANY (current_schemas(false))
71
+ ORDER BY c.conname
72
+
73
+  (2.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
74
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
75
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
76
+ Migrating to CreateUsers (20161016174020)
77
+  (0.1ms) BEGIN
78
+  (2.4ms) CREATE TABLE "users" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "slug" character varying) 
79
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174020"]]
80
+  (0.5ms) COMMIT
81
+ Migrating to CreateShops (20161016174126)
82
+  (0.2ms) BEGIN
83
+  (1.8ms) CREATE TABLE "shops" ("id" serial primary key, "name" character varying, "slug" character varying) 
84
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174126"]]
85
+  (0.5ms) COMMIT
86
+ Migrating to CreateProducts (20161016174202)
87
+  (0.2ms) BEGIN
88
+  (1.7ms) CREATE TABLE "products" ("id" serial primary key, "name" character varying, "shop_id" integer, "category_id" integer, "slug" character varying) 
89
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174202"]]
90
+  (0.4ms) COMMIT
91
+ Migrating to CreateCategories (20161016174225)
92
+  (0.2ms) BEGIN
93
+  (2.0ms) CREATE TABLE "categories" ("id" serial primary key, "name" character varying, "shop_id" integer, "slug" character varying) 
94
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174225"]]
95
+  (0.4ms) COMMIT
96
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
97
+  (2.2ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
98
+ FROM pg_constraint c
99
+ JOIN pg_class t1 ON c.conrelid = t1.oid
100
+ JOIN pg_class t2 ON c.confrelid = t2.oid
101
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
102
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
103
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
104
+ WHERE c.contype = 'f'
105
+ AND t1.relname = 'categories'
106
+ AND t3.nspname = ANY (current_schemas(false))
107
+ ORDER BY c.conname
108
+ 
109
+  (1.4ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
110
+ FROM pg_constraint c
111
+ JOIN pg_class t1 ON c.conrelid = t1.oid
112
+ JOIN pg_class t2 ON c.confrelid = t2.oid
113
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
114
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
115
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
116
+ WHERE c.contype = 'f'
117
+ AND t1.relname = 'products'
118
+ AND t3.nspname = ANY (current_schemas(false))
119
+ ORDER BY c.conname
120
+
121
+  (1.3ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
122
+ FROM pg_constraint c
123
+ JOIN pg_class t1 ON c.conrelid = t1.oid
124
+ JOIN pg_class t2 ON c.confrelid = t2.oid
125
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
126
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
127
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
128
+ WHERE c.contype = 'f'
129
+ AND t1.relname = 'shops'
130
+ AND t3.nspname = ANY (current_schemas(false))
131
+ ORDER BY c.conname
132
+ 
133
+  (1.3ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
134
+ FROM pg_constraint c
135
+ JOIN pg_class t1 ON c.conrelid = t1.oid
136
+ JOIN pg_class t2 ON c.confrelid = t2.oid
137
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
138
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
139
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
140
+ WHERE c.contype = 'f'
141
+ AND t1.relname = 'users'
142
+ AND t3.nspname = ANY (current_schemas(false))
143
+ ORDER BY c.conname
144
+