code: def migrate(record, dry_run=False):
      '''Perform database migrations'''
      handler = record_migration if record else execute_migration
      success = True
      for plugin, package, filename in available_migrations():
          migration = get_migration(plugin, filename)
          if migration or not success:
              log_status(plugin, filename, cyan('Skipped'))
          else:
              status = magenta('Recorded') if record else yellow('Apply')
              log_status(plugin, filename, status)
              script = resource_string(package, join('migrations', filename))
              success &= handler(plugin, filename, script, dryrun=dry_runf migrate(record, dry_run=False):
      '''Perform database migrations'''
      handler = record_migration if record else execute_migration
      success = True
      for plugin, package, filename in available_migrations():
          migration = get_migration(plugin, filename)
          if migration or not success:
              log_status(plugin, filename, cyan('Skipped'))
          else:
              status = magenta('Recorded') if record else yellow('Apply')
              log_status(plugin, filename, status)
              script = resource_string(package, join('migrations', filename))
              success &= handler(plugin, filename, script, dryrun=dry_run)
docs: Perform database migrations