import os

from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

from api import create_app, db

application = create_app(os.getenv('FLASK_CONFIG') or 'default')

migrate = Migrate(application, db)

manager = Manager(application)
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest

    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


@manager.command
def recreate_db():
    """
    Recreates a local database. Drops and creates a new database
    """
    db.drop_all()
    db.create_all()
    db.session.commit()

if __name__ == "__main__":
    manager.run()

import os

from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

from api import create_app, db

application = create_app(os.getenv('FLASK_CONFIG') or 'default')

migrate = Migrate(application, db)

manager = Manager(application)
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest

    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


@manager.command
def recreate_db():
    """
    Recreates a local database. Drops and creates a new database
    """
    db.drop_all()
    db.create_all()
    db.session.commit()

@manager.command
def create_db():
    db.create_all()
    db.session.commit()

@manager.command
def drop_db():
    db.drop_all()
    db.session.commit()


if __name__ == "__main__":
    manager.run()

Add create and drop db tasks
Add create and drop db tasks

  import os
  
  from flask_script import Manager
  from flask_migrate import Migrate, MigrateCommand
  
  from api import create_app, db
  
  application = create_app(os.getenv('FLASK_CONFIG') or 'default')
  
  migrate = Migrate(application, db)
  
  manager = Manager(application)
  manager.add_command('db', MigrateCommand)
  
  
  @manager.command
  def test():
      """Run the unit tests."""
      import unittest
  
      tests = unittest.TestLoader().discover('tests')
      unittest.TextTestRunner(verbosity=2).run(tests)
  
  
  @manager.command
  def recreate_db():
      """
      Recreates a local database. Drops and creates a new database
      """
      db.drop_all()
      db.create_all()
      db.session.commit()
  
+ @manager.command
+ def create_db():
+     db.create_all()
+     db.session.commit()
+ 
+ @manager.command
+ def drop_db():
+     db.drop_all()
+     db.session.commit()
+ 
+ 
  if __name__ == "__main__":
      manager.run()
  
Add create and drop db tasks
## Code Before:
import os

from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

from api import create_app, db

application = create_app(os.getenv('FLASK_CONFIG') or 'default')

migrate = Migrate(application, db)

manager = Manager(application)
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest

    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


@manager.command
def recreate_db():
    """
    Recreates a local database. Drops and creates a new database
    """
    db.drop_all()
    db.create_all()
    db.session.commit()

if __name__ == "__main__":
    manager.run()

## Instruction:
Add create and drop db tasks
## Code After:
import os

from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

from api import create_app, db

application = create_app(os.getenv('FLASK_CONFIG') or 'default')

migrate = Migrate(application, db)

manager = Manager(application)
manager.add_command('db', MigrateCommand)


@manager.command
def test():
    """Run the unit tests."""
    import unittest

    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


@manager.command
def recreate_db():
    """
    Recreates a local database. Drops and creates a new database
    """
    db.drop_all()
    db.create_all()
    db.session.commit()

@manager.command
def create_db():
    db.create_all()
    db.session.commit()

@manager.command
def drop_db():
    db.drop_all()
    db.session.commit()


if __name__ == "__main__":
    manager.run()
