add the date at which the db was generated into sqlports.

document Meta table, which I somehow forgot
This commit is contained in:
espie 2021-01-29 08:30:37 +00:00
parent 341a9253ba
commit c0b8252709
4 changed files with 26 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.127 2020/07/07 10:53:27 espie Exp $
# $OpenBSD: Makefile,v 1.128 2021/01/29 08:30:37 espie Exp $
CATEGORIES = databases
V = 7.32
V = 7.33
DISTNAME = sqlports-$V
DISTFILES =
COMMENT = sqlite database of ports
@ -13,7 +13,6 @@ PKGNAME-list = portslist-$V
PERMIT_PACKAGE = Yes
MULTI_PACKAGES = -main -list
REVISION = 0
DBNAME = sqlports
SQLCACHE = ${DBNAME}_cache.sql

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: Inserter.pm,v 1.40 2019/05/17 20:41:54 espie Exp $
# $OpenBSD: Inserter.pm,v 1.41 2021/01/29 08:30:37 espie Exp $
#
# Copyright (c) 2006-2010 Marc Espie <espie@openbsd.org>
#
@ -257,7 +257,8 @@ sub create_meta
{
Sql::Create::Table->new("Meta")->add(
Sql::Column::Text->new("SchemaVersion"),
Sql::Column::Text->new("Hash"));
Sql::Column::Text->new("Hash"),
Sql::Column::CurrentDate->new("CreationDate"));
}
sub create_path_table

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: Sql.pm,v 1.34 2019/05/18 21:35:22 espie Exp $
# $OpenBSD: Sql.pm,v 1.35 2021/01/29 08:30:37 espie Exp $
#
# Copyright (c) 2018 Marc Espie <espie@openbsd.org>
#
@ -861,6 +861,13 @@ sub type
"TEXT";
}
package Sql::Column::CurrentDate;
our @ISA = qw(Sql::Column::Text);
sub placeholder
{
"CURRENT_DATE";
}
package Sql::Column::Key;
our @ISA = qw(Sql::Column::Integer);
sub new

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: sqlports.5,v 1.4 2020/07/07 10:53:27 espie Exp $
.\" $OpenBSD: sqlports.5,v 1.5 2021/01/29 08:30:38 espie Exp $
.\"
.\" Copyright (c) 2020 Marc Espie <espie@openbsd.org>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 7 2020 $
.Dd $Mdocdate: January 29 2021 $
.Dt SQLPORTS 5
.Os
.Sh NAME
@ -34,7 +34,17 @@ Table names are prefixed with underscore, .e.g,
contrary to views, e.g.,
.Sq Paths .
.Pp
Tables are as follows:
The special table
.Sq Meta
contains only one entry, detailing the current database.
.Bl -tag -offset indent -width keyword
.It Meta (SchemaVersion, Hash, CurrentDate)
SchemaVersion follows the usual major.minor rules as shared libraries,
Hash is unique to each generated database,
CurrentDate is the date the database was generated.
.El
.Pp
Other tables are as follows:
.Bl -tag -offset indent -width keyword
.It _Paths (ID, FULLPKGPATH, PKGPATH, CANONICAL)
PKGPATH points to a PATHS entry corresponding to the stripped down version of