Commit Graph

25 Commits

Author SHA1 Message Date
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
Guo Xiang Tan
26d14dbcbb Remove onceoff job in migrate rake task. 2017-11-22 12:50:01 +08:00
Guo Xiang Tan
edfa2c3af9 FIX: Don't enqueue onceoff job in migration.
* Deployment of app servers may happen minutes after migrations.
2017-11-22 12:07:48 +08:00
Robin Ward
966c7e7f07 FEATURE: Allow plugins to dynamically add seed fixture paths
This is useful if your plugin wants different seed data for different
locales for example.
2017-11-16 14:43:17 -05:00
Robin Ward
8cd0026cde FIX: If there is an invalid locale in the site setting, default to en 2017-11-16 10:58:29 -05:00
Guo Xiang Tan
77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Sam
fef08c6fee FEATURE: rake db:stats
Basic rake task to provide db stats like largest tables, row count and size
2017-08-25 10:29:04 -04:00
Guo Xiang Tan
a1f60cfcb8 Fix incorrect test migration. 2017-08-10 00:20:07 +09:00
Guo Xiang Tan
2c39743d5d Introduce multisite tests for better coverage. 2017-08-08 12:58:22 +09:00
Guo Xiang Tan
1a7e954e09 FIX: Store custom emojis as uploads.
* Depending on a hardcoded directory was a flawed design
  which made it impossible to debug when custom emojis go
  missing.
2017-03-14 13:07:18 +08:00
Guo Xiang Tan
9baf89a901 Remove database vacuum task from Discourse. 2017-02-20 09:02:38 +08:00
Robin Ward
3f7ced9236 Try running once off jobs outside of db:migrate 2016-04-07 15:07:24 -04:00
Robin Ward
078b3bc87e Log once off jobs and enqueue on db:migrate 2016-04-07 14:32:31 -04:00
Sam
8d49091572 PERF: stop running VACUUM FULL only run VACUUM 2015-12-07 20:14:26 +11:00
Robin Ward
57fc1e5e0c FIX: Don't run a FULL ANALYZE on first migration.
This seems to block databases unecessarily. We should only really be
vacuuming when there is a lot of deleted data to recover.
2015-10-22 12:34:09 -04:00
Erick Guan
29840888e5 FIX: respect default locale settings when seed
We seed special categories during migration so we have to set the
locale before the migration happens.
2015-02-14 23:51:53 +08:00
Blake Erickson
5f124df251 add rake task and seed data for discourse_api 2014-09-10 20:53:21 -06:00
Sam
fe6e4d7da1 FIX: fails on initial migration if default_locale is nil 2014-08-29 12:01:28 +10:00
Sam
ae2d80501a PERF: run full vacuum every 90 days (during migration)
Will reclaim space and improve perf
2014-08-07 11:07:30 +10:00
Neil Lalonde
b942436d7b FIX: rescue from I18n.locale = nil when trying to seed db 2014-07-28 12:40:00 -04:00
Neil Lalonde
5a33e6f00c Move FAQ, Terms of Service, and Privacy Policy into topics in the Staff category. First post of those topics will be rendered on their respective pages. Site settings and content are not used for these documents anymore. Translations of the default text is moved into the standard YML files. 2014-07-25 14:41:20 -04:00
Régis Hanol
269f52b8f7 fix db rake tasks 2014-02-13 13:31:13 -08:00
Neil Lalonde
3a6c3ee65d Add two rake tasks: db:rebuild_indexes and import:remove_backup 2014-01-31 15:30:47 -05:00
Sam
270fde7dbd correct rake test:prepare so it seeds the db correctly
move category creation into seeds as well, so db can be seeded from structure.sql
2013-10-25 10:31:33 +11:00
Sam
3d3b589b4d for now, run seed fu automatically after migrate ... still think there should be a cleaner way 2013-04-08 09:56:42 +10:00