Changed snowflakes from text to long lint

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2021-05-13 11:18:34 +02:00
parent b922d13b7f
commit fd74a955f0
5 changed files with 13 additions and 13 deletions

View File

@ -52,8 +52,8 @@ CREATE TABLE IF NOT EXISTS subtitles
id int GENERATED ALWAYS AS IDENTITY,
film_id int NOT NULL,
language_id int NOT NULL,
importer_id varchar(37),
importer_guild_id text,
importer_id bigint,
importer_guild_id bigint,
imported_date timestamptz NOT NULL DEFAULT now(),
UNIQUE (film_id, language_id),
PRIMARY KEY (id),

View File

@ -23,7 +23,7 @@ public class MoviesQuoteBot {
public static final String PREFIX = "!";
public static final String NAME = "Movies Quote Bot";
public static final String DESCRIPTION = "I may know quotes from movies.";
public static final String VERSION = "0.4-SNAPSHOT";
public static final String VERSION = "0.5";
public static final String KILL_SWITCH_FILE = "system_locked";
public static final String MAINTENANCE_MODE_FILE = "maintenance_mode_locked";
private static final Logger logger = LoggerFactory.getLogger(MoviesQuoteBot.class.getCanonicalName());

View File

@ -34,10 +34,10 @@ public class Version extends Command {
if (guild != null)
embedCreateSpec.addField("This guild imported",
SubtitleLineManager
.getNumberOfSubtitleLinesByGuild(guild.getId().asString()) +
.getNumberOfSubtitleLinesByGuild(guild.getId().asLong()) +
" subtitles lines, from " +
SubtitleManager
.getNumberOfSubtitlesByGuild(guild.getId().asString()) + " subtitles.",
.getNumberOfSubtitlesByGuild(guild.getId().asLong()) + " subtitles.",
true);
}
embedCreateSpec.addField("Version", MoviesQuoteBot.VERSION, true)

View File

@ -48,14 +48,14 @@ public final class SubtitleLineManager {
return -1;
}
public static int getNumberOfSubtitleLinesByGuild(String guild_id) {
public static int getNumberOfSubtitleLinesByGuild(long guild_id) {
logger.debug("Getting the number of subtitle lines in database from guild '{}'.", guild_id);
try (Connection connection = DBManager.getConnection()) {
String query = "SELECT COUNT(*) FROM subtitle_lines " +
"INNER JOIN subtitles ON subtitles.id = subtitle_lines.subtitle_id " +
"WHERE importer_guild_id = ?;";
try (PreparedStatement stmt = connection.prepareStatement(query)) {
stmt.setString(1, guild_id);
stmt.setLong(1, guild_id);
stmt.executeQuery();
stmt.getResultSet().next();
return (stmt.getResultSet().getInt(1));
@ -96,8 +96,8 @@ public final class SubtitleLineManager {
try (PreparedStatement stmt = connection.prepareStatement(querySubtitles, PreparedStatement.RETURN_GENERATED_KEYS)) {
stmt.setInt(1, movie.getId());
stmt.setInt(2, language.getId());
stmt.setString(3, importer == null ? null : importer.asString());
stmt.setString(4, importer_guild == null ? null : importer_guild.asString());
stmt.setLong(3, importer == null ? null : importer.asLong());
stmt.setLong(4, importer_guild == null ? null : importer_guild.asLong());
stmt.executeUpdate();
stmt.getGeneratedKeys().next();
subId = stmt.getGeneratedKeys().getInt(1);

View File

@ -74,13 +74,13 @@ public final class SubtitleManager {
return null;
}
public static int getNumberOfSubtitlesByGuild(String guild_id) {
public static int getNumberOfSubtitlesByGuild(long guild_id) {
logger.debug("Getting the number of subtitles in database from guild '{}'.", guild_id);
try (Connection connection = DBManager.getConnection()) {
String query = "SELECT COUNT(*) FROM subtitles " +
"WHERE importer_guild_id = ?;";
try (PreparedStatement stmt = connection.prepareStatement(query)) {
stmt.setString(1, guild_id);
stmt.setLong(1, guild_id);
stmt.executeQuery();
stmt.getResultSet().next();
return (stmt.getResultSet().getInt(1));
@ -122,8 +122,8 @@ public final class SubtitleManager {
id int GENERATED ALWAYS AS IDENTITY,
film_id int NOT NULL,
language_id int NOT NULL,
importer_id varchar(37),
importer_guild_id text,
importer_id bigint,
importer_guild_id bigint,
imported_date timestamptz NOT NULL DEFAULT now(),
UNIQUE (film_id, language_id),
PRIMARY KEY (id),