From 84c95ae5cb3142a80951b9255d5009f9958a80f0 Mon Sep 17 00:00:00 2001
From: Alexandre Morignot <erdnaxeli@gmail.com>
Date: Sat, 16 Aug 2014 21:40:16 +0200
Subject: [PATCH] Data structure modifications

The date and the sender_irc are attached to the channel, not the
content.
---
 lib/sites/parser.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/sites/parser.pm b/lib/sites/parser.pm
index 9a8261b..f0f8466 100644
--- a/lib/sites/parser.pm
+++ b/lib/sites/parser.pm
@@ -62,11 +62,11 @@ sub parse {
 	    else {
 		    # insertion de la vidéo dans la bdd
 		    my $sth = $dbh->prepare_cached('
-                INSERT INTO playbot (date, type, url, sender_irc, sender, title)
-                VALUES (NOW(),?,?,?,?,?)');
+                INSERT INTO playbot (type, url, sender, title)
+                VALUES (?,?,?,?)');
 		    $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
 
-		    $sth->execute($content{'site'}, $content{'url'}, $nick, $content{'author'}, $content{'title'})
+		    $sth->execute($content{'site'}, $content{'url'}, $content{'author'}, $content{'title'})
 			    or $log->error("Couldn't finish transaction: " . $dbh->errstr);
 	    }
 
@@ -92,11 +92,11 @@ sub parse {
 
         # insertion du chan
         my $sth = $dbh->prepare_cached('
-            INSERT INTO playbot_chan (content, chan)
-            VALUES (?,?)');
+            INSERT INTO playbot_chan (content, chan, sender_irc)
+            VALUES (?,?,?)');
 		$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
 
-        $sth->execute($id, $chan->[0])
+        $sth->execute($id, $chan->[0], $nick)
             or $log->error("Couldn't finish transaction: " . $dbh->errstr);
     }
 
-- 
GitLab