text: # flake8: noqa
  from sqlalchemy_declarative.role import Role, Roles
  from sqlalchemy_declarative.schema import Schema, Schemas
  
  
  def declarative_database(cls):
      from sqlalchemy_declarative.compat import alembic
      from sqlalchemy_declarative.sqlalchemy import listen
  
      cls.metadata.info["roles"] = getattr(cls, "roles", Roles())
      cls.metadata.info["schemas"] = getattr(cls, "schemas", Schemas())
  
      listen(cls.metadata)
  
      if alembic:
          enable_alembic_autogenerate()
  
      return cls
  
  
  def enable_alembic_autogenerate():
      import sqlalchemy_declarative.role.alembic
      import sqlalchemy_declarative.schema.alembic
  