diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-04-24 20:32:01 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-04-24 20:32:01 -0400 |
commit | 5eb0f151e3b768dc370aa6bb5f1c6092ba19a5eb (patch) | |
tree | da668397099c6051fb562046c6174ed20564510b | |
parent | 440df2074dda5efabe1dce09cc7217334f6d6cb0 (diff) | |
download | www-pinboard-5eb0f151e3b768dc370aa6bb5f1c6092ba19a5eb.tar.gz www-pinboard-5eb0f151e3b768dc370aa6bb5f1c6092ba19a5eb.zip |
allow refreshing the entire database
since there's not really any good way to fetch posts that have been
updated since the last time you synced
-rw-r--r-- | bin/pinboard_export | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/pinboard_export b/bin/pinboard_export index 3e61a09..5826cdc 100644 --- a/bin/pinboard_export +++ b/bin/pinboard_export @@ -8,15 +8,19 @@ use DBI; use Getopt::Long qw(:config pass_through); use WWW::Pinboard; -my ($dsn, $token); +my ($dsn, $token, $refresh); GetOptions( 'dsn=s' => \$dsn, 'token=s' => \$token, + 'refresh' => \$refresh, ); die "--dsn is required" unless $dsn; die "--token is required" unless $token; my $dbh = DBI->connect($dsn, '', '', { RaiseError => 1, AutoCommit => 0 }); +if ($refresh) { + $dbh->do('DROP TABLE `posts`;'); +} my $fromdt = '1970-01-01T00:00:00Z'; if (!$dbh->tables(undef, undef, 'posts')) { $dbh->do(<<''); |