Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate stats columns from show to show_stats #1228

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Creating a new show should also create a show_stats entry
A show_stats row needs to be created and deleted together with a show row.
This bug was introduced on https://gitlab.spimageworks.com/spi/dev/infrastructure/api/opencue/-/merge_requests/427
  • Loading branch information
DiegoTavares committed Jan 26, 2023
commit 8090c49adad35a603a5d1e6a3e32ba1662e5af34
Original file line number Diff line number Diff line change
@@ -138,9 +138,15 @@ public ShowEntity getShowDetail(HostInterface host) {
private static final String INSERT_SHOW =
"INSERT INTO show (pk_show,str_name) VALUES (?,?)";

private static final String INSERT_SHOW_STATS =
"INSERT INTO show_stats " +
"(pk_show, int_frame_insert_count, int_job_insert_count, int_frame_success_count, int_frame_fail_count) " +
"VALUES (?, 0, 0, 0, 0)";

public void insertShow(ShowEntity show) {
show.id = SqlUtil.genKeyRandom();
getJdbcTemplate().update(INSERT_SHOW, show.id, show.name);
getJdbcTemplate().update(INSERT_SHOW_STATS, show.id);
}

private static final String SHOW_EXISTS =
@@ -169,6 +175,8 @@ public void delete(ShowInterface s) {
s.getShowId());
getJdbcTemplate().update("DELETE FROM show_alias WHERE pk_show=?",
s.getShowId());
getJdbcTemplate().update("DELETE FROM show_stats WHERE pk_show=?",
s.getShowId());
getJdbcTemplate().update("DELETE FROM show WHERE pk_show=?",
s.getShowId());
}
Original file line number Diff line number Diff line change
@@ -2082,7 +2082,7 @@ public Show mapRow(ResultSet rs, int rowNum) throws SQLException {
"COALESCE(vs_show_stat.int_job_count,0) AS int_job_count " +
"FROM " +
"show " +
"LEFT JOIN show_stats ON (show.pk_show = show_stats.pk_show) " +
"JOIN show_stats ON (show.pk_show = show_stats.pk_show) " +
DiegoTavares marked this conversation as resolved.
Show resolved Hide resolved
"LEFT JOIN vs_show_stat ON (vs_show_stat.pk_show = show.pk_show) " +
"LEFT JOIN vs_show_resource ON (vs_show_resource.pk_show=show.pk_show) " +
"WHERE " +