1. 22 5月, 2018 1 次提交
    • Y
      Disable foreign keys during `alter_table` for sqlite3 adapter · 45881b0a
      Yasuo Honda 提交于
      Unlike other databases, changing SQLite3 table definitions need to create a temporary table.
      While changing table operations, the original table needs dropped which caused
      `SQLite3::ConstraintException: FOREIGN KEY constraint failed` if the table is referenced by foreign keys.
      This pull request disables foreign keys by `disable_referential_integrity`.
      
      Also `disable_referential_integrity` method needs to execute `defer_foreign_keys = ON`
      to defer re-enabling foreign keys until the transaction is committed.
      
      https://www.sqlite.org/pragma.html#pragma_defer_foreign_keys
      
      Fixes #31988
      
      - This `defer_foreign_keys = ON` has been supported since SQLite 3.8.0
      https://www.sqlite.org/releaselog/3_8_0.html and Rails 6 requires SQLite 3.8 #32923 now
      
      - <Models>.reset_column_information added to address `ActiveModel::UnknownAttributeError`
      
      ```
      Error:
      ActiveRecord::Migration::ForeignKeyChangeColumnTest#test_change_column_of_parent_table:
      ActiveModel::UnknownAttributeError: unknown attribute 'name' for ActiveRecord::Migration::ForeignKeyChangeColumnTest::Post.
      ```
      45881b0a
  2. 21 5月, 2018 4 次提交
  3. 20 5月, 2018 1 次提交
  4. 19 5月, 2018 6 次提交
  5. 18 5月, 2018 6 次提交
  6. 17 5月, 2018 10 次提交
  7. 16 5月, 2018 2 次提交
  8. 15 5月, 2018 3 次提交
  9. 14 5月, 2018 1 次提交
  10. 13 5月, 2018 6 次提交