Ryuta Kamizono
c1ab4a2dbf
Move select_rows
implementation to super class
2016-04-24 11:20:46 +09:00
Vipul A M
210729c4cc
Followup of #15771
...
Make sure we handle explicitly passed nil's to lock_version as well.
An explicitly passed nil value is now converted to 0 on LockingType,
so that we don't end up with ActiveRecord::StaleObjectError in update record
optimistic locking
Fixes #24695
2016-04-24 04:01:18 +05:30
Jeremy Daer
4c76ce6404
Schema load: Fix dupe version insert
...
Re. 6e098284e97250eaed6f30f5c7c362d87da986b0
2016-04-22 18:32:47 -07:00
Jeremy Daer
a14c811026
Merge pull request #24685 from vipulnsward/sqlite-compat-for-multi-insert
...
Gracefully fallback on version migrations for sqlite < 3.7.11
2016-04-22 15:33:59 -07:00
Vipul A M
6e098284e9
42dd2336b3
changed INSERT INTO versions to run in 1 single query.
...
This breaks for sqlite versions < 3.7.11, which is especially the case on Ubuntu 12.04 LTS, that has SQLite version 3.7.9 as default.
So we check for support for multi insert, before performing single query inserts, else fallback to older version of running multiple queries.
[Vipul A M & Yasuo Honda]
2016-04-23 03:18:13 +05:30
Sean Griffin
1ca6f7f767
Do not attempt to return connection with open transaction to pool ( #24610 )
...
When the query cache completes, if Active Record is still inside of a
transaction, it is because the transaction is meant to be left open
above this unit of work (such as transactional fixtures in tests). There
were several tests around the behavior of "tests" that were invalid, as
tests are not run through the executor. They have been changed to
reflect the new behavior, which is closer to what actually occurs in
Rails tests.
Fixes #23989
Fixes #24491
Close #24500
2016-04-22 12:56:43 -06:00
Rafael França
875c679a33
Merge pull request #24672 from mrkjlchvz/mc-space-bump
...
Minor space bump.
2016-04-21 10:51:47 -03:00
Mark
64bf0fcff4
Minor space bump.
2016-04-21 19:20:54 +08:00
प्रथमेश Sonpatki
868a49262c
Revert "add doc for :type
option of #create_join_table
[ci skip]"
2016-04-21 07:54:06 +05:30
yuuji.yaginuma
1a409956de
add doc for :type
option of #create_join_table
[ci skip]
...
Follow up to #24221 .
2016-04-21 11:09:53 +09:00
Kasper Timm Hansen
3ff6b800f2
Merge pull request #24221 from gregmolnar/uuid
...
create_join_table should work with uuid
2016-04-20 22:13:17 +02:00
Jeremy Daer
3b38fb3d57
Merge pull request #23557 from kamipo/dump_indexes_in_create_for_generates_sql_in_one_query
...
Dump indexes in `create_table` for generates SQL in one query
2016-04-20 11:05:22 -07:00
Ryuta Kamizono
67f4994a0b
undef_method
is not needed
2016-04-19 23:03:46 -07:00
Ryuta Kamizono
74b5112282
Dump indexes in create_table
for generates SQL in one query
...
If the adapter supports indexes in create table, it generates SQL
in one query.
2016-04-20 10:24:18 +09:00
Ryuta Kamizono
da87a679c5
Fix test_blank_columns_created_in_block
...
Follow up to 1683410.
2016-04-20 07:38:04 +09:00
Jon Moss
1909095aea
Remove unecessary comment
2016-04-19 16:48:40 -04:00
Jeremy Daer
1683410c5e
Database comments: Treat blank comments as no comment. Don't dump blank comments.
2016-04-19 12:31:23 -07:00
Ryuta Kamizono
dd58c3bf23
Define arel_visitor
method on all adapters
...
`Arel::Visitors::VISITORS` was removed at https://github.com/rails/arel/pull/412 .
2016-04-20 01:27:08 +09:00
Ryuta Kamizono
a80e944e18
Remove unused table_with_autoincrement
table
2016-04-19 17:17:19 +09:00
Jeremy Daer
0c77018f8d
Merge pull request #24317 from Gaurav2728/unused_set_in_active_record
...
connection adapters column, delegation in Active Record have not use …
2016-04-19 01:08:39 -07:00
Jeremy Daer
db06ad6149
Merge pull request #24503 from prathamesh-sonpatki/add-test-for-warn-on-records-fetched-greater-than
...
Add missing test case for record_fetched_greater_than config
2016-04-19 01:06:04 -07:00
Jeremy Daer
0575f4646a
Merge pull request #24576 from yahonda/quote_column_name_for_reserved_word_size
...
Address ORA-00923 error by quoting a reserved word "SIZE"
2016-04-19 00:59:38 -07:00
Jeremy Daer
ca13731e61
Merge pull request #23497 from kamipo/extract_schema_qualified_name
...
Extract `extract_schema_qualified_name` method
2016-04-19 00:44:10 -07:00
Jeremy Daer
7854e69c74
Merge pull request #23515 from kamipo/extract_arel_visitor
...
Extract `arel_visitor` and move up to the abstract adapter
2016-04-19 00:43:11 -07:00
Jeremy Daer
f2f2d64429
Merge pull request #23523 from kamipo/avoid_truncation_in_uniqueness_validation
...
Avoid a string value truncation in uniqueness validation
2016-04-18 17:53:22 -07:00
Jeremy Daer
446190fbd2
Merge pull request #23522 from kamipo/add_value_too_long_exception_class
...
Add `ActiveRecord::ValueTooLong` exception class
2016-04-18 17:31:28 -07:00
Jeremy Daer
b36078fb8b
Merge pull request #24614 from kamipo/foreign_key_respects_table_name_prefix_and_suffix
...
`foreign_key` respects `table_name_prefix` and `table_name_suffix`
2016-04-18 17:21:28 -07:00
Ryuta Kamizono
0cae0ce5ce
foreign_key
respects table_name_prefix
and table_name_suffix
2016-04-19 07:33:31 +09:00
Jeremy Daer
fe685c6292
Merge pull request #23622 from kamipo/primary_key_should_be_not_null
...
Primary key should be `NOT NULL`
2016-04-18 15:31:15 -07:00
Jeremy Daer
811c532351
Fix isolated test failures due to referencing ActiveRecord::Tasks::DatabaseAlreadyExists before another test happened to make it available
2016-04-18 13:03:37 -07:00
Sean Griffin
d63054bbcb
Merge pull request #24607 from vipulnsward/where-clause-frozen-array
...
Don't create new arrays when trying to compute non_empty_predicates for ast generation
2016-04-18 14:00:46 -06:00
Jeremy Daer
485e7f25f2
Database comments: switch to keyword args for new table options
...
* Switch to keyword args where we can without breaking compat.
* Use add_table_options! for :options, too.
* Some code polish.
2016-04-18 12:42:24 -07:00
Vipul A M
1a9eb19ac4
Don't create new arrays when trying to compute non_empty_predicates for where clause predicate. Get a 3-4% improvement in AST generation.
...
Perf compare: https://gist.github.com/vipulnsward/7e4e9ecb157e574002313249a7969c82
2016-04-18 23:59:27 +05:30
Vipul A M
7f0df7b6a9
Merge pull request #24535 from tomash/association-validate-docs
...
Update ActiveRecord associations documentation on :validate option [ci skip]
2016-04-18 15:13:23 +05:30
Tomasz Stachewicz
33a9c57ee4
[ci skip] Update ActiveRecord associations documentation to avoid confusion with :validate option. Caused by #24532 .
2016-04-18 11:38:53 +02:00
Yves Senn
38d6d4129b
Merge pull request #24581 from vipulnsward/add-reference-named-unique-index-test
...
Add test to verify named unique index, when creating reference via add_reference
2016-04-18 09:35:38 +02:00
Prathamesh Sonpatki
dbaef766fb
Move CHANGELOG entry about database notices at the top [ci skip]
2016-04-18 10:37:17 +05:30
Jeremy Daer
5154701e20
Merge pull request #24551 from bogdanvlviv/notice_for_tasks
...
Added notice when a database is successfully created or dropped.
2016-04-17 15:21:43 -07:00
bogdanvlviv
26861302c9
Added notice when a database is successfully created or dropped.
2016-04-17 23:12:16 +03:00
Jeremy Daer
3b0a627a94
Merge pull request #22911 from Envek/database_comments
...
Add support for specifying comments for tables, columns, and indexes in database itself
2016-04-16 22:19:47 -07:00
Vipul A M
bca1872198
documentation for add_references index option [ci skip]
...
documentation for add_references index option [ci skip]
2016-04-17 02:06:25 +05:30
Alex Handley
d9565811f0
[ci skip] docs for add_references index option
...
- Add link for finding the addional options for index.
- Add example for unique index as this is a common requirement.
- Add link in guide for index options.
2016-04-16 21:32:22 +01:00
Vipul A M
ddb4636d24
Add test to verify named unique index, when creating reference via add_reference
2016-04-16 20:44:08 +05:30
Yasuo Honda
8a4a8b2aca
Address ORA-00923 error by quoting a reserved word "SIZE"
2016-04-16 10:02:49 +00:00
Andrey Novikov
c690b9ce39
Add support for specifying comments for tables, columns, and indexes.
...
Comments are specified in migrations, stored in database itself (in its schema),
and dumped into db/schema.rb file.
This allows to generate good documentation and explain columns and tables' purpose
to everyone from new developers to database administrators.
For PostgreSQL and MySQL only. SQLite does not support comments at the moment.
See docs for PostgreSQL: http://www.postgresql.org/docs/current/static/sql-comment.html
See docs for MySQL: http://dev.mysql.com/doc/refman/5.7/en/create-table.html
2016-04-16 10:17:26 +03:00
Vipul A M
65a7e90cc1
Add changelog for #24542
...
[ci skip]
2016-04-15 12:06:56 +05:30
Ryuta Kamizono
73af7945d5
Should keep quoting behaivor of a time column value in sqlite3 adapter
...
Follow up to #24542 .
In MySQL and PostgreSQL, a time column value is saved as ignored the
date part of it. But in SQLite3, a time column value is saved as a string.
We should keep previous quoting behavior in sqlite3 adapter.
```
sqlite> CREATE TABLE "foos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "start" time(0), "finish" time(4));
sqlite> INSERT INTO "foos" ("start", "finish") VALUES ('2000-01-01 12:30:00', '2000-01-01 12:30:00.999900');
sqlite> SELECT "foos".* FROM "foos";
1|2000-01-01 12:30:00|2000-01-01 12:30:00.999900
sqlite> SELECT "foos".* FROM "foos" WHERE "foos"."start" = '2000-01-01 12:30:00' LIMIT 1;
1|2000-01-01 12:30:00|2000-01-01 12:30:00.999900
sqlite> SELECT "foos".* FROM "foos" WHERE "foos"."start" = '12:30:00' LIMIT 1;
sqlite>
```
2016-04-15 03:45:02 +09:00
Ryuta Kamizono
28ec8c4a57
Add quoted_time
for truncating the date part of a time column value
...
Context #24522 .
TIME column on MariaDB doesn't ignore the date part of the string when
it coerces to time.
```
root@localhost [test] > CREATE TABLE `foos` (`id` int AUTO_INCREMENT PRIMARY KEY, `start` time(0), `finish` time(4)) ENGINE=InnoDB;
Query OK, 0 rows affected (0.02 sec)
root@localhost [test] > INSERT INTO `foos` (`start`, `finish`) VALUES ('2000-01-01 12:30:00', '2000-01-01 12:30:00.999900');
Query OK, 1 row affected, 2 warnings (0.00 sec)
Note (Code 1265): Data truncated for column 'start' at row 1
Note (Code 1265): Data truncated for column 'finish' at row 1
root@localhost [test] > SELECT `foos`.* FROM `foos`;
+----+----------+---------------+
| id | start | finish |
+----+----------+---------------+
| 1 | 12:30:00 | 12:30:00.9999 |
+----+----------+---------------+
1 row in set (0.00 sec)
root@localhost [test] > SELECT `foos`.* FROM `foos` WHERE `foos`.`start` = '2000-01-01 12:30:00' LIMIT 1;
Empty set (0.00 sec)
root@localhost [test] > SELECT `foos`.* FROM `foos` WHERE `foos`.`start` = '12:30:00' LIMIT 1;
+----+----------+---------------+
| id | start | finish |
+----+----------+---------------+
| 1 | 12:30:00 | 12:30:00.9999 |
+----+----------+---------------+
1 row in set (0.00 sec)
```
2016-04-14 14:22:16 +09:00
Jeremy Daer
128923ca14
Merge pull request #24522 from vipulnsward/run-mariadb-on-travis
...
Test against MariaDB 10.0
2016-04-13 22:18:54 -07:00
Vipul A M
bbb8f518b5
Include running mariadb on travis
...
- Specify we want to run on latest stable ruby for mariadb
- change in runs of builds
Make mariadb? method publicly available
2016-04-14 04:42:41 +05:30