Skip to content
Snippets Groups Projects
Commit 03161377 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- added missed indices

- added view to operate on non-deleted aips
parent b204dbef
No related branches found
No related tags found
No related merge requests found
...@@ -324,22 +324,32 @@ SQL_DELETE_PLAN ...@@ -324,22 +324,32 @@ SQL_DELETE_PLAN
############################################################################### ###############################################################################
sub write_index_creation($dbh) { sub write_index_creation($dbh) {
my $sql1=<<"SQL_INDEX1"; my $sql1=<<"SQL_INDEX1";
CREATE UNIQUE INDEX aip_index ON aip (ie_id, version ASC); CREATE UNIQUE INDEX aip_index ON aip (ie_id, version);
SQL_INDEX1 SQL_INDEX1
my $sql2=<<"SQL_INDEX2"; my $sql2=<<"SQL_INDEX2";
CREATE UNIQUE INDEX sourcedata_index ON sourcedatafile (aip_id, name); CREATE UNIQUE INDEX sourcedata_index ON sourcedatafile (aip_id, name);
SQL_INDEX2 SQL_INDEX2
my $sql3=<<"SQL_INDEX3"; my $sql3=<<"SQL_INDEX3";
CREATE INDEX delete_index ON deleted (aip_id ASC); CREATE INDEX delete_index ON deleted (aip_id);
SQL_INDEX3 SQL_INDEX3
my $sql4=<<"SQL_INDEX4"; my $sql4=<<"SQL_INDEX4";
CREATE INDEX aip_index2 ON aip (lza_id ASC); CREATE INDEX aip_index2 ON aip (lza_id);
SQL_INDEX4 SQL_INDEX4
my $sql5=<<"SQL_INDEX5";
CREATE INDEX aip_index3 ON aip (ie_id,lza_id);
SQL_INDEX5
my $sql6=<<"SQL_VIEW";
CREATE VIEW non_deleted_aip(id,ie_id,lza_id,version,dir_path) AS
SELECT * FROM aip WHERE aip.id NOT IN (
SELECT aip_id FROM deleted
);
SQL_VIEW
my $sth1 = $dbh->prepare($sql1); $sth1->execute() or die "sql problem detected", $dbh->errstr; my $sth1 = $dbh->prepare($sql1); $sth1->execute() or die "sql problem detected", $dbh->errstr;
my $sth2 = $dbh->prepare($sql2); $sth2->execute() or die "sql problem detected", $dbh->errstr; my $sth2 = $dbh->prepare($sql2); $sth2->execute() or die "sql problem detected", $dbh->errstr;
my $sth3 = $dbh->prepare($sql3); $sth3->execute() or die "sql problem detected", $dbh->errstr; my $sth3 = $dbh->prepare($sql3); $sth3->execute() or die "sql problem detected", $dbh->errstr;
my $sth4 = $dbh->prepare($sql4); $sth4->execute() or die "sql problem detected", $dbh->errstr; my $sth4 = $dbh->prepare($sql4); $sth4->execute() or die "sql problem detected", $dbh->errstr;
my $sth5 = $dbh->prepare($sql5); $sth5->execute() or die "sql problem detected", $dbh->errstr;
my $sth6 = $dbh->prepare($sql6); $sth6->execute() or die "sql problem detected", $dbh->errstr;
return 1; return 1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment