discourse/app/models
Sam 5f64fd0a21 DEV: remove exec_sql and replace with mini_sql
Introduce new patterns for direct sql that are safe and fast.

MiniSql is not prone to memory bloat that can happen with direct PG usage.
It also has an extremely fast materializer and very a convenient API

- DB.exec(sql, *params) => runs sql returns row count
- DB.query(sql, *params) => runs sql returns usable objects (not a hash)
- DB.query_hash(sql, *params) => runs sql returns an array of hashes
- DB.query_single(sql, *params) => runs sql and returns a flat one dimensional array
- DB.build(sql) => returns a sql builder

See more at: https://github.com/discourse/mini_sql
2018-06-19 16:13:36 +10:00
..
concerns DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
about.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
admin_dashboard_data.rb FIX: show private message topic count on admin dashboard reports 2018-03-27 17:10:33 +05:30
admin_dashboard_next_data.rb Replace the "posts" line with message count 2018-05-17 10:26:30 +10:00
api_key.rb Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
application_request.rb FEATURE: control which web crawlers can access using a whitelist or blacklist 2018-03-22 15:41:02 -04:00
auto_track_duration_site_setting.rb
backup.rb FEATURE: allow specifying s3 config via globals 2017-10-06 16:20:01 +11:00
badge_grouping.rb Update annotations. 2018-02-20 14:28:58 +08:00
badge_type.rb Update annotations. 2018-02-20 14:28:58 +08:00
badge.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
category_and_topic_lists.rb
category_custom_field.rb
category_featured_topic.rb refinement and test for batch mode on feature_topics 2017-12-20 13:58:05 +11:00
category_group.rb FEATURE: move staff tags setting to tag group settings 2018-04-20 15:34:23 -04:00
category_list.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
category_page_style.rb FEATURE: New "Categories and Top" homepage style 2018-03-03 14:26:57 -05:00
category_search_data.rb annotate models 2017-08-16 10:38:11 -04:00
category_tag_group.rb Update annotations. 2018-02-20 14:28:58 +08:00
category_tag_stat.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
category_tag.rb Update annotations. 2018-02-20 14:28:58 +08:00
category_user.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
category.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
child_theme.rb Update annotations. 2018-02-20 14:28:58 +08:00
color_scheme_color.rb Update annotations. 2018-02-20 14:28:58 +08:00
color_scheme.rb FIX: ColorScheme color missing was returning "nil" 2018-05-28 11:46:00 +10:00
custom_emoji.rb
developer.rb
digest_email_site_setting.rb
directory_item.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
discourse_single_sign_on.rb FIX: always unstage users when they log in 2018-05-13 17:00:02 +02:00
discourse_version_check.rb REFACTOR: Avoid duplicated logic on server and client. 2017-11-21 17:10:04 +08:00
draft_sequence.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
draft.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
email_change_request.rb
email_log.rb Update annotations. 2018-02-20 14:28:58 +08:00
email_token.rb Review Changes for f4f8a293e7. 2018-02-21 14:55:49 +08:00
embeddable_host.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
embedding.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
emoji_set_site_setting.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
emoji.rb FEATURE: adds emoji search aliases 2018-05-01 15:43:49 +02:00
facebook_user_info.rb Update annotations. 2018-02-20 14:28:58 +08:00
github_user_info.rb Update annotations. 2018-02-20 14:28:58 +08:00
given_daily_like.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
global_setting.rb FIX for bucket name in GlobalSetting with folder 2018-05-17 12:59:34 -05:00
google_user_info.rb Update annotations. 2018-02-20 14:28:58 +08:00
group_archived_message.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
group_custom_field.rb
group_history.rb
group_manager.rb
group_mention.rb Update annotations. 2018-02-20 14:28:58 +08:00
group_user.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
group.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
incoming_domain.rb
incoming_email.rb FEATURE: Use Message-ID for detecting email replies to group 2018-04-05 11:00:38 +02:00
incoming_link.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
incoming_links_report.rb FIX: don't use PMs in Incoming Links reports 2018-05-16 16:55:54 +02:00
incoming_referer.rb
instagram_user_info.rb
invite_redeemer.rb FIX: better handling of invite links after they are redeemed 2018-05-08 20:17:57 +05:30
invite.rb DEV: Rails 5.2 upgrade and global gem upgrade 2018-06-07 14:21:33 +10:00
invited_group.rb
like_notification_frequency_site_setting.rb
locale_site_setting.rb FEATURE: Allow plugins to register a new locale 2018-01-25 14:57:41 +01:00
mailing_list_mode_site_setting.rb
muted_user.rb Update annotations. 2018-02-20 14:28:58 +08:00
new_topic_duration_site_setting.rb
notification_level_when_replying_site_setting.rb
notification.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
oauth2_user_info.rb Update annotations. 2018-02-20 14:28:58 +08:00
onceoff_log.rb
optimized_image.rb Remove use of rescue nil. 2018-04-02 13:52:51 +08:00
permalink.rb Remove use of rescue nil. 2018-04-02 13:52:51 +08:00
plugin_store_row.rb Update annotations. 2018-02-20 14:28:58 +08:00
plugin_store.rb REFACTOR: Instance methods added to 'PluginStore' model for easy access (#5315) 2017-11-15 10:10:20 -05:00
post_action_type.rb FIX: Post Action Type 6 is not a notify type 2017-10-19 17:13:55 -04:00
post_action.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
post_analyzer.rb FEATURE: New site setting, whitelisted_link_domains 2018-06-13 16:11:22 -04:00
post_custom_field.rb FEATURE: enforce tagging on categories 2018-04-11 07:15:24 +05:30
post_detail.rb Update annotations. 2018-02-20 14:28:58 +08:00
post_mover.rb DEV: Rails 5.2 upgrade and global gem upgrade 2018-06-07 14:21:33 +10:00
post_reply.rb
post_revision.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
post_search_data.rb Update annotations. 2018-02-20 14:28:58 +08:00
post_stat.rb Update annotations. 2018-02-20 14:28:58 +08:00
post_timing.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
post_upload.rb
post.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
previous_replies_site_setting.rb
push_subscription.rb Update annotations. 2018-05-09 07:52:45 +08:00
queued_post.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
quoted_post.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
remote_theme.rb add more safety 2018-03-16 11:19:06 +11:00
report.rb FIX: flags report is now a lower is better kind of report 2018-05-25 12:59:39 +02:00
s3_region_site_setting.rb add 'us-east-2' S3 region 2017-07-10 15:36:38 +02:00
scheduler_stat.rb
screened_email.rb Update annotations. 2018-02-20 14:28:58 +08:00
screened_ip_address.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
screened_url.rb Update annotations. 2018-02-20 14:28:58 +08:00
search_log.rb Fix randomly failing specs due to SearchLog cache. 2018-04-23 10:10:10 +08:00
shared_draft.rb FEATURE: enforce tagging on categories 2018-04-11 07:15:24 +05:30
single_sign_on_record.rb Update annotations. 2018-05-09 07:52:45 +08:00
site_setting.rb FIX for bucket name in GlobalSetting with folder 2018-05-17 12:59:34 -05:00
site.rb FEATURE: add category suppress from latest 2018-02-22 09:56:35 +11:00
slug_setting.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
stylesheet_cache.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
tag_group_membership.rb Update annotations. 2018-02-20 14:28:58 +08:00
tag_group_permission.rb FEATURE: move staff tags setting to tag group settings 2018-04-20 15:34:23 -04:00
tag_group.rb FIX: tags in a 'visible by everyone but usable only by staff' group weren't visible by everyone 2018-05-16 09:48:19 +02:00
tag_search_data.rb annotate stuff 2017-08-29 10:48:22 -04:00
tag_user.rb Update annotations. 2018-02-20 14:28:58 +08:00
tag.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
theme_field.rb FEATURE: theme settings in RAW hbs templates 2018-05-03 10:43:07 +10:00
theme_setting.rb FEATURE: we need access to settings in theme js 2018-03-05 15:35:41 +11:00
theme.rb Add plugin outlet in admin theme list (#5837) 2018-05-18 10:09:21 +02:00
top_lists.rb
top_menu_item.rb
top_topic.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
topic_allowed_group.rb
topic_allowed_user.rb
topic_converter.rb FIX: update categories topic_count when converting topic to a PM and vice versa 2018-04-04 12:01:56 +05:30
topic_custom_field.rb
topic_embed.rb FIX: TopicEmbed.import should update title and author 2018-05-02 17:12:31 +10:00
topic_featured_users.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
topic_invite.rb
topic_link_click.rb FIX: TopicLinkClick: do not log IP of logged in users 2018-05-22 16:05:38 +10:00
topic_link.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
topic_list.rb FIX: Shared draft performance fix + missing avatars 2018-03-28 16:11:43 -04:00
topic_notifier.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_participants_summary.rb
topic_poster.rb
topic_posters_summary.rb Require dependency otherwise it causes Sidekiq to lock up in development. 2017-09-25 13:48:59 +08:00
topic_search_data.rb Update annotations. 2018-02-20 14:28:58 +08:00
topic_tag.rb FIX: automatically in/decrement topic_tags.pm_topic_count 2018-05-15 16:05:48 +02:00
topic_timer.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
topic_tracking_state.rb UX: Use topic list for displaying group messages on group page. 2018-03-16 11:56:40 +08:00
topic_user.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
topic_view_item.rb FIX: TopicViewItem: do not store IP of logged in users 2018-06-12 12:43:56 +10:00
topic.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
translation_override.rb Fix the build 2018-03-16 22:55:42 +01:00
trust_level_setting.rb
trust_level3_requirements.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
twitter_user_info.rb Update annotations. 2018-02-20 14:28:58 +08:00
unsubscribe_key.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
upload.rb fix get from url for external uploads without CDN 2018-06-13 16:21:28 +10:00
user_action.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
user_api_key.rb Update annotations. 2018-02-20 14:28:58 +08:00
user_archived_message.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
user_auth_token_log.rb
user_auth_token.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
user_avatar.rb Remove use of rescue nil. 2018-04-02 13:52:51 +08:00
user_badge.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00
user_badges.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_custom_field.rb
user_email.rb Improve UserEmail#email validation to use the index. 2018-03-20 10:22:06 +08:00
user_export.rb FIX: Clean up stale UserExport records daily. 2018-06-05 09:43:40 +08:00
user_field_option.rb Update annotations. 2018-02-20 14:28:58 +08:00
user_field.rb Update annotations. 2018-02-20 14:28:58 +08:00
user_history.rb FEATURE: Log user merge in staff logs 2018-06-11 18:43:56 +02:00
user_open_id.rb Update annotations. 2018-02-20 14:28:58 +08:00
user_option.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
user_profile_view.rb FIX: UserProfileView: Do not log IP of logged-in users 2018-05-25 15:54:14 +10:00
user_profile.rb FIX: handle bad user profile website 2018-05-17 13:21:24 +05:30
user_search_data.rb annotate models 2017-08-16 10:38:11 -04:00
user_search.rb FEATURE: search within title using in:title 2018-02-20 14:41:21 +11:00
user_second_factor.rb Update annotations. 2018-02-26 15:32:04 +08:00
user_stat.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
user_summary.rb FEATURE: show topics viewed on user summary 2017-11-17 17:53:30 -05:00
user_visit.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
user_warning.rb Update annotations. 2018-02-20 14:28:58 +08:00
user.rb DEV: remove exec_sql and replace with mini_sql 2018-06-19 16:13:36 +10:00
username_validator.rb Revert "FIX: Username uniqueness check should not happen to current user_id" 2018-04-03 00:44:04 +08:00
watched_word.rb Update annotations. 2018-02-20 14:28:58 +08:00
web_crawler_request.rb FEATURE: enforce tagging on categories 2018-04-11 07:15:24 +05:30
web_hook_event_type.rb FEATURE: webhook for flag events 2018-04-13 07:47:58 +05:30
web_hook_event.rb Update annotations. 2018-02-20 14:28:58 +08:00
web_hook.rb Make rubocop happy again. 2018-06-07 13:28:18 +08:00