Create a migration in the current or new revision folder

def _cmd_create(self):
        """Create a migration in the current or new revision folder
        """
        assert self._message, "need to supply a message for the \"create\" command"
        if not self._revisions:
            self._revisions.append("1")

        # get the migration folder
        rev_folder = self._revisions[-1]
        full_rev_path = os.path.join(self._migration_path, rev_folder)
        if not os.path.exists(full_rev_path):
            os.mkdir(full_rev_path)
        else:
            count = len(glob.glob(os.path.join(full_rev_path, "*")))
            # create next revision folder if needed
            if count and self._rev and int(self._rev) == 0:
                rev_folder = str(int(rev_folder) + 1)
                full_rev_path = os.path.join(self._migration_path, rev_folder)
                os.mkdir(full_rev_path)
                self._revisions.append(rev_folder)

        # format file name
        filename = '_'.join([s.lower() for s in self._message.split(' ') if s.strip()])
        for p in string.punctuation:
            if p in filename:
                filename = filename.replace(p, '_')
        filename = "%s_%s" % (datetime.utcnow().strftime("%Y%m%d%H%M%S"), filename.replace('__', '_'))

        # create the migration files
        self._log(0, "creating files: ")
        for s in ('up', 'down'):
            file_path = os.path.join(full_rev_path, "%s.%s.sql" % (filename, s))
            with open(file_path, 'a+') as w:
                w.write('\n'.join([
                    '-- *** %s ***' % s.upper(),
                    '-- file: %s' % os.path.join(rev_folder, filename),
                    '-- comment: %s' % self._message]))
                self._log(0, file_path)