This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Из минусов STI | |
1. Плохо масштабируется : по мере роста данных таблица может становиться большой и, возможно, трудной для обслуживания / запроса | |
2. Требуется осторожность при добавлении новых моделей или полей моделей, которые отличаются от общих полей | |
3. Позволяет создавать недопустимые объекты, если проверки отсутствуют | |
4. Может быть сложно проверить или запросить, если в таблице существует много нулевых значений | |
Из плюсов | |
1.Прост в реализации. | |
2. DRY - сохраняет реплицированный код, используя наследование и общие атрибуты |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Из минусов STI | |
1. Плохо масштабируется : по мере роста данных таблица может становиться большой и, возможно, трудной для обслуживания / запроса | |
2. Требуется осторожность при добавлении новых моделей или полей моделей, которые отличаются от общих полей | |
3. Позволяет создавать недопустимые объекты, если проверки отсутствуют | |
4. Может быть сложно проверить или запросить, если в таблице существует много нулевых значений | |
Из плюсов | |
1.Прост в реализации. | |
2. DRY - сохраняет реплицированный код, используя наследование и общие атрибуты |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT usename, state, query FROM pg_stat_activity WHERE wait_event IS NOT NULL AND backend_type = 'client backend' AND state = 'idle in transaction'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT pg_advisory_unlock_all(); | |
или | |
SELECT pid, locktype, mode FROM pg_locks WHERE locktype = 'advisory'; | |
SELECT pg_terminate_backend(<PID>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Devise | |
module Models | |
module RemoteAuthenticatable | |
extend ActiveSupport::Concern | |
# | |
# Here you do the request to the external webservice | |
# | |
# If the authentication is successful you should return | |
# a resource instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic key operators to query the JSON objects : | |
# #> : Get the JSON object at that path (if you need to do something fancy) | |
# -> : Get the JSON object at that path (if you don't) | |
# ->> : Get the JSON object at that path as text | |
# {obj, n} : Get the nth item in that object | |
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE | |
# Date | |
# date before today |
OlderNewer