Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cascades #92

Merged
merged 10 commits into from
Feb 2, 2021
Merged

Cascades #92

merged 10 commits into from
Feb 2, 2021

Conversation

collerek
Copy link
Owner

@collerek collerek commented Feb 2, 2021

Important

  • Braking Fix: Version 0.8.0 introduced a bug that prevents generation of foreign_keys constraint in the database,
    both in alembic and during creation through sqlalchemy.engine, this is fixed now.
  • THEREFORE IF YOU USE VERSION >=0.8.0 YOU ARE STRONGLY ADVISED TO UPDATE cause despite
    that most of the ormar functions are working your database CREATED with ormar (or ormar + alembic)
    does not have relations and suffer from perspective of performance and data integrity.
  • If you were using ormar to connect to existing database your performance and integrity
    should be fine nevertheless you should update to reflect all future schema updates in your models.

Breaking

  • Breaking: All foreign_keys and unique constraints now have a name so alembic
    can identify them in db and not depend on db
  • Breaking: During model construction if Meta class of the Model does not
    include metadata or database now ModelDefinitionError will be raised instead of generic AttributeError.
  • Breaking: encode/databases used for running the queries does not have a connection pool
    for sqlite backend, meaning that each querry is run with a new connection and there is no way to
    enable enforcing ForeignKeys constraints as those are by default turned off on every connection.
    This is changed in ormar since >=0.9.0 and by default each sqlite3 query has "PRAGMA foreign_keys=1;"
    run so now each sqlite3 connection by default enforces ForeignKey constraints including cascades.

Other

  • Update api docs.
  • Add tests for fk creation in db and for cascades in db

@codecov-io
Copy link

codecov-io commented Feb 2, 2021

Codecov Report

Merging #92 (42f58a6) into master (87abe95) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master       #92    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           95        97     +2     
  Lines         8074      8274   +200     
==========================================
+ Hits          8074      8274   +200     
Impacted Files Coverage Δ
ormar/models/model.py 100.00% <ø> (ø)
ormar/fields/base.py 100.00% <100.00%> (ø)
ormar/fields/foreign_key.py 100.00% <100.00%> (ø)
ormar/models/helpers/models.py 100.00% <100.00%> (ø)
ormar/models/helpers/sqlalchemy.py 100.00% <100.00%> (ø)
ormar/models/metaclass.py 100.00% <100.00%> (ø)
tests/test_cascades.py 100.00% <100.00%> (ø)
tests/test_database_fk_creation.py 100.00% <100.00%> (ø)
tests/test_model_definition.py 100.00% <100.00%> (ø)
... and 1 more

@collerek collerek merged commit a6166ed into master Feb 2, 2021
@collerek collerek deleted the cascades branch February 2, 2021 11:52
@collerek collerek mentioned this pull request Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants