Enum creation doesn't respect metadata schema setting

Issue #3819 resolved
Tom Cook created an issue

Sample code:

from sqlalchemy import create_engine, Column, Enum, Integer, event
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.schema import DDL

db = declarative_base()
db.metadata.schema = 'test'

engine = create_engine('postgresql://tkcook:tkcook@localhost/tkcook')

import enum

event.listen(db.metadata, 'before_create', DDL('create schema if not exists test'))

class Phase(enum.Enum):
    one = 'one'
    two = 'two'

class Test(db):
    __tablename__ = 'test_t'
    id = Column(Integer, primary_key=True)
    phase = Column(Enum(Phase, name='phase'))

db.metadata.create_all(engine)

t = Test(id = 1, phase = Phase.one)
session = sessionmaker(bind=engine)()
session.add(t)
session.commit()

Expected result: Schema test contains a table called test_t and a type called phase.

Actual result: Schema test contains a table called test_t but the type phase is created in schema public.