Commit Graph

79 Commits

Author SHA1 Message Date
Sean Griffin
4bd5dffc85 Add a type object to Column constructor
Part of #15134. In order to perform typecasting polymorphically, we need
to add another argument to the constructor. The order was chosen to
match the `oid_type` on `PostgreSQLColumn`.
2014-05-17 17:16:05 -06:00
Akshay Vishnoi
91d7b6fc11 Test typecasting on instance rather than class itself 2014-05-03 09:17:36 +05:30
Rafael Mendonça França
372e28ce22 Merge pull request #13640 from maginatics/fix_sqlite3_ensure_master
SQLite3: Always close statements.

Conflicts:
	activerecord/CHANGELOG.md
2014-05-01 14:10:04 -03:00
Aaron Patterson
3321d1a2d1 working against arel/collector branch 2014-04-09 10:56:42 -07:00
Aaron Patterson
347d74a03b Merge branch 'master' into adequaterecord
* master: (122 commits)
  Rails.application should be set inside before_configuration hook
  remove check for present? from delete_all
  Remove useless begin..end
  Build the reverse_order on its proper method.
  Use connection-specific bytea escaping
  Ignore order when doing count.
  make enums distinct per class
  Remove unused `subclass_controller_with_flash_type_bar` var from flash test.
  fix CollectionProxy delete_all documentation
  Added OS X specific commands to installation guide [ci skip] Recommended using homebrew for installing MySQL and PostgreSQL
  Fix setup of adding _flash_types test.
  Use SVG version of travis build status badge [skip ci]
  W3C CSP document moved to gihub.io URL [ci skip]
  sprockets-rails was released
  Fix the test defining the models in the right place
  Add CHANGELOG entry for #11650 [ci skip]
  Declare the assets dependency
  Use sass-rails 4.0.3
  Make possible to use sprockets-rails 2.1
  add missing parentheses to validates_with documentation [skip ci]
  ...
2014-04-07 15:26:13 -07:00
Matthew Draper
f846828dae Revise 'sqlite3:' URL handling for smoother upgrades
Restore the 4.0 behaviour for 'sqlite3:///', but deprecate it. We'll
change to the absolute-path interpretation in 4.2.

The current "correct" spellings for in-memory, relative, and absolute
URLs, respectively, are:

    sqlite3::memory:
    sqlite3:relative/path
    sqlite3:/full/path

Substantially reverses/defers fbb79b517f3127ba620fedd01849f9628b78d6ce.
Uncovered by @guilleiguaran while investigating #14495, though that
sounds like a different issue.
2014-04-03 01:30:27 +10:30
Guo Xiang Tan
0264762fea Refactor test to use DdlHelper.
Follow-Up to https://github.com/rails/rails/pull/14400

This ensures that all tables are removed after each test and thereby
allowing us to run the tests in a random order.
2014-03-29 09:43:19 -07:00
Guo Xiang Tan
0212a41700 Fix tests not unsubscribing from Notifications.
See https://github.com/rails/rails/blob/master/activesupport/lib/active_support/notifications.rb#L131
2014-03-28 18:56:40 -07:00
Aaron Patterson
23ce2f61b5 Merge branch 'master' into adequaterecord
* master:
  Revert "Merge pull request #13344 from ccutrer/fix-from-default-select"
  No need to use symbols
  Don't skip tests if they are not broken. Just don't define they
  Fix typo [ci skip]
  Resolve encoding issues with arrays of hstore (bug 11135).
  Fix coffeescript sample [ci skip]
2014-02-17 13:42:42 -08:00
Aaron Patterson
fe42effb11 Merge branch 'master' into adequaterecord
* master: (311 commits)
  Add a missing changelog entry for #13981 and #14035
  Revert "Fixed plugin_generator test"
  implements new option :month_format_string for date select helpers [Closes #13618]
  add factory methods for empty alias trackers
  guarantee a list in the alias tracker so we can remove a conditional
  stop exposing table_joins
  make most parameters to the AliasTracker required
  make a singleton for AssociationScope
  pass the association and connection to the scope method
  pass the tracker down the stack and construct it in the scope method
  clean up add_constraints signature
  remove the reflection delegate
  remove klass delegator
  remove railties changes. fixes #14054
  remove chain delegate
  remove scope_chain delegate
  Add verb to sanitization note
  fix path shown in mailer's templates
  updated Travis build status image url
  fix guide active_support_core_extensions. add Note to String#indent [ci skip]
  ...

Conflicts:
	activerecord/lib/active_record/associations/join_dependency.rb
	activerecord/test/cases/associations/association_scope_test.rb
2014-02-17 11:21:18 -08:00
Rafael Mendonça França
141313c651 Don't skip tests if they are not broken. Just don't define they 2014-02-16 21:49:50 -03:00
Rajarshi Das
680f7d906e remove unused fixtures from sqlite3 test cases 2014-02-14 17:31:06 +05:30
Aaron Patterson
9c04b55e52 fixing explain tests for sqlite3 2014-01-17 11:14:50 -08:00
Timur Alperovich
6f16513b58 SQLite3: Always close statements.
SQLite3 adapter must make sure to close statements after queries.

Fixes: #13631
2014-01-15 10:35:21 -08:00
Aaron Patterson
ce95fb2991 "string" isn't a valid column type for ActiveRecord
Conflicts:
	activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
2014-01-14 14:01:10 -08:00
Aaron Patterson
40be2eaca9 drop the dual encodings table 2014-01-14 13:59:07 -08:00
Aaron Patterson
09035e622f Merge branch 'master' into set_binds
* master:
  don't establish a new connection when testing with `sqlite3_mem`.
  sqlite >= 3.8.0 supports partial indexes
  Don't try to get the subclass if the inheritance column doesn't exist
  Enum mappings are now exposed via class methods instead of constants.
  Fix fields_for documentation with index option [ci skip]
  quick pass through Active Record CHANGELOG. [ci skip]
  [ci skip] Grammar correction
  single quotes for controller generated routes
  [ci skip] Added alias to CSRF
  Set NameError#name
2014-01-14 11:43:57 -08:00
Yves Senn
b23330745b don't establish a new connection when testing with sqlite3_mem.
This fixes broken `rake test_sqlite3_mem` suite for Active Record.
The problem is that that the old database with the schema is lost
when establishing a new connection. Upon reconnting we are left
with a blank database and tests down the line start failing.
2014-01-14 18:03:31 +01:00
Aaron Patterson
11e8badb16 Merge branch 'master' into set_binds
* master: (2794 commits)
  doc, API example on how to use `Model#exists?` with multiple IDs. [ci skip]
  Restore DATABASE_URL even if it's nil in connection_handler test
  [ci skip] - error_messages_for has been deprecated since 2.3.8 - lets reduce any confusion for users
  Ensure Active Record connection consistency
  Revert "ask the fixture set for the sql statements"
  Check `respond_to` before delegation due to: d781caaf31
  Adding Hash#compact and Hash#compact! methods
  MySQL version 4.1 was EOL on December 31, 2009 We should at least recommend modern versions of MySQL to users.
  clear cache on body close so that cache remains during rendering
  add a more restricted codepath for templates fixes #13390
  refactor generator tests to use block form of Tempfile
  Fix typo [ci skip]
  Move finish_template as the last public method in the generator
  Minor typos fix [ci skip]
  make `change_column_null` reversible. Closes #13576.
  create/drop test and development databases only if RAILS_ENV is nil
  Revert "Speedup String#to"
  typo fix in test name. [ci skip].
  `core_ext/string/access.rb` test what we are documenting.
  Fix typo in image_tag documentation
  ...

Conflicts:
	activerecord/lib/active_record/associations/join_dependency/join_association.rb
	activerecord/lib/active_record/relation/query_methods.rb
2014-01-11 17:28:43 -08:00
schneems
f0311c2487 Raise NoDatabaseError when db does not exist
Building on the work of #13427 this PR adds a helpful error message to the adapters: mysql, mysql2, and sqlite3
2013-12-24 10:13:12 -05:00
Aaron Patterson
fbb79b517f fix url connections for sqlite3 2013-12-20 16:13:34 -08:00
Arthur Neves
4a720a2cde quoting: Check if id is a valid method before using it
Need to check if valud also respond_to :id before calling it, otherwise
things could explode.
2013-12-19 16:51:28 -05:00
Rafael Mendonça França
bd09afb5fb Don't skip tests if we don't need to.
We can conditional define the tests depending on the adapter or
connection.

Lets keep the skip for fail tests that need to be fixed.
2013-11-08 13:59:07 -02:00
Rashmi Yadav
90377f9674 Warning removed for ruby-head 2013-11-07 22:04:17 +01:00
Aaron Patterson
46c57ec4d9 stop adding singleton methods to the SQLite3 connection 2013-10-04 15:18:53 -07:00
schneems
f036239447 Create sqlite3 directory if not present
If the `db/` directory is not present on a remote machine it will blow up in unexpected ways with error messages that do not indicate there is a missing directory:

```
SQLite3::CantOpenException: unable to open database file
```

This PR checks to see if a directory exists for the sqlite3 file and if not creates it for you.

This PR is an alternative to #11692 as suggested by @josevalim
2013-08-05 12:10:52 -04:00
Antonio Santos
fb9806e5d2 Define enable_extension method to prevent undefined method error
When mixing postgresql and another adapter like sqlite3 (for dev and test
respectively), the task `db:test:prepare` will fail due to the `enable_extension`
method not being defined in the abstract adapter. This patch simply adds an
empty definition to prevent it.
2013-08-02 15:43:54 +02:00
Aaron Patterson
68a97e8118 Merge branch 'master' into experiment
* master: (49 commits)
  avoid creating a set if no where values are removed
  remove bind values for where clauses that were removed
  push partitioning up so bind elimination can get the removed wheres
  push partion logic down and initialization logic up
  the rake task `db:test:prepare` needs to load the configuration
  In batches test @total was assigned but not used. Use it in tests instead of Post.count
  partition the where values so we can access the removed ones
  eliminate some conditionals
  change method name to reflect what it actually does.
  save the where values in variables so we don't need to look them up all the time
  pass where values to the helper function rather than rely on internal state
  Spelling correction in Upgrading Guide
  Add has_named_route? to the mapper API
  No need CHANGELOG entry for a test fix
  Fix wrong `case_sensitive` in uniqueness validity test
  Fix typo in test name and documentation
  Missing ending ``` at 14.2 Merging of scopes
  copy edits[ci skip]
  Revert "Corrected documentation and added some more for the classify method in inflectors"
  Revert "Changed the CHANGELOG for active_support and improved the doc for inflector method classify"
  ...
2013-05-21 11:02:15 -07:00
Vipul A M
4237d74213 Fix typo in test name and documentation 2013-05-20 10:35:43 +05:30
Aaron Patterson
9933ab1b28 experiment 2013-05-17 15:14:22 -07:00
Vipul A M
4f5e8af993 each to each_value; remove unused vars 2013-04-07 19:59:07 +05:30
Ranjay Krishna
7c5e0035fa added comments to test_invalid_type in sqlite3 adapter test and added valid_type? method to abstract_adapter.rb and removed unnecessary method from sqlite3 adapter 2013-03-28 14:51:57 -04:00
Ranjay Krishna
c2e2031732 Created a layer of abstraction for the valid type checking in schema dumper. Now, connection handles the check for valid types so that each database can handle the changes individually. 2013-03-25 09:35:22 -07:00
Vipul A M
5b673f3d46 Fix copy table index test; Change == to ! on false in travis.rb 2013-03-21 10:57:52 +05:30
Matthew M. Boedicker
d3e5118e7d Pass column to quote when copying a sqlite table.
To make quote escape binary data correctly it needs the column passed in.
2013-03-11 23:14:46 -07:00
Jon Leighton
c65b076328 Revert "checking in the abstractions for valid type checking:"
This reverts commit c321b309a9a90bbfa0912832c11b3fef52e71840.

Conflicts:
	activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
	activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb

Reason: failing test

  1) Error:
test_valid_column(ActiveRecord::ConnectionAdapters::SQLite3AdapterTest):
NoMethodError: undefined method `column' for
    test/cases/adapters/sqlite3/sqlite3_adapter_test.rb:29:in
`test_valid_column'
2013-02-15 16:23:25 +00:00
Aaron Patterson
f8c8ad56c8 Merge pull request #9204 from ranjaykrishna/col-prob
schema dumper tests now conducted by ActiveRecord::Base.Connection
2013-02-12 13:26:40 -08:00
Ranjay Krishna
c321b309a9 checking in the abstractions for valid type checking: 2013-02-12 02:10:48 -05:00
Akira Matsuda
5f30b547c8 Use Encoding::UTF_8 constant 🚯 2013-01-28 17:06:02 +09:00
Carlos Antonio da Silva
4e23c0ef34 Remove not assigned variable warning from sqlite3 adapter test 2012-10-29 23:51:25 -02:00
Stefan Rusterholz
b5133d018f SQLite3Adapter#type_cast should not mutate arguments 2012-10-28 18:55:36 -05:00
Yves Senn
b104157314 refactor SQLite3Adapter#copy_table to prevent primary key redefinitions. #6378 2012-10-28 20:26:52 +01:00
dfens
ab9140ff02 Cleanup trailing whitespaces 2012-10-12 09:56:39 +02:00
Piotr Sarnacki
ceb68d1874 Revert "Merge pull request #6344"
This commit needs to be reverted because it introduces difficulties when
using sqlite3 in development and other databases in production. This
happens because when you create time column in sqlite3, it's dumped as
datetime in schema.rb file.

This reverts commit 57d534ee9e441d078fcc161c0c78ebaa5aacd736, reversing
changes made to 20f049fb50daee0c5e5a69b55b529af5737e8e3f.

Conflicts:

	activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
2012-06-25 02:27:26 +02:00
kennyj
576d7007dd Fix logs name consistency. 2012-05-19 04:53:12 +09:00
kennyj
6a48c7975e Fix warning: ambiguous first argument. 2012-05-18 00:51:38 +09:00
Piotr Sarnacki
4edb497676 Remove unneeded tests 2012-05-16 00:40:46 -07:00
Erich Menge
d9fc180fb4 SQLite3 doesn't actually support the 'time' type. 2012-05-15 22:05:00 -05:00
Sean Scally
3188f81199 Set the primary key during #copy_table if necessary. Fixes [#2312] 2012-05-14 14:47:25 -05:00
Andrey Deryabin
d42b60a411 fix tests for SQLite3Adapter 2012-04-27 13:31:37 +07:00