File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 6666 CREATE TRIGGER tr_auditoria_are
6767 AFTER INSERT OR UPDATE OR DELETE ON avaliacao_registros_execucao
6868 FOR EACH ROW EXECUTE FUNCTION auditoria.fn_auditoria();
69+ """
70+
71+ REMOVE_AUDIT_TRIGGERS = """
72+ DROP TRIGGER IF EXISTS tr_auditoria_pt ON plano_trabalho;
73+ DROP TRIGGER IF EXISTS tr_auditoria_pe ON plano_entregas;
74+ DROP TRIGGER IF EXISTS tr_auditoria_part ON participante;
75+ DROP TRIGGER IF EXISTS tr_auditoria_us ON users;
76+ DROP TRIGGER IF EXISTS tr_auditoria_co ON contribuicao;
77+ DROP TRIGGER IF EXISTS tr_auditoria_en ON entrega;
78+ DROP TRIGGER IF EXISTS tr_auditoria_are ON avaliacao_registros_execucao;
6979"""
Original file line number Diff line number Diff line change 88from sqlalchemy .orm import DeclarativeBase
99from sqlalchemy .ext .asyncio import AsyncSession , async_sessionmaker , create_async_engine
1010from sqlalchemy .sql import text
11- from db_audit import AUDIT_DDL
11+ from db_audit import AUDIT_DDL , REMOVE_AUDIT_TRIGGERS
1212
1313SQLALCHEMY_DATABASE_URL = os .environ ["SQLALCHEMY_DATABASE_URL" ]
1414
@@ -35,6 +35,11 @@ async def create_audit_ddl():
3535 async with engine .begin () as conn :
3636 await conn .execute (text (AUDIT_DDL ))
3737
38+ async def remove_audit_triggers ():
39+
40+ async with engine .begin () as conn :
41+ await conn .execute (text (REMOVE_AUDIT_TRIGGERS ))
42+
3843
3944async def get_async_session () -> AsyncGenerator [AsyncSession , None ]:
4045 """Retorna a sessão do banco de dados.
You can’t perform that action at this time.
0 commit comments