Skip to content

Commit

Permalink
fix: constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Oct 4, 2024
1 parent 020000f commit 296c582
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public static String getQueryToCreateOAuthM2MTokensTable(Start start) {
+ "iat BIGINT NOT NULL,"
+ "exp BIGINT NOT NULL,"
+ "PRIMARY KEY (app_id, client_id, iat),"
+ "FOREIGN KEY(app_id)"
+ " REFERENCES " + Config.getConfig(start).getAppsTable() + "(app_id) ON DELETE CASCADE"
+ "FOREIGN KEY(app_id, client_id)"
+ " REFERENCES " + Config.getConfig(start).getOAuthClientsTable() + "(app_id, client_id) ON DELETE CASCADE"
+ ");";
// @formatter:on
}
Expand Down Expand Up @@ -283,7 +283,7 @@ public static int countTotalNumberOfOAuthM2MTokensCreatedSince(Start start, AppI
public static void addOAuthM2MTokenForStats(Start start, AppIdentifier appIdentifier, String clientId, long iat, long exp)
throws SQLException, StorageQueryException {
String QUERY = "INSERT INTO " + Config.getConfig(start).getOAuthM2MTokensTable() +
" (app_id, client_id, iat, exp) VALUES (?, ?, ?, ?)";
" (app_id, client_id, iat, exp) VALUES (?, ?, ?, ?) ON CONFLICT DO NOTHING";
update(start, QUERY, pst -> {
pst.setString(1, appIdentifier.getAppId());
pst.setString(2, clientId);
Expand Down

0 comments on commit 296c582

Please sign in to comment.