Verified Commit 78b41aee authored by Gaurav Mishra's avatar Gaurav Mishra 🐼

fix(constraints): Also clean old constraints

Also check repository permissions at docker boots.
Signed-off-by: Gaurav Mishra's avatarGaurav Mishra <mishra.gaurav@siemens.com>
parent 0995f554
......@@ -26,7 +26,6 @@ services:
- FOSSOLOGY_DB_NAME=fossology
- FOSSOLOGY_DB_USER=fossy
- FOSSOLOGY_DB_PASSWORD=fossy
user: fossy
command: scheduler
depends_on:
- db
......
......@@ -50,7 +50,7 @@ fi
# Setup environment
if [[ $# -eq 0 || ($# -eq 1 && "$1" == "scheduler") ]]; then
/usr/local/lib/fossology/fo-postinstall --database --licenseref
/usr/local/lib/fossology/fo-postinstall --common --database --licenseref
fi
# Start Fossology
......
......@@ -143,9 +143,12 @@ function Migrate_33_34($dbManager, $dryRun)
echo "*** Cleaning tables for new constraints ***\n";
$count = 0;
$tableMap = [
["author", "agent_fk", "agent", "agent_pk"],
["author", "pfile_fk", "pfile", "pfile_pk"],
["bucket_container", "bucket_fk", "bucket_def", "bucket_pk"],
["bucket_file", "bucket_fk", "bucket_def", "bucket_pk"],
["bucket_file", "pfile_fk", "pfile", "pfile_pk"],
["copyright", "agent_fk", "agent", "agent_pk"],
["copyright_decision", "pfile_fk", "pfile", "pfile_pk"],
["ecc", "agent_fk", "agent", "agent_pk"],
["ecc", "pfile_fk", "pfile", "pfile_pk"],
......
......@@ -193,7 +193,11 @@ if [[ $COMMON ]]; then
chmod 2775 "{$PROJECTSTATEDIR}" "{$PROJECTSTATEDIR}/agents" {$CACHEDIR}
# make sure repo and its parent dir has the right permissions
chown {$PROJECTUSER}:$PROJECTGROUP $\{REPO%/*\} $REPO
if [[ $(stat -c "%G" $REPO) != {$PROJECTGROUP} ]]; then
echo "NOTE: Repository group is not correct."
echo "Fixing"
chown --recursive {$PROJECTUSER}:$PROJECTGROUP $\{REPO%/*\} $REPO
fi
chmod 2770 $\{REPO%/*\} $REPO
# make install sets Db.conf's mode to 660, but can't chgrp it because
......
......@@ -168,11 +168,10 @@ if($dbManager->existsTable("author"))
require_once("$LIBEXECDIR/resequence_author_table.php"); // If table exists, clean up for Schema
}
if($isUpdating && substr(str_replace(".", "", $sysconfig['Release']), 0, 3) <= 330)
{
require_once("$LIBEXECDIR/dbmigrate_3.3-3.4.php");
Migrate_33_34($dbManager, $Verbose);
}
// Migration script to clear tables for new constraints
require_once("$LIBEXECDIR/dbmigrate_3.3-3.4.php");
Migrate_33_34($dbManager, $Verbose);
$FailMsg = $libschema->applySchema($SchemaFilePath, $Verbose, $DatabaseName, $migrateColumns);
if ($FailMsg)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment