summaryrefslogtreecommitdiffstats
path: root/bin/pinboard_export
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pinboard_export')
-rw-r--r--bin/pinboard_export6
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(<<'');