@staticmethod
    def create(migration_name, migration_dir='.', script_encoding='utf-8', utc_timestamp = False):
        timestamp = strftime("%Y%m%d%H%M%S", gmtime() if utc_timestamp else localtime())
        file_name = "%s_%s%s" % (timestamp, migration_name, Migration.MIGRATION_FILES_EXTENSION)

        if not Migration.is_file_name_valid(file_name):
            raise Exception("invalid migration name ('%s'); it should contain only letters, numbers and/or underscores" % migration_name)

        new_file_name = "%s/%s" % (migration_dir, file_name)

        try:
            f = codecs.open(new_file_name, "w", script_encoding)
            f.write(Migration.TEMPLATE % (script_encoding))
            f.close()
        except __HOLE__:
            raise Exception("could not create file ('%s')" % new_file_name)

        return new_file_name
dataset/ETHPy150Open guilhermechapiewski/simple-db-migrate/simple_db_migrate/core/__init__.py/Migration.create