Add `arrived` attribute (file creation timestamp) to books table.
[quanlib.git] / store.rb
index f1b7fba68400465c102db20ba886e60c77d96207..1a33ca3868340e0cadf9f770d0e1517a3a57711d 100644 (file)
--- a/store.rb
+++ b/store.rb
@@ -71,6 +71,7 @@ EOS
 <<EOS
       CREATE TABLE Books (
         id             INTEGER PRIMARY KEY,
+        arrived        TIMESTAMP,
         author         INTEGER REFERENCES Authors(id),
         classification INTEGER REFERENCES Classifications(id),
         cover          INTEGER,
@@ -321,14 +322,14 @@ EOS
   end
 
   def store_book(book)
-    sql = "INSERT INTO Books (id, author, classification, cover, description, language, path, series, title, volume) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);"
+    sql = "INSERT INTO Books (id, arrived, author, classification, cover, description, language, path, series, title, volume) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);"
 
     book_id = next_id('book_id')
 
     author_id = store_author(book.author)
     (efs_id, mime_type) = store_cover(book)
 
-    args = [book_id, author_id, book.classification_id, efs_id, book.description, book.language, book.path, book.series_id, book.title, book.volume]
+    args = [book_id, book.arrived, author_id, book.classification_id, efs_id, book.description, book.language, book.path, book.series_id, book.title, book.volume]
 
     begin
       rs = @conn.exec_params(sql, args)