Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion common/persistence/sql/sql_domain_audit_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func (m *sqlDomainAuditStore) GetDomainAuditLogs(
DomainID: request.DomainID,
OperationType: request.OperationType,
MinCreatedTime: &minCreatedTime,
MaxCreatedTime: &maxCreatedTime,
PageSize: request.PageSize,
PageMaxCreatedTime: &pageMaxCreatedTime,
PageMinEventID: &pageMinEventID,
Expand Down
2 changes: 0 additions & 2 deletions common/persistence/sql/sql_domain_audit_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ func TestGetDomainAuditLogs(t *testing.T) {
DomainID: "d1111111-1111-1111-1111-111111111111",
OperationType: persistence.DomainAuditOperationTypeUpdate,
MinCreatedTime: &minTime,
MaxCreatedTime: &maxTime,
PageSize: pageSize,
PageMaxCreatedTime: &maxTime,
PageMinEventID: &maxUUID,
Expand Down Expand Up @@ -302,7 +301,6 @@ func TestGetDomainAuditLogs(t *testing.T) {
DomainID: "d1111111-1111-1111-1111-111111111111",
OperationType: persistence.DomainAuditOperationTypeUpdate,
MinCreatedTime: &minTime,
MaxCreatedTime: &maxTime,
PageSize: pageSize2,
PageMaxCreatedTime: &expectedCreatedTime,
PageMinEventID: &expectedEventID,
Expand Down
1 change: 0 additions & 1 deletion common/persistence/sql/sqlplugin/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ type (
DomainID string
OperationType persistence.DomainAuditOperationType
MinCreatedTime *time.Time
MaxCreatedTime *time.Time
PageSize int
// PageMaxCreatedTime and PageMinEventID are used to paginate Select queries
PageMaxCreatedTime *time.Time
Expand Down
11 changes: 5 additions & 6 deletions common/persistence/sql/sqlplugin/postgres/domain_audit_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ const (
event_id, domain_id, state_before, state_before_encoding, state_after, state_after_encoding,
operation_type, created_time, last_updated_time, identity, identity_type, comment
FROM domain_audit_log
WHERE domain_id = $1 AND operation_type = $2 AND created_time >= $3 AND created_time < $4
AND (created_time < $5 OR (created_time = $5 AND event_id > $6))
WHERE domain_id = $1 AND operation_type = $2 AND created_time >= $3
AND (created_time < $4 OR (created_time = $4 AND event_id > $5))
ORDER BY created_time DESC, event_id ASC
LIMIT $7`
LIMIT $6`
_selectAllDomainAuditLogsQuery = `SELECT
event_id, domain_id, state_before, state_before_encoding, state_after, state_after_encoding,
operation_type, created_time, last_updated_time, identity, identity_type, comment
FROM domain_audit_log
WHERE domain_id = $1 AND operation_type = $2 AND created_time >= $3 AND created_time < $4
AND (created_time < $5 OR (created_time = $5 AND event_id > $6))
WHERE domain_id = $1 AND operation_type = $2 AND created_time >= $3
AND (created_time < $4 OR (created_time = $4 AND event_id > $5))
ORDER BY created_time DESC, event_id ASC`
)

Expand Down Expand Up @@ -80,7 +80,6 @@ func (pdb *db) SelectFromDomainAuditLogs(
filter.DomainID,
filter.OperationType,
*filter.MinCreatedTime,
*filter.MaxCreatedTime,
*filter.PageMaxCreatedTime,
*filter.PageMinEventID,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
DomainID: domainID,
OperationType: operationType,
MinCreatedTime: &minTime,
MaxCreatedTime: &maxTime,
PageSize: 2,
PageMaxCreatedTime: &defaultPageMaxCreatedTime,
PageMinEventID: &defaultPageMinEventID,
Expand All @@ -182,7 +181,7 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
sqlplugin.DbDefaultShard,
gomock.Any(),
_selectDomainAuditLogsQuery,
domainID, operationType, minTime, maxTime, defaultPageMaxCreatedTime, defaultPageMinEventID, 2,
domainID, operationType, minTime, defaultPageMaxCreatedTime, defaultPageMinEventID, 2,
).DoAndReturn(func(ctx context.Context, shardID int, dest interface{}, query string, args ...interface{}) error {
rows := dest.(*[]*sqlplugin.DomainAuditLogRow)
*rows = []*sqlplugin.DomainAuditLogRow{
Expand Down Expand Up @@ -224,7 +223,6 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
DomainID: domainID,
OperationType: operationType,
MinCreatedTime: &minTime,
MaxCreatedTime: &maxTime,
PageSize: 0,
PageMaxCreatedTime: &createdTime2,
PageMinEventID: &eventID2,
Expand All @@ -235,7 +233,7 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
sqlplugin.DbDefaultShard,
gomock.Any(),
_selectAllDomainAuditLogsQuery,
domainID, operationType, minTime, maxTime, createdTime2, eventID2,
domainID, operationType, minTime, createdTime2, eventID2,
).DoAndReturn(func(ctx context.Context, shardID int, dest interface{}, query string, args ...interface{}) error {
rows := dest.(*[]*sqlplugin.DomainAuditLogRow)
*rows = []*sqlplugin.DomainAuditLogRow{
Expand Down Expand Up @@ -277,7 +275,6 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
DomainID: domainID,
OperationType: operationType,
MinCreatedTime: &minTime,
MaxCreatedTime: &maxTime,
PageMaxCreatedTime: &defaultPageMaxCreatedTime,
PageMinEventID: &defaultPageMinEventID,
},
Expand All @@ -287,7 +284,7 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
sqlplugin.DbDefaultShard,
gomock.Any(),
_selectAllDomainAuditLogsQuery,
domainID, operationType, minTime, maxTime, defaultPageMaxCreatedTime, defaultPageMinEventID,
domainID, operationType, minTime, defaultPageMaxCreatedTime, defaultPageMinEventID,
).DoAndReturn(func(ctx context.Context, shardID int, dest interface{}, query string, args ...interface{}) error {
return nil
})
Expand All @@ -301,7 +298,6 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
DomainID: domainID,
OperationType: operationType,
MinCreatedTime: &minTime,
MaxCreatedTime: &maxTime,
PageMaxCreatedTime: &defaultPageMaxCreatedTime,
PageMinEventID: &defaultPageMinEventID,
},
Expand All @@ -311,7 +307,7 @@ func TestSelectFromDomainAuditLogs(t *testing.T) {
sqlplugin.DbDefaultShard,
gomock.Any(),
_selectAllDomainAuditLogsQuery,
domainID, operationType, minTime, maxTime, defaultPageMaxCreatedTime, defaultPageMinEventID,
domainID, operationType, minTime, defaultPageMaxCreatedTime, defaultPageMinEventID,
).Return(errors.New("select failed"))
},
wantRows: nil,
Expand Down
Loading