#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use FindBin;
use Path::Class;

my $DBHOME=dir($FindBin::Bin)->parent->file('bookmarks.db');

my $db=DBI->connect("dbi:SQLite:$DBHOME");

local $/='';
while (<DATA>) {
    my $rv=$db->do($_);
    warn 'Problemi: '.$db->errstr() unless $rv;
}

__DATA__
drop table links_tags;

drop table links;

drop table tags;

create table links (
 pk integer primary key autoincrement,
 url text unique,
 title text,
 descr text,
 icon text,
 icon_type text,
 add_date integer,
 last_access_date integer,
 access_count integer
);

create table tags (
 pk integer primary key autoincrement,
 name text unique,
 descr text
);

create table links_tags (
 link integer,
 tag integer
);
