aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/tasks
Commit message (Collapse)AuthorAgeFilesLines
...
* Avoid modifying frozen string in check_schema_fileEugene Kenny2017-07-231-1/+1
| | | | | | This was missed when the frozen string literal pragma was added to this file because the string is only modified when running in the context of a full Rails app, which wasn't covered by the test suite.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-194-0/+8
|
* * Don't eagerly require Rails' minitest plugin.Kasper Timm Hansen2017-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | By making the Rails minitest behave like a standard minitest plugin we're much more likely to not break when people use other minitest plugins. Like minitest-focus and pride. To do this, we need to behave like minitest: require files up front and then perform the plugin behavior via the at_exit hook. This also saves us a fair bit of wrangling with test file loading. Finally, since the environment and warnings options have to be applied as early as possible, and since minitest loads plugins at_exit, they have to be moved to the test command. * Don't expect the root method. It's likely this worked because we eagerly loaded the Rails minitest plugin and that somehow defined a root method on `Rails`. * Assign a backtrace to failed exceptions. Otherwise Minitest pukes when attempting to filter the backtrace (which Rails' backtrace cleaner then removes). Means the exception message test has to be revised too. This is likely caused by the rails minitest plugin now being loaded for these tests and assigning a default backtrace cleaner.
* Merge branch 'master' into require_relative_2017Xavier Noria2017-07-021-1/+1
|\
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-024-4/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-024-0/+4
| |\ | | | | | | | | | Enforce frozen string in Rubocop
| | * Enforce frozen string in RubocopKir Shatrov2017-07-014-0/+4
| | |
| * | Merge pull request #29506 from pat/frozen-string-literalsMatthew Draper2017-07-021-1/+1
| |\ \ | | |/ | |/| | | | Make ActiveSupport frozen-string-literal friendly.
| | * Make ActiveRecord frozen string literal friendly.Pat Allan2017-06-201-1/+1
| | |
* | | [Active Record] require => require_relativeAkira Matsuda2017-07-011-1/+1
|/ /
* | PR ReviewEdouard CHIN2017-06-211-2/+2
| |
* | pass `structure_dump_flags` / `structure_load_flags` options before any other:Edouard CHIN2017-06-211-2/+2
|/ | | | | | | - On Mysql, some command line options that affect option-file handling such as `--no-defaults` have to be passed before any other options - Modified rails to pass them right after the `mysql` command - Ref https://dev.mysql.com/doc/refman/5.7/en/option-file-options.html and https://bugs.mysql.com/bug.php?id=83386 - Ref #27437
* Should use `quote` for a string literalRyuta Kamizono2017-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Follow up of #29077. Before: ```sql SELECT sql FROM sqlite_master WHERE tbl_name NOT IN ("foo") ORDER BY tbl_name, type DESC, name ``` After: ```sql SELECT sql FROM sqlite_master WHERE tbl_name NOT IN ('foo') ORDER BY tbl_name, type DESC, name ``` > If a keyword in double quotes (ex: "key" or "glob") is used in a context where it cannot be resolved to an identifier but where a string literal is allowed, then the token is understood to be a string literal instead of an identifier. http://www.sqlite.org/lang_keywords.html
* Fix a RuboCop offences using `rubocop -a`Koichi ITO2017-05-241-3/+3
|
* Improvements for SQLite rake task.Guillermo Iguaran2017-05-151-7/+18
| | | | | | * Use NOT IN in SQL query * Quote table names propertly * Use array form of command invocation
* Respect 'ignore_tables' in SQLite structure dumpGuillermo Iguaran2017-05-151-1/+10
|
* Respect 'ignore_tables' in MySQL structure dumpGuillermo Iguaran2017-05-151-0/+6
|
* Respect `ignore_tables` in Postgres structure dumpRusty Geldmacher2017-05-151-0/+6
| | | | | | When using `sql` as the schema format, or even just doing `rake db:structure:dump`, it would be good to respect the list of ignored tables that has been configured.
* Defer loading each DB Tasks class from AR DatabaseTasksAkira Matsuda2017-05-111-6/+6
| | | | | | Because we don't need to load tasks for DBs that we don't use for the current app. Also, these Tasks classes load AR::Base in their class level, and so immediately kick :active_record on_load hooks. This used to happen when we were loading tasks, not when we run a task.
* Refactor AR::Tasks::DatabaseTasks::migratebogdanvlviv2017-04-261-1/+1
| | | | | Set consistent type cast ENV["VERBOSE"]: ENV["VERBOSE"] is true if it not equal "false"
* Fix quoting in db:create grant all statement.Rune Schjellerup Philosof2017-04-201-1/+1
| | | | | | The database name used in the test would have actually shown this if it had tried to execute on a real Mysql instead of being stubbed out (dashes in database names needs quotes).
* Fixes #28359Philippe Guay2017-03-261-1/+3
| | | | | | | | | | | | | | | | Add stronger assertions to rake migration tasks to make sure the user is providing a numeric VERSION An empty string was getting converted to version = 0. This would in turn pass the presence check. Address linting warning Add test for rake task and refactor code to meet expectations In particular passing VERSION=0 should not raise an error. Addressed Comments for PR #28485. Trimmed empty lines + change of wording for error message Adjust test for change of wording in error message Change condition to follow rails idioms
* Only remove comments before the first statementAri Pollak2017-02-241-4/+9
|
* Drop comments from structure.sql in postgresqlAri Pollak2017-02-241-0/+15
| | | | Fixes #28153.
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-2/+2
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* Remove unneeded requires at active recordRafael Mendonça França2017-01-031-2/+0
|
* Dump schema cache for custom connectionKir Shatrov2017-01-011-0/+10
| | | | | | | | | Today `rake db:schema:cache:dump` only supports dumping cache for a single connection (`ActiveRecord::Base.connection`). This doesn't work for apps with multiple databases. This PR makes `DatabaseTasks` to provide an API for dumping schema cache for any connection.
* Remove deprecated #load_schema_forRafael Mendonça França2016-12-291-8/+0
|
* Remove original_exception from ActiveRecord::StatementInvalidRafael Mendonça França2016-12-291-1/+1
|
* Remove try! usage in sqlite_database_tasks.Kasper Timm Hansen2016-12-291-2/+2
| | | | We try to not try! internally.
* Make ActiveRecord structure load/dump configurableKir Shatrov2016-12-224-11/+28
| | | | | | | | Without this patch it's impossible to pass extra flags to mysqldump/pg_dump when running `rake db:structure:dump` or `load` The following config variables (`structure_load_flags` and `structure_dump_flags`) make it better configurable.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-292-2/+2
|
* Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-262-2/+2
| | | | Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
* Fix Remaining Case-In-Assignment Statement FormattingAlex Kitchens2016-09-061-8/+9
| | | | | | | | | Recently, the Rails team made an effort to keep the source code consistent, using Ruboco (bb1ecdcc677bf6e68e0252505509c089619b5b90 and below). Some of the case statements were missed. This changes the case statements' formatting and is consistent with changes in 810dff7c9fa9b2a38eb1560ce0378d760529ee6b and db63406cb007ab3756d2a96d2e0b5d4e777f8231.
* Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-031-1/+1
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* revises most Lint/EndAlignment offensesXavier Noria2016-08-071-3/+3
| | | | Some case expressions remain, need to think about those ones.
* applies remaining conventions across the projectXavier Noria2016-08-061-6/+6
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-064-116/+116
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-064-71/+71
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* systematic revision of =~ usage in ARXavier Noria2016-07-231-1/+1
| | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* Merge pull request #23301 from ppworks/improve_mysqldumpArthur Nogueira Neves2016-06-171-0/+1
|\ | | | | Improve mysqldump
| * Skip comments when exec mysqldumpNaoto Koshikawa2016-01-281-0/+1
| |
* | Merge pull request #24773 from ralinc/fix-silent-fail-on-psql-commandArthur Nogueira Neves2016-06-161-1/+2
|\ \ | | | | | | PostgreSQL: Fix db:structure:load silent failure on SQL error
| * | PostgreSQL: Fix db:structure:load silent failure on SQL errorRalin Chimev2016-05-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The command line flag "-v ON_ERROR_STOP=1" should be used when invoking psql to make sure errors are not suppressed. Example: psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db Fixes #23818.
* | | Add to_hash to specificationArthur Neves2016-05-251-1/+1
| | |
* | | Remove `name` from `establish_connection`Arthur Neves2016-05-241-1/+1
|/ / | | | | | | | | Instead of passing a separete name variable, we can make the resolver merge a name on the config, and use that before creating the Specification.
* | s/specification_name/connection_specification_nameArthur Neves2016-05-061-1/+1
| |
* | s/specification_id/specification_nameArthur Neves2016-05-051-1/+1
| |
* | Retrive the right pool for db tasksArthur Neves2016-05-051-2/+2
| |