* Script for initialising the database.

This commit is contained in:
Eelco Dolstra 2008-11-28 17:25:30 +00:00
parent cbc046edc5
commit ff9987c904
3 changed files with 17 additions and 2 deletions

View file

@ -15,7 +15,7 @@ sub isValidPath {
sub getHydraPath { sub getHydraPath {
my $dir = $ENV{HYDRA_DATA}; my $dir = $ENV{"HYDRA_DATA"};
die "The HYDRA_DATA environment variable is not set!\n" unless defined $dir; die "The HYDRA_DATA environment variable is not set!\n" unless defined $dir;
die "The HYDRA_DATA directory does not exist!\n" unless -d $dir; die "The HYDRA_DATA directory does not exist!\n" unless -d $dir;
return $dir; return $dir;

15
src/Hydra/script/hydra_init.pl Executable file
View file

@ -0,0 +1,15 @@
#!/var/run/current-system/sw/bin/perl -w
use strict;
use Hydra::Helper::Nix;
my $hydraHome = $ENV{"HYDRA_HOME"};
die "The HYDRA_HOME environment variable is not set!\n" unless defined $hydraHome;
my $hydraData = $ENV{"HYDRA_DATA"};
mkdir $hydraData unless -d $hydraData;
my $dbPath = getHydraPath . "/hydra.sqlite";
system("sqlite3 $dbPath < $hydraHome/sql/hydra.sql") == 0
or warn "Cannot initialise database in $dbPath";

View file

@ -155,7 +155,7 @@ create table Projects (
name text primary key not null, -- project id, lowercase (e.g. "patchelf") name text primary key not null, -- project id, lowercase (e.g. "patchelf")
displayName text not null, -- display name (e.g. "PatchELF") displayName text not null, -- display name (e.g. "PatchELF")
description text, description text,
enabled integer not null default 1 enabled integer not null default 1,
owner text not null, owner text not null,
foreign key (owner) references Users(userName) -- ignored by sqlite foreign key (owner) references Users(userName) -- ignored by sqlite
); );