| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's finally finished!!!!!!! The reason the Attributes API was kept
private in 4.2 was due to some publicly visible implementation details.
It was previously implemented by overloading `columns` and
`columns_hash`, to make them return column objects which were modified
with the attribute information.
This meant that those methods LIED! We didn't change the database
schema. We changed the attribute information on the class. That is
wrong! It should be the other way around, where schema loading just
calls the attributes API for you. And now it does!
Yes, this means that there is nothing that happens in automatic schema
loading that you couldn't manually do yourself. (There's still some
funky cases where we hit the connection adapter that I need to handle,
before we can turn off automatic schema detection entirely.)
There were a few weird test failures caused by this that had to be
fixed. The main source came from the fact that the attribute methods are
now defined in terms of `attribute_names`, which has a clause like
`return [] unless table_exists?`. I don't *think* this is an issue,
since the only place this caused failures were in a fake adapter which
didn't override `table_exists?`.
Additionally, there were a few cases where tests were failing because a
migration was run, but the model was not reloaded. I'm not sure why
these started failing from this change, I might need to clear an
additional cache in `reload_schema_from_cache`. Again, since this is not
normal usage, and it's expected that `reset_column_information` will be
called after the table is modified, I don't think it's a problem.
Still, test failures that were unrelated to the change are worrying, and
I need to dig into them further.
Finally, I spent a lot of time debugging issues with the mutex used in
`define_attribute_methods`. I think we can just remove that method
entirely, and define the attribute methods *manually* in the call to
`define_attribute`, which would simplify the code *tremendously*.
Ok. now to make this damn thing public, and work on moving it up to
Active Model.
|
| |
|
| |
|
|
|
|
| |
`silence_stderr`, `silence_stream`, `capture` and `quietly`.
|
|
|
|
|
| |
`Computer` class needs to be require
See #17217 for more details
|
|
|
|
| |
Fixes #17170
|
|
|
|
|
|
|
|
|
|
|
| |
Sufficiently large integers cause `find` and `find_by` to raise
`StatementInvalid` instead of `RecordNotFound` or just returning `nil`.
Given that we can't cast to `nil` for `Integer` like we would with junk
data for other types, we raise a `RangeError` instead, and rescue in
places where it would be highly unexpected to get an exception from
casting.
Fixes #17380
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
Correctly determine if migration is needed.
|
| |
| |
| |
| |
| |
| |
| | |
This method would assume that if last migration in the migrations
directory matched the current schema version, that the database was up
to date, but this does not account for new migrations with older
timestamps that may be pending.
|
|/
|
|
|
|
|
| |
As per discussion, this changes the model generators to specify
`null: false` for timestamp columns. A warning is now emitted if
`timestamps` is called without a `null` option specified, so we can
safely change the behavior when no option is specified in Rails 5.
|
|
|
|
|
|
|
|
|
|
|
| |
The fixtures are still in play, adding a new column without a default and `null: true`
is not possible. This reverts back to leaking global state, as our `schema.rb` adds
the `null: false` constraint on this field.
A future solution would be to make the `migration_test.rb` run independent of fixture tables.
This way we can simply drop the state after test execution, without worrying about side effects.
/cc @zuhao
|
| |
|
| |
|
|
|
|
|
|
|
| |
If we want to have type decorators mess with the attribute, but not the
column, we need to stop type casting on the column. Where possible, we
changed the tests to test the value of `column_defaults`, which is
public API. `Column#default` is not.
|
|
|
|
| |
For consistency with https://github.com/rails/rails/pull/15557
|
| |
|
|
|
|
| |
Missed a case that only occured for mysql/mysql2
|
|
|
|
|
|
| |
With ActiveRecord::Properties, we now have a reasonable path for users
to continue to keep this behavior if they want it. This is an edge case
that has added a lot of complexity to the code base.
|
|
|
|
|
|
|
|
| |
Follow-Up to https://github.com/rails/rails/pull/14348
Ensure that SQLCounter.clear_log is called after each test.
This is a step to prevent side effects when running tests. This will allow us to run them in random order.
|
| |
|
|
|
|
|
|
|
|
| |
This makes the tests inside `migration_test.rb` order independent.
The assignments to `Reminder.table_name_prefix` and `Reminder.table_name_suffix`
previously leaked and had impact on following test cases.
This patch isolates the assignments on a throw-away subclass.
|
| |
|
|
|
|
|
| |
also override drop_table in AbstractMySQLAdapter to properly drop
temporary tables without committing the transaction
|
|
|
|
|
| |
We can now make use of the existent #travel/#travel_to helper methods
added to AS test case and available in all tests.
|
| |
|
| |
|
|
|
|
|
|
|
| |
We can conditional define the tests depending on the adapter or
connection.
Lets keep the skip for fail tests that need to be fixed.
|
|
|
| |
Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
name of the schema migrations table can be configured.
consolidated test_schema_migrations_table_name tests
Added changelog entry
edited changelog
removed commented lines
removed reader
ensure the schema migrations table is reset at end of test
added entry to configuration guide
guides typo and changelog order
|
|
|
|
| |
This prevents deprecation warnings from popping up.
|
|
|
|
|
|
|
|
|
|
|
| |
The options will specify the prefix and the suffix. Also, I'm moving the
method to be an instance method on the +Migration+ instance. This makes more
sense than being a class method on the +Migrator+ class because the only
place that uses it is on a +Migration+ instance (in a method_missing
hook). The logic for the Migrator shouldn't be doing any work to
calculate the table name, it should be the Migration itself.
Also made some small indentation fixes.
|
|
|
|
|
|
| |
This reverts commit 10259c3e906da2191ef0d43cd664a3b5504d9f8c.
reason: this causes rake test_mysql and test_mysql2 fail
|
|
|
|
|
|
| |
If the order in which tests are executed is changed then test fails.
This commit ensures that all migrations are run before ensuring that
there are no pending migration.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
During insertion of "# This migration comes from ... " comment at the beginning of
a migration, presence of magic comment was not considered.
|
|
|
|
| |
schema_statements uses the column name by default to construct the index name, and then raises an exception if it doesn't exist, even if the name option is specified, which causes #8858. this commit makes index_name_for_remove fall back to constructing the index name to remove based on the name option.
|
|
|
|
|
|
|
|
|
|
|
| |
Closes #9483.
There are SQL Queries that can't run inside a transaction. Since
the Migrator used to wrap all Migrations inside a transaction there
was no way to run these queries within a migration.
This patch adds `self.disable_ddl_transaction!` to the migration to
turn transactions off when necessary.
|
|
|
|
|
|
| |
The cleanup commit a85625d broke the test-case.
The schema was no longer modified so there was no
way to check that the rollback actually happened.
|
| |
|
|
|
|
| |
because some tests were not resetting them, and thus the tests were order dependent
|
| |
|
| |
|