aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src/main/resources/org/sonar/db/webhook/WebhookDeliveryMapper.xml
blob: ac90c3210450a500e193bdba29dd6b45b3e5822e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.sonar.db.webhook.WebhookDeliveryMapper">

  <select id="selectByUuid" parameterType="String" resultType="org.sonar.db.webhook.WebhookDeliveryDto">
    select
    uuid,
    component_uuid as componentUuid,
    ce_task_uuid as ceTaskUuid,
    name,
    url,
    success,
    http_status as httpStatus,
    duration_ms as durationMs,
    payload,
    error_stacktrace as errorStacktrace,
    created_at as createdAt
    from webhook_deliveries
    where uuid = #{uuid,jdbcType=VARCHAR}
  </select>

  <insert id="insert" parameterType="org.sonar.db.webhook.WebhookDeliveryDto" useGeneratedKeys="false">
    insert into webhook_deliveries (
    uuid,
    component_uuid,
    ce_task_uuid,
    name,
    url,
    success,
    http_status,
    duration_ms,
    payload,
    error_stacktrace,
    created_at
    ) values (
    #{uuid,jdbcType=VARCHAR},
    #{componentUuid,jdbcType=VARCHAR},
    #{ceTaskUuid,jdbcType=VARCHAR},
    #{name,jdbcType=VARCHAR},
    #{url,jdbcType=VARCHAR},
    #{success,jdbcType=BOOLEAN},
    #{httpStatus,jdbcType=INTEGER},
    #{durationMs,jdbcType=INTEGER},
    #{payload,jdbcType=VARCHAR},
    #{errorStacktrace,jdbcType=VARCHAR},
    #{createdAt,jdbcType=TIMESTAMP}
    )
  </insert>

  <delete id="deleteComponentBeforeDate" parameterType="map">
    delete from webhook_deliveries
    where
    component_uuid = #{componentUuid,jdbcType=VARCHAR} and
    created_at &lt; #{beforeDate,jdbcType=BIGINT}
  </delete>
</mapper>