Skip to content

Commit 9f28fa1

Browse files
author
chedim
committed
dependabot, autobuilds and PR comments
1 parent cb0c7f4 commit 9f28fa1

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

.github/dependabot.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
open-pull-requests-limit: 5

.github/workflows/tests.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Tests
2+
on:
3+
push:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * 0"
7+
jobs:
8+
run_tests:
9+
name: Run Tests
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Set up JDK 17
14+
uses: actions/setup-java@v2
15+
with:
16+
java-version: 17
17+
distribution: 'adopt'
18+
cache: gradle
19+
- id: run
20+
run: |
21+
./gradlew --no-daemon test
22+
- name: Report Status
23+
if: always()
24+
uses: ravsamhq/notify-slack-action@v1
25+
with:
26+
status: ${{ job.status }}
27+
notify_when: 'failure'
28+
env:
29+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

src/main/java/trycb/config/DbSetupRunner.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,18 @@ public void run(String... args) {
6363
} catch (Exception e) {
6464
LOGGER.error("Failed to create primary index on collection {}", CouchbaseConfiguration.PROFILE_COLLECTION, e);
6565
}
66+
67+
try {
68+
// secondary index for querying profiles by fields
69+
final String query = "CREATE INDEX secondary_profile_index ON " + config.getBucketName() + "._default." + CouchbaseConfiguration.PROFILE_COLLECTION + "(firstName, lastName, address)";
70+
LOGGER.info("Creating secondary_profile_index: {}", query);
71+
cluster.query(query);
72+
Thread.sleep(1000);
73+
LOGGER.info("Created secondary index on collection {}", CouchbaseConfiguration.PROFILE_COLLECTION);
74+
} catch (IndexExistsException e) {
75+
LOGGER.info("Secondary index exists on collection {}", CouchbaseConfiguration.PROFILE_COLLECTION);
76+
} catch (Exception e) {
77+
LOGGER.error("Failed to create secondary index on collection {}", CouchbaseConfiguration.PROFILE_COLLECTION, e);
78+
}
6679
}
6780
}

src/main/java/trycb/model/Profile.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.UUID;
44

55
import org.springframework.data.annotation.Id;
6+
import org.springframework.data.couchbase.core.mapping.id.GeneratedValue;
67
import org.springframework.data.couchbase.repository.Collection;
78
import org.springframework.data.couchbase.repository.Scope;
89

0 commit comments

Comments
 (0)