X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fstorage%2Fmodel.py;h=7bb12aa1cf0a25ed1967b8607aab29a59b2097c3;hb=d210f49f112e71c866e79e6b62ae71c9ec0a3af1;hp=715ea671373bb1577230a56e35d45c0d2c4b0d42;hpb=d710b76d4d0c64f1cd16f5eb8857f8fbac1a9077;p=sfa.git diff --git a/sfa/storage/model.py b/sfa/storage/model.py index 715ea671..7bb12aa1 100644 --- a/sfa/storage/model.py +++ b/sfa/storage/model.py @@ -212,20 +212,16 @@ class RegNode (RegRecord): # although the db needs of course to be reachable, # the schema management functions are here and not in alchemy # because the actual details of the classes need to be known -def init_tables(dbsession): - logger.info("Initializing db schema and builtin types") - # the doc states we could retrieve the engine this way - # engine=dbsession.get_bind() - # however I'm getting this - # TypeError: get_bind() takes at least 2 arguments (1 given) - # so let's import alchemy - but not from toplevel - from sfa.storage.alchemy import engine +# migrations: this code has no notion of the previous versions +# of the data model nor of migrations +# sfa.storage.migrations.db_init uses this when starting from +# a fresh db only +def init_tables(engine): + logger.info("Initializing db schema from current/latest model") Base.metadata.create_all(engine) -def drop_tables(dbsession): - logger.info("Dropping tables") - # same as for init_tables - from sfa.storage.alchemy import engine +def drop_tables(engine): + logger.info("Dropping tables from current/latest model") Base.metadata.drop_all(engine) ##############################