Commit Graph

5283 Commits

Author SHA1 Message Date
Oscar Del Ben
a89fabbb02 Cleanup of databases.rake psql env variables 2011-11-17 18:49:47 +01:00
Arun Agrawal
5ccd9bcc1a No need to readlines then join, just use read ❤️
same as 4c1a1933cb
2011-11-17 12:24:40 +05:30
Aaron Patterson
4c1a1933cb No need to readlines then join, just use read ❤️ 2011-11-16 16:18:00 -08:00
Aaron Patterson
bb95e81538 Adding a deprecation warning for use of the schema_info table. 2011-11-16 15:51:25 -08:00
Aaron Patterson
97ca6358c5 Join method uses empty string by default, so remove it 2011-11-16 15:40:20 -08:00
Aaron Patterson
b96aaf8ccb dbfile isn't supported anymore, so remove 2011-11-16 15:31:37 -08:00
Aaron Patterson
ca69408b49 Reduce schema format tests 2011-11-16 15:31:37 -08:00
Aaron Patterson
38d26b0cb5 Move conditionals to separate tasks so they can be reused. 2011-11-16 15:31:37 -08:00
James Adam
73cb0f9828 ActiveRecord::Base#becomes should retain the errors of the original object.
This commit contains a simple failing test that demonstrates the behaviour we expect, and a fix. When using `becomes` to transform the type of an object, it should retain any error information that was present on the original instance.
2011-11-16 23:19:58 +00:00
Aaron Patterson
cef1e14e09 removing some useless conditionals 2011-11-16 14:46:20 -08:00
Aaron Patterson
43821bf351 Merge pull request #2948 from atambo/master
schema_format :sql should behave like schema_format :ruby
2011-11-16 14:37:24 -08:00
Ryan Naughton
63a22ca616 Fixes issue #3483, regarding using a mixture of ranges and discrete values in find conditions. Paired with Joey Schoblaska. 2011-11-14 21:43:27 -06:00
José Valim
9fa329b754 Speed up attribute invocation by checking if both name and calls are compilable. 2011-11-14 20:12:17 +01:00
Noé Froidevaux
bf6efa8d9c Fix pull request #3609 2011-11-13 11:03:22 +01:00
Noé Froidevaux
27c5800c9c Prevent multiple SHOW TABLES calls when a table don't exists in database. 2011-11-11 12:09:51 +01:00
Vijay Dev
6e112e4217 Modify change_table to remove the need for the block argument. 2011-11-11 02:47:27 +05:30
Vijay Dev
b805c71655 Checking the arity of the block passed to create_table
A recent change made to create_table does away with the
need for the block argument. Checking the arity will prevent the
mixing up of the two syntaxes.
2011-11-10 22:55:13 +05:30
Akira Matsuda
74c6e80cab exclude ORDER BY clause when querying Relation#exists? 2011-11-09 04:51:11 +09:00
Vijay Dev
cff1d751d0 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	railties/guides/source/active_record_querying.textile
2011-11-08 21:35:17 +05:30
Xavier Noria
17ecdd388c adds trailing +s to the output of EXPLAIN for MySQL 2011-11-07 02:01:56 -08:00
Akira Matsuda
aff9e68cb5 document fix: remove_column takes multiple column_names 2011-11-07 14:03:33 +09:00
Akira Matsuda
55b203dac1 self.up, self.down => up, down 2011-11-07 11:56:50 +09:00
Aaron Patterson
9b46613780 Merge pull request #3521 from nulogy/fix_postgres_adapter_to_handle_spaces_between_schemas
Fix postgres adapter to handle spaces between schemas
2011-11-06 13:16:07 -03:00
Justin Mazzi
c7d2078596 Update ActiveRecord#attribute_present? to work as documented
"Returns true if the specified attribute has been set by the user or by
a database load and is neither nil nor empty?"

Fixes #1613
2011-11-05 22:36:19 -04:00
Xavier Noria
e7b7b44123 implements AR::Relation#explain
This is a first implementation, EXPLAIN is highly
dependent on the database and I have made some
compromises.

On one hand, the method allows you to run the most
common EXPLAIN and that's it. If you want EXPLAIN
ANALYZE in PostgreSQL you need to do it by hand.

On the other hand, I've tried to construct a string
as close as possible to the ones built by the
respective shells. The rationale is that IMO the
user should feel at home with the output and
recognize it at first sight. Per database.

I don't know whether this implementation is going
to work well. Let's see whether people like it.
2011-11-05 18:30:19 -07:00
Jon Leighton
f575e21025 Merge pull request #3525 from kennyj/fix_3440-1
Fixed an issue id false option is ignored on mysql/mysql2 (fix #3440)
2011-11-05 10:29:18 -07:00
kennyj
fb0bf3c984 Fixed an issue id false option is ignored on mysql/mysql2 (fix #3440) 2011-11-06 02:15:47 +09:00
Jon Leighton
9a111c7cf9 Use uniq instead of manually putting a DISTINCT in the query 2011-11-05 16:22:18 +00:00
Jon Leighton
562583c766 Add ActiveRecord::Relation#uniq for toggling DISTINCT in the SQL query 2011-11-05 16:22:18 +00:00
Alex Tambellini
15fb4302b6 schema_format :sql should behave like schema_format :ruby
This commit adds a db:structure:load task that is run instead of
db:schema:load when schema_format is set to :sql. This patch also removes
the prefixing of the structure.sql files to mimic the use of a single
schema.rb file. The patch originates from github issue #715.
2011-11-04 17:34:08 -04:00
Vlad Jebelev
69dcd45aea AR changes to support creating ordered (asc, desc) indexes 2011-11-04 15:45:24 -05:00
Jon Leighton
e6cc2ea201 Allow the :class_name option for associations to take a symbol.
This is to avoid confusing newbies, and to be consistent with the fact
that other options like :foreign_key already allow a symbol or a string.
2011-11-04 11:17:56 +00:00
Aaron Patterson
0e407a9041 Merge pull request #1163 from amatsuda/sexier_migration_31
Sexier migrations
2011-11-04 03:29:59 -07:00
Jeremy Kemper
533a9f84b0 Merge pull request #3507 from jmazzi/issue-3503
Preserve SELECT columns on the COUNT for finder_sql when possible
2011-11-03 21:17:15 -07:00
Jon Leighton
d486103570 Fix #3271.
Building the conditions of a nested through association could
potentially modify the conditions of the through and/or source
association.

This is a Bad Thing.
2011-11-03 15:12:08 +00:00
Jon Leighton
567d454d99 Memoize through association 2011-11-03 13:24:39 +00:00
Jon Leighton
19b2a5f2bd Remove all revelant through records.
If a record is removed from a has_many :through, all of the join records
relating to that record should also be removed from the through
association's target.

(Previously the records were removed in the database, but only one was
removed from the in-memory target array.)
2011-11-03 13:13:13 +00:00
Jon Leighton
71bc921ec8 Fix adding multiple instances of the same record to a has_many :through.
Fixes #3425.
2011-11-03 12:39:05 +00:00
Jon Leighton
b4b178f7e9 Fix #3247.
Fixes creating records in a through association with a polymorphic source
type.
2011-11-03 10:23:42 +00:00
Laust Rud Jacobsen
ff9c2799c1 dump_schema_information: explicitly order inserts into schema_migrations table
This change reduces churn in the db/development_structure.sql file when using :sql as
active_record.schema_format, and makes comparing diffs much easier.

Test ensures the output SQL-statements are lexically ordered by version.
2011-10-31 10:36:13 +01:00
Vijay Dev
c809de8291 Merge branch 'master' of github.com:lifo/docrails 2011-10-30 14:47:23 +05:30
Aaron Patterson
4a065d56ed clear statement cache when tables are altered 2011-10-27 10:55:52 -07:00
Pratik Naik
0d0176c4ff Allow instances to disable record_timestamps 2011-10-26 18:20:12 +01:00
David Heinemeier Hansson
1d9ab88ee6 Merge branch 'master' of github.com:rails/rails 2011-10-25 17:22:55 -05:00
David Heinemeier Hansson
5daf07704a Fix that changing a store should mark the store attribute as changed 2011-10-25 17:22:52 -05:00
Vijay Dev
ddce29bfa1 safeguard against configs missing environment or the database key 2011-10-26 00:41:41 +05:30
Joost Baaij
80bcfb00f7 Added a note that optimistic locking also needs a hidden field to function across web workers. 2011-10-25 13:57:24 +03:00
Xavier Noria
9dd168c402 minor revision to some new code in databases.rake 2011-10-24 14:46:28 +02:00
Xavier Noria
b064614ffb Merge pull request #2419 from dmitriy-kiriyenko/drop_test_database_in_development_when_running_rake_db_drop
When running "rake db:drop" also drop test database in development environment
2011-10-24 05:35:06 -07:00
Vijay Dev
8698debcc2 Merge branch 'master' of github.com:lifo/docrails 2011-10-23 01:38:37 +05:30