Skip to content
Permalink
Browse files

Splitted apply_model_schema_on_table method (#138)

* Splitted apply_model_schema_on_table method into three more consistent parts regarding the different steps of migrating, loading slqlachemy events and reloading

* test to fix travis after pymssql was discontinued

* Updated Changelog
  • Loading branch information
AlexTorx authored and jssuzanne committed Nov 21, 2019
1 parent 25f09a7 commit e73caa14c2b3f6c3b5f7502b81756d3dfc64153e
Showing with 19 additions and 5 deletions.
  1. +2 −2 .travis.yml
  2. +10 −3 anyblok/registry.py
  3. +7 −0 doc/CHANGES.rst
@@ -25,7 +25,7 @@ env:
ANYBLOK_DATABASE_USER=sa \
ANYBLOK_DATABASE_PASSWORD=AnyBl@k2019 \
SQLSERVER='docker exec mssql /opt/mssql-tools/bin/sqlcmd -U sa -P AnyBl@k2019 -Q' \
SQLPYCLIENT='pymssql' \
SQLPYCLIENT='pymssql<3.0' \
MARKERS='field or column or relationship'
- |-
ANYBLOK_DATABASE_HOST=localhost \
@@ -34,7 +34,7 @@ env:
ANYBLOK_DATABASE_USER=sa \
ANYBLOK_DATABASE_PASSWORD=AnyBl@k2019 \
SQLSERVER='docker exec mssql /opt/mssql-tools/bin/sqlcmd -U sa -P AnyBl@k2019 -Q' \
SQLPYCLIENT='pymssql' \
SQLPYCLIENT='pymssql<3.0' \
MARKERS='not field and not column and not relationship'
matrix:
@@ -952,8 +952,9 @@ def load(self):
self.assemble_entries()
self.create_session_factory()

mustreload = self.apply_model_schema_on_table(
blok2install) or mustreload
self.apply_model_schema_on_table(blok2install)
self.listen_sqlalchemy_known_event()
mustreload = self.is_reload_needed() or mustreload

except Exception as e:
self.close()
@@ -1043,7 +1044,13 @@ def apply_model_schema_on_table(self, blok2install):
else:
self.migration.auto_upgrade_database()

self.listen_sqlalchemy_known_event()
def is_reload_needed(self):

"""Determines whether a reload is needed or not."""

if self.loadwithoutmigration:
return

mustreload = False
for entry in RegistryManager.declared_entries:
if entry in RegistryManager.callback_initialize_entries:
@@ -15,6 +15,13 @@
CHANGELOG
=========

1.0.1 (Unreleased)
------------------

* Bug Fix on registry loading sequence. The **apply_model_schema_on_table**
method called at registry initialisation has been splitted to make sqlalchemy
ORM events registration independent from migration.

1.0.0
-----

0 comments on commit e73caa1

Please sign in to comment.
You can’t perform that action at this time.