translatable_records 1.1.7 → 4.0.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/README.md +26 -22
- data/Rakefile +1 -14
- data/lib/generators/translation/templates/migration.rb +14 -0
- data/lib/generators/translation/templates/model.rb +8 -0
- data/lib/generators/translation/translation_generator.rb +25 -0
- data/lib/translatable_records/builder.rb +66 -0
- data/lib/translatable_records/concern.rb +22 -0
- data/lib/translatable_records/extensions/active_record/base.rb +26 -0
- data/lib/translatable_records/railtie.rb +4 -2
- data/lib/translatable_records/version.rb +1 -1
- data/lib/translatable_records.rb +4 -2
- 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/product.rb +5 -0
- data/test/dummy/app/models/product_translation.rb +8 -0
- data/test/dummy/app/views/layouts/application.html.erb +9 -11
- data/test/dummy/bin/bundle +1 -0
- data/test/dummy/bin/rails +2 -1
- data/test/dummy/bin/rake +1 -0
- data/test/dummy/bin/setup +30 -0
- data/test/dummy/config/application.rb +3 -0
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/database.yml +4 -22
- data/test/dummy/config/database.yml.travis +3 -0
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +15 -3
- data/test/dummy/config/environments/production.rb +21 -26
- data/test/dummy/config/environments/test.rb +10 -12
- 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/routes.rb +2 -2
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +1 -1
- data/test/dummy/db/migrate/20130819155126_create_products.rb +8 -0
- data/test/dummy/db/migrate/20161205171056_create_product_translations.rb +12 -0
- data/test/dummy/db/schema.rb +13 -11
- data/test/dummy/log/development.log +39 -0
- data/test/dummy/log/test.log +1443 -62
- data/test/dummy/public/404.html +58 -55
- data/test/dummy/public/422.html +58 -55
- data/test/dummy/public/500.html +57 -54
- data/test/generator_test.rb +21 -0
- data/test/record_test.rb +38 -0
- data/test/test_helper.rb +5 -13
- metadata +42 -33
- data/lib/generators/templates/migration.rb +0 -12
- data/lib/generators/templates/model.rb +0 -8
- data/lib/generators/translation_generator.rb +0 -21
- data/lib/translatable_records/active_record/base.rb +0 -56
- data/lib/translatable_records/active_record/translatable.rb +0 -26
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/models/model.rb +0 -3
- data/test/dummy/app/models/model_translation.rb +0 -8
- data/test/dummy/config/initializers/secret_token.rb +0 -13
- data/test/dummy/db/migrate/20130819155126_create_models.rb +0 -8
- data/test/dummy/db/migrate/20130819165249_create_model_translations.rb +0 -13
- data/test/generators_test.rb +0 -19
- data/test/records_test.rb +0 -36
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
# path to your application root.
|
6
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
7
|
+
|
8
|
+
Dir.chdir APP_ROOT do
|
9
|
+
# This script is a starting point to setup your application.
|
10
|
+
# Add necessary setup steps to this file:
|
11
|
+
|
12
|
+
puts '== Installing dependencies =='
|
13
|
+
system 'gem install bundler --conservative'
|
14
|
+
system 'bundle check || bundle install'
|
15
|
+
|
16
|
+
# puts "\n== Copying sample files =="
|
17
|
+
# unless File.exist?('config/database.yml')
|
18
|
+
# system 'cp config/database.yml.sample config/database.yml'
|
19
|
+
# end
|
20
|
+
|
21
|
+
puts "\n== Preparing database =="
|
22
|
+
system 'bin/rake db:setup'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system 'rm -f log/*'
|
26
|
+
system 'rm -rf tmp/cache'
|
27
|
+
|
28
|
+
puts "\n== Restarting application server =="
|
29
|
+
system 'touch tmp/restart.txt'
|
30
|
+
end
|
@@ -18,5 +18,8 @@ module Dummy
|
|
18
18
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
19
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
20
|
# config.i18n.default_locale = :de
|
21
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
21
24
|
end
|
22
25
|
end
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
2
2
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
3
3
|
|
4
|
-
require 'bundler/setup' if File.
|
4
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
5
5
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -1,25 +1,7 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
1
|
development:
|
7
|
-
adapter:
|
8
|
-
database:
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
2
|
+
adapter: postgresql
|
3
|
+
database: translatable_records_development
|
11
4
|
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
5
|
test:
|
16
|
-
adapter:
|
17
|
-
database:
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
6
|
+
adapter: postgresql
|
7
|
+
database: translatable_records_test
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
@@ -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
|
@@ -1,30 +1,28 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# Code is not reloaded between requests.
|
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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
@@ -12,16 +12,12 @@ 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
|
-
config.consider_all_requests_local
|
20
|
+
config.consider_all_requests_local = true
|
25
21
|
config.action_controller.perform_caching = false
|
26
22
|
|
27
23
|
# Raise exceptions instead of rendering exception templates.
|
@@ -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,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.routes.draw do
|
2
2
|
# The priority is based upon order of creation: first created -> highest priority.
|
3
3
|
# See how all your routes lay out with "rake routes".
|
4
4
|
|
@@ -39,7 +39,7 @@ Dummy::Application.routes.draw do
|
|
39
39
|
# get 'recent', on: :collection
|
40
40
|
# end
|
41
41
|
# end
|
42
|
-
|
42
|
+
|
43
43
|
# Example resource route with concerns:
|
44
44
|
# concern :toggleable do
|
45
45
|
# post 'toggle'
|
@@ -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: 2c1c8d4cbaa726b21aa6483b7d556125f4897508e2b94f8b3ddaec675168382c9b3b6eb5a9359d2fade03f539c16ac1ef905891c2410f2fd00b83b76c1666feb
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: 9dd531171128e7c3d11dd2c5c18c84ba43d29b677043002634a6f4d58bf2687a283b7b6dc6af741d63c3824f11fa1f858010d7c2509a932023f2ece0d3bfe6cf
|
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/config.ru
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateProductTranslations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :product_translations do |t|
|
4
|
+
t.integer :product_id
|
5
|
+
t.string :locale
|
6
|
+
t.string :name
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_index :product_translations, [:product_id, :locale], unique: true
|
11
|
+
end
|
12
|
+
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -9,24 +9,26 @@
|
|
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: 20161205171056) do
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
# These are extensions that must be enabled in order to support this database
|
17
|
+
enable_extension "plpgsql"
|
18
|
+
|
19
|
+
create_table "product_translations", force: :cascade do |t|
|
20
|
+
t.integer "product_id"
|
18
21
|
t.string "locale"
|
19
22
|
t.string "name"
|
20
|
-
t.datetime "created_at"
|
21
|
-
t.datetime "updated_at"
|
23
|
+
t.datetime "created_at", null: false
|
24
|
+
t.datetime "updated_at", null: false
|
22
25
|
end
|
23
26
|
|
24
|
-
add_index "
|
25
|
-
add_index "model_translations", ["model_id"], :name => "index_model_translations_on_model_id"
|
27
|
+
add_index "product_translations", ["product_id", "locale"], name: "index_product_translations_on_product_id_and_locale", unique: true, using: :btree
|
26
28
|
|
27
|
-
create_table "
|
28
|
-
t.datetime "created_at"
|
29
|
-
t.datetime "updated_at"
|
29
|
+
create_table "products", force: :cascade do |t|
|
30
|
+
t.datetime "created_at", null: false
|
31
|
+
t.datetime "updated_at", null: false
|
30
32
|
end
|
31
33
|
|
32
34
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
[1m[36m (20.4ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
2
|
+
[1m[35m (4.3ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
+
Migrating to CreateProducts (20130819155126)
|
5
|
+
[1m[35m (0.1ms)[0m BEGIN
|
6
|
+
[1m[36m (7.3ms)[0m [1mCREATE TABLE "products" ("id" serial primary key, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
7
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20130819155126"]]
|
8
|
+
[1m[36m (6.3ms)[0m [1mCOMMIT[0m
|
9
|
+
Migrating to CreateProductTranslations (20161205171056)
|
10
|
+
[1m[35m (6.2ms)[0m BEGIN
|
11
|
+
[1m[36m (14.0ms)[0m [1mCREATE TABLE "product_translations" ("id" serial primary key, "product_id" integer, "locale" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
12
|
+
[1m[35m (0.7ms)[0m CREATE UNIQUE INDEX "index_product_translations_on_product_id_and_locale" ON "product_translations" ("product_id", "locale")
|
13
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20161205171056"]]
|
14
|
+
[1m[35m (0.5ms)[0m COMMIT
|
15
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
16
|
+
[1m[35m (3.0ms)[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
|
17
|
+
FROM pg_constraint c
|
18
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
19
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
20
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
21
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
22
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
23
|
+
WHERE c.contype = 'f'
|
24
|
+
AND t1.relname = 'product_translations'
|
25
|
+
AND t3.nspname = ANY (current_schemas(false))
|
26
|
+
ORDER BY c.conname
|
27
|
+
|
28
|
+
[1m[36m (1.5ms)[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
|
29
|
+
FROM pg_constraint c
|
30
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
31
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
32
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
33
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
34
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
35
|
+
WHERE c.contype = 'f'
|
36
|
+
AND t1.relname = 'products'
|
37
|
+
AND t3.nspname = ANY (current_schemas(false))
|
38
|
+
ORDER BY c.conname
|
39
|
+
[0m
|