<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,17 +1,8 @@
 == INSTALL
 
-Remedie is under development and requires lots of hacking
+Remedie is under development and requires lots of hacking.
 
-For now, run
-
-  &gt; rm -r ~/.remedie
-  &gt; perl -Ilib -MRemedie::DB::Schema -e 'Remedie::DB::Schema-&gt;install'
-
-to initialize SQLite database. When we change the schema you might
-need to do that again (and that will lose all your items in the
-database!) until we come up with a decent schema upgrading system.
-
-When you initialized the database, run
+Pull the latest code from git using git pull or github download, then run:
 
   &gt; perl -Ilib ./bin/remedie-server.pl
 
@@ -23,6 +14,17 @@ You can type 'R' (shift+r) to refresh all feeds from UI. Type 'H'
 
 I hope this will eventually become standalone installable app using preferencePanes etc.
 
+== CLEANING UP DATABASE
+
+For now, run
+
+  &gt; rm -r ~/.remedie
+  &gt; perl -Ilib -MRemedie::DB::Schema -e 'Remedie::DB::Schema-&gt;install'
+
+to re-initialize SQLite database. When we change the schema you might
+need to do that again (and that will lose all your items in the
+database!) until we come up with a decent schema upgrading system.
+
 == DEBUGGING
 
 Got a black screen or JavaScript alert &quot;Can't load subscription&quot;? Try:</diff>
      <filename>HACKING</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 package Remedie::CLI::Server;
 use Moose;
 use MooseX::Types::Path::Class qw(File Dir);
+use Remedie::DB::Schema;
 use Remedie::Server;
 use Remedie::UserData;
 use Pod::Usage;
@@ -117,6 +118,8 @@ sub run {
         );
     }
 
+    Remedie::DB::Schema-&gt;upgrade();
+
     Remedie::Server-&gt;bootstrap({
         host       =&gt; $self-&gt;host,
         port       =&gt; $self-&gt;port,</diff>
      <filename>lib/Remedie/CLI/Server.pm</filename>
    </modified>
    <modified>
      <diff>@@ -45,15 +45,19 @@ sub upgrade {
 
     my $db  = Remedie::DB-&gt;new;
     my $dbh = $db-&gt;dbh;
+    my $sth = $dbh-&gt;prepare(&quot;SELECT name FROM sqlite_master WHERE type IN (?)&quot;);
+    $sth-&gt;execute('table');
 
-    my $sth = $dbh-&gt;prepare('SELECT version FROM remedie_schema');
-    my $version;
-    eval {
-        $sth-&gt;execute;
-        $version = $sth-&gt;fetchrow_arrayref-&gt;[0];
-    };
+    my %tables;
+    while (my $row = $sth-&gt;fetchrow_arrayref) {
+        $tables{$row-&gt;[0]} = 1;
+    }
 
-    ## TODO we want something like SQLite::Diff here
+    unless ($tables{channel}) {
+        $class-&gt;install();
+    }
+
+    return 1;
 }
 
 1;</diff>
      <filename>lib/Remedie/DB/Schema.pm</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>edf0e52cf797c68da43c5fbcb6dfa389e022b4ee</id>
    </parent>
  </parents>
  <author>
    <name>Tatsuhiko Miyagawa</name>
    <email>miyagawa@bulknews.net</email>
  </author>
  <url>http://github.com/miyagawa/remedie/commit/4d81f977747495489fb396ce29b6e6619e6d436b</url>
  <id>4d81f977747495489fb396ce29b6e6619e6d436b</id>
  <committed-date>2009-01-12T14:27:43-08:00</committed-date>
  <authored-date>2009-01-12T14:27:43-08:00</authored-date>
  <message>Auto install the SQLite database in the first run. No need to run the command line in the first-time run!</message>
  <tree>0f8cb4ec7cb86e415bfdd93bf9bfa4789b63d061</tree>
  <committer>
    <name>Tatsuhiko Miyagawa</name>
    <email>miyagawa@bulknews.net</email>
  </committer>
</commit>
