From 5eb0f151e3b768dc370aa6bb5f1c6092ba19a5eb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 24 Apr 2014 20:32:01 -0400 Subject: 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 --- bin/pinboard_export | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(<<''); -- cgit v1.2.3-54-g00ecf