Added init_tables method to MigrationManager
This commit is contained in:
parent
3635ccdf34
commit
8bf3f63af1
@ -121,8 +121,16 @@ class MigrationManager(object):
|
|||||||
|
|
||||||
|
|
||||||
def init_tables(self):
|
def init_tables(self):
|
||||||
## TODO
|
"""
|
||||||
pass
|
Create all tables relative to this package
|
||||||
|
"""
|
||||||
|
# sanity check before we proceed, none of these should be created
|
||||||
|
for model in self.models:
|
||||||
|
assert not model.__table__.exists(self.database)
|
||||||
|
|
||||||
|
self.migration_model.metadata.create_all(
|
||||||
|
self.database,
|
||||||
|
tables=[model.__table__ for model in self.models])
|
||||||
|
|
||||||
def create_new_migration_record(self):
|
def create_new_migration_record(self):
|
||||||
## TODO
|
## TODO
|
||||||
@ -163,6 +171,8 @@ class MigrationManager(object):
|
|||||||
Returns information about whether or not we initialized
|
Returns information about whether or not we initialized
|
||||||
('inited'), migrated ('migrated'), or did nothing (None)
|
('inited'), migrated ('migrated'), or did nothing (None)
|
||||||
"""
|
"""
|
||||||
|
assure_migrations_table_setup(self.database)
|
||||||
|
|
||||||
# Find out what migration number, if any, this database data is at,
|
# Find out what migration number, if any, this database data is at,
|
||||||
# and what the latest is.
|
# and what the latest is.
|
||||||
migration_number = self.database_current_migration()
|
migration_number = self.database_current_migration()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user