diff options
| author | Omar Roth <omarroth@hotmail.com> | 2019-04-10 17:16:18 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2019-04-10 17:16:18 -0500 |
| commit | 28d5bedcc7376b3749eb62a77decbb46c131dcd2 (patch) | |
| tree | 7e90e3efe860d05d3aea36bdb42cee2a0a867def | |
| parent | 373b890e1d0470ac222a5b8fc388e9ffe2350ca4 (diff) | |
| download | invidious-28d5bedcc7376b3749eb62a77decbb46c131dcd2.tar.gz invidious-28d5bedcc7376b3749eb62a77decbb46c131dcd2.tar.bz2 invidious-28d5bedcc7376b3749eb62a77decbb46c131dcd2.zip | |
Speed up table creation
| -rw-r--r-- | src/invidious/helpers/helpers.cr | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 3c75e7a7..bf96842f 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -501,7 +501,9 @@ end def analyze_table(db, logger, table_name, struct_type = nil) # Create table if it doesn't exist - if !db.query_one?("SELECT true FROM information_schema.tables WHERE table_name = $1", table_name, as: Bool) + begin + db.exec("SELECT * FROM #{table_name} LIMIT 0") + rescue ex logger.write("CREATE TABLE #{table_name}\n") db.using_connection do |conn| |
