Schema creation fix
This commit is contained in:
parent
eb5fa3c9d4
commit
de8a7421e4
21
Database.pm
21
Database.pm
@ -45,7 +45,7 @@ sub mdo {
|
|||||||
# Bad hack
|
# Bad hack
|
||||||
if ( $name eq 'all' ) {
|
if ( $name eq 'all' ) {
|
||||||
my $q
|
my $q
|
||||||
= 'select id, name, resource, username, comment from passwords';
|
= 'select id, name, `group`, resource, username, comment from passwords';
|
||||||
|
|
||||||
my $sth = $dbh->prepare($q);
|
my $sth = $dbh->prepare($q);
|
||||||
my $rv = $sth->execute();
|
my $rv = $sth->execute();
|
||||||
@ -54,19 +54,21 @@ sub mdo {
|
|||||||
printf "%-11s %-11s %-11s %-11s %-11s\n",
|
printf "%-11s %-11s %-11s %-11s %-11s\n",
|
||||||
colored( "ID", 'white' ),
|
colored( "ID", 'white' ),
|
||||||
colored( "NAME", 'magenta' ),
|
colored( "NAME", 'magenta' ),
|
||||||
|
colored( "GROUP", 'bold magenta' ),
|
||||||
colored( "RESOURCE", 'blue' ),
|
colored( "RESOURCE", 'blue' ),
|
||||||
colored( "USERNAME", 'green' ),
|
colored( "USERNAME", 'green' ),
|
||||||
colored( "COMMENT", 'yellow' );
|
colored( "COMMENT", 'yellow' );
|
||||||
print "=================================\n";
|
print "=========================================\n";
|
||||||
while ( my ( $id, $name, $resource, $username, $comment )
|
while ( my ( $id, $name, $group, $resource, $username, $comment )
|
||||||
= $sth->fetchrow_array() )
|
= $sth->fetchrow_array() )
|
||||||
{
|
{
|
||||||
if ( !defined($comment) ) {
|
if ( !defined($comment) ) {
|
||||||
$comment = '';
|
$comment = '';
|
||||||
}
|
}
|
||||||
printf "%-11s %-11s %-11s %-11s %-11s\n",
|
printf "%-11s %-11s %-11s %-11s %-11s %-11s\n",
|
||||||
colored( $id, 'white' ),
|
colored( $id, 'white' ),
|
||||||
colored( $name, 'magenta' ),
|
colored( $name, 'magenta' ),
|
||||||
|
colored( $group, 'bold magenta' ),
|
||||||
colored( $resource, 'blue' ),
|
colored( $resource, 'blue' ),
|
||||||
colored( $username, 'green' ),
|
colored( $username, 'green' ),
|
||||||
colored( $comment, 'yellow' );
|
colored( $comment, 'yellow' );
|
||||||
@ -137,8 +139,15 @@ sub create_base {
|
|||||||
my $dbh = DBI->connect( "dbi:SQLite:dbname=$first_sqlite", "", "" );
|
my $dbh = DBI->connect( "dbi:SQLite:dbname=$first_sqlite", "", "" );
|
||||||
print "Create database schema\n";
|
print "Create database schema\n";
|
||||||
my $q_table
|
my $q_table
|
||||||
= "create table passwords(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(32), username VARCHAR(32),
|
= "CREATE TABLE passwords(
|
||||||
resource TEXT, group VARCHAR(32), password TEXT, comment TEXT)";
|
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
name VARCHAR(32) NOT NULL,
|
||||||
|
username VARCHAR(32) NOT NULL,
|
||||||
|
resource TEXT NOT NULL,
|
||||||
|
password VARCHAR(32) NOT NULL,
|
||||||
|
comment TEXT NOT NULL,
|
||||||
|
'group' VARCHAR(32) NOT NULL
|
||||||
|
)";
|
||||||
$dbh->do($q_table);
|
$dbh->do($q_table);
|
||||||
|
|
||||||
print "Encrypt database...\n";
|
print "Encrypt database...\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user