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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/Rakefile +5 -0
- data/lib/slugs.rb +36 -4
- data/lib/slugs/concern.rb +50 -0
- data/lib/slugs/configuration.rb +7 -0
- data/lib/slugs/extensions/action_dispatch/generator.rb +24 -0
- data/lib/slugs/extensions/action_dispatch/optimized_url_helper.rb +20 -0
- data/lib/slugs/extensions/active_record/base.rb +19 -0
- data/lib/slugs/railtie.rb +9 -1
- data/lib/slugs/version.rb +1 -1
- data/test/dummy/Rakefile +1 -2
- data/test/dummy/app/assets/javascripts/application.js +2 -2
- data/test/dummy/app/assets/stylesheets/application.css +6 -4
- data/test/dummy/app/models/category.rb +7 -0
- data/test/dummy/app/models/product.rb +8 -0
- data/test/dummy/app/models/shop.rb +5 -0
- data/test/dummy/app/models/user.rb +5 -0
- data/test/dummy/app/views/layouts/application.html.erb +9 -11
- data/test/dummy/bin/bundle +0 -0
- data/test/dummy/bin/rails +1 -1
- data/test/dummy/bin/rake +0 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +1 -1
- data/test/dummy/config/application.rb +3 -1
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/database.yml +4 -22
- data/test/dummy/config/database.yml.travis +12 -0
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +14 -2
- data/test/dummy/config/environments/production.rb +20 -25
- data/test/dummy/config/environments/test.rb +8 -10
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/mime_types.rb +1 -2
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/initializers/slugs.rb +5 -0
- data/test/dummy/config/routes.rb +2 -53
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/migrate/20161016174020_create_users.rb +9 -0
- data/test/dummy/db/migrate/20161016174126_create_shops.rb +8 -0
- data/test/dummy/db/migrate/20161016174202_create_products.rb +10 -0
- data/test/dummy/db/migrate/20161016174225_create_categories.rb +9 -0
- data/test/dummy/db/schema.rb +21 -26
- data/test/dummy/log/development.log +144 -0
- data/test/dummy/log/test.log +4190 -0
- data/test/dummy/public/404.html +20 -11
- data/test/dummy/public/422.html +20 -11
- data/test/dummy/public/500.html +19 -10
- data/test/records_test.rb +15 -103
- data/test/routes_test.rb +17 -0
- data/test/test_helper.rb +4 -12
- metadata +49 -54
- data/lib/slugs/active_record/base.rb +0 -82
- data/lib/slugs/active_record/finders.rb +0 -24
- data/lib/slugs/active_record/non_translatable.rb +0 -26
- data/lib/slugs/active_record/translatable.rb +0 -49
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/models/simple.rb +0 -5
- data/test/dummy/app/models/translatable.rb +0 -7
- data/test/dummy/app/models/translatable_translation.rb +0 -8
- data/test/dummy/app/models/without.rb +0 -2
- data/test/dummy/config/initializers/secret_token.rb +0 -13
- data/test/dummy/db/migrate/20130819183013_create_simples.rb +0 -11
- data/test/dummy/db/migrate/20130819183047_create_withouts.rb +0 -9
- data/test/dummy/db/migrate/20130819183119_create_translatables.rb +0 -8
- 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' %>
|
@@ -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
|
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
|
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
|
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
|
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
|
23
|
-
|
24
|
-
|
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
|
-
#
|
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
|
-
#
|
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 =
|
44
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for
|
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
|
-
#
|
50
|
-
|
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 =
|
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
|
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
|
16
|
-
|
17
|
-
|
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
|
-
|
42
|
-
|
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 )
|
data/test/dummy/config/routes.rb
CHANGED
@@ -1,56 +1,5 @@
|
|
1
|
-
|
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
|
-
|
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'] %>
|
data/test/dummy/db/schema.rb
CHANGED
@@ -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
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:
|
14
|
+
ActiveRecord::Schema.define(version: 20161016174225) do
|
15
15
|
|
16
|
-
|
17
|
-
|
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 "
|
25
|
-
t.
|
26
|
-
t.
|
27
|
-
t.string
|
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
|
-
|
35
|
-
|
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 "
|
38
|
-
t.
|
39
|
-
t.
|
32
|
+
create_table "shops", force: :cascade do |t|
|
33
|
+
t.string "name"
|
34
|
+
t.string "slug"
|
40
35
|
end
|
41
36
|
|
42
|
-
create_table "
|
43
|
-
t.string
|
44
|
-
t.
|
45
|
-
t.
|
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
|
+
[1m[36m (31.0ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
2
|
+
[1m[35m (1.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
+
Migrating to CreateUsers (20161016174020)
|
5
|
+
[1m[35m (0.2ms)[0m BEGIN
|
6
|
+
[1m[36m (20.8ms)[0m [1mCREATE TABLE "users" ("id" serial primary key, "first_name" character varying, "last_name" character varying) [0m
|
7
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174020"]]
|
8
|
+
[1m[36m (6.4ms)[0m [1mCOMMIT[0m
|
9
|
+
Migrating to CreateShops (20161016174126)
|
10
|
+
[1m[35m (6.2ms)[0m BEGIN
|
11
|
+
[1m[36m (13.5ms)[0m [1mCREATE TABLE "shops" ("id" serial primary key, "name" character varying) [0m
|
12
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174126"]]
|
13
|
+
[1m[36m (5.1ms)[0m [1mCOMMIT[0m
|
14
|
+
Migrating to CreateProducts (20161016174202)
|
15
|
+
[1m[35m (6.2ms)[0m BEGIN
|
16
|
+
[1m[36m (13.9ms)[0m [1mCREATE TABLE "products" ("id" serial primary key, "name" character varying, "shop_id" integer, "category_id" integer) [0m
|
17
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174202"]]
|
18
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
19
|
+
Migrating to CreateCategories (20161016174225)
|
20
|
+
[1m[35m (6.2ms)[0m BEGIN
|
21
|
+
[1m[36m (19.3ms)[0m [1mCREATE TABLE "categories" ("id" serial primary key, "name" character varying, "shop_id" integer) [0m
|
22
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174225"]]
|
23
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
24
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
25
|
+
[1m[36m (1.7ms)[0m [1mSELECT 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
|
+
[0m
|
37
|
+
[1m[35m (1.3ms)[0m 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
|
+
[1m[36m (1.3ms)[0m [1mSELECT 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
|
+
[0m
|
61
|
+
[1m[35m (1.2ms)[0m 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
|
+
[1m[36m (2.3ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
74
|
+
[1m[35m (1.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
75
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
76
|
+
Migrating to CreateUsers (20161016174020)
|
77
|
+
[1m[35m (0.1ms)[0m BEGIN
|
78
|
+
[1m[36m (2.4ms)[0m [1mCREATE TABLE "users" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "slug" character varying) [0m
|
79
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174020"]]
|
80
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
81
|
+
Migrating to CreateShops (20161016174126)
|
82
|
+
[1m[35m (0.2ms)[0m BEGIN
|
83
|
+
[1m[36m (1.8ms)[0m [1mCREATE TABLE "shops" ("id" serial primary key, "name" character varying, "slug" character varying) [0m
|
84
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174126"]]
|
85
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
86
|
+
Migrating to CreateProducts (20161016174202)
|
87
|
+
[1m[35m (0.2ms)[0m BEGIN
|
88
|
+
[1m[36m (1.7ms)[0m [1mCREATE TABLE "products" ("id" serial primary key, "name" character varying, "shop_id" integer, "category_id" integer, "slug" character varying) [0m
|
89
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174202"]]
|
90
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
91
|
+
Migrating to CreateCategories (20161016174225)
|
92
|
+
[1m[35m (0.2ms)[0m BEGIN
|
93
|
+
[1m[36m (2.0ms)[0m [1mCREATE TABLE "categories" ("id" serial primary key, "name" character varying, "shop_id" integer, "slug" character varying) [0m
|
94
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161016174225"]]
|
95
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
96
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
97
|
+
[1m[36m (2.2ms)[0m [1mSELECT 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
|
+
[0m
|
109
|
+
[1m[35m (1.4ms)[0m 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
|
+
[1m[36m (1.3ms)[0m [1mSELECT 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
|
+
[0m
|
133
|
+
[1m[35m (1.3ms)[0m 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
|
+
|