1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

13 commits

Author SHA1 Message Date
Abdelkader Boudih
fb24d0ed6c Remove legacy mysql adapter 2015-12-17 15:54:57 +00:00
yui-knk
7429633b82 Deprecate #table_exists?, #tables and passing arguments to #talbes
Reported on #21509, how views is treated by `#tables` are differ
by each adapters. To fix this different behavior, after Rails 5.0
is released, deprecate `#tables`.

And `#table_exists?` would check both tables and views.
To make their behavior consistent with `#tables`, after Rails 5.0
is released, deprecate `#table_exists?`.
2015-11-09 23:13:23 +09:00
Yves Senn
152b85f06c introduce conn.data_source_exists? and conn.data_sources.
These new methods are used from the Active Record model layer to
determine which relations are viable to back a model. These new methods
allow us to change `conn.tables` in the future to only return tables and
no views. Same for `conn.table_exists?`.

The goal is to provide the following introspection methods on the
connection:

* `tables`
* `table_exists?`
* `views`
* `view_exists?`
* `data_sources` (views + tables)
* `data_source_exists?` (views + tables)
2015-09-22 19:48:44 +02:00
Ryuta Kamizono
ad4654f275 Do not dump a view as a table in sqlite3, mysql and mysql2 adapters
Now in sqlite3, mysql and mysql2 adapters, SchemaDumper dump a view as
a table. It is incorrect behavior. This change excludes a view in
schema.rb.
2015-09-13 21:02:52 +09:00
Ryuta Kamizono
dcd39949f8 Add #views and #view_exists? methods on connection adapters 2015-09-13 21:02:43 +09:00
yui-knk
bb0d70788a Add view tests for MySQL
Basically view tests for MySQL are same with
`test/cases/adapters/postgresql/view_test.rb`.

So move `test/cases/adapters/postgresql/view_test.rb` to
`test/cases/view_test.rb` and make them only run if
`current_adapter` supports writable view.
2015-09-08 20:09:41 +09:00
George Claghorn
908cfef6e2 Resolve enums in test fixtures
Currently, values for columns backing Active Record enums must be
specified as integers in test fixtures:

    awdr:
      title: "Agile Web Development with Rails"
      status: 2

    rfr:
      title: "Ruby for Rails"
      status: <%= Book.statuses[:proposed] %>

This is potentially confusing, since enum values are typically
specified as symbols or strings in application code. To resolve the
confusion, this change permits the use of symbols or strings to specify
enum values:

    awdr:
      status: :published

It is compatible with fixtures that specify enum values as integers.
2015-05-27 21:48:58 -04:00
Yves Senn
395573b344 reuse view test-cases for pg materialized view tests. 2014-09-11 16:47:52 +02:00
Yves Senn
e6001cbac6 Oracle does not support IF EXISTS for DROP VIEW.
/cc @yahonda
2014-09-09 15:33:23 +02:00
Yves Senn
fde0d0219d models backed by views don't assume "id" columns are the primary key.
Closes #10247.

The same goes for tables with an "id" column but without primary key constraint.
Reading from the view works without configuration. If you have an updateable view
you need to use `self.primary_key = ''`.
2014-09-09 15:17:46 +02:00
Yves Senn
ec6eee5db0 add test-cases for primary-key-less-views. Closes #16555. 2014-09-09 12:00:01 +02:00
Yves Senn
d2069d60ae Merge pull request #14056 from girishso/14041
SQLite3Adapter now checks for views in table_exists? fixes: 14041

Conflicts:
	activerecord/CHANGELOG.md
2014-09-09 11:35:17 +02:00
Yves Senn
ae9412e857 introduce connection.supports_views? and basic view tests.
`AbstractAdapter#supports_views?` defaults to `false` so we have to turn it on
in adapter subclasses. Currently the flag only controls test execution.

/cc @yahonda
2014-09-09 11:26:30 +02:00