> Yes, I can confirm the problem. Getting this solved may prove
> interesting, as upstream does not officially support MariaDB.

thank you for very quick response



> 2) After disabling those checks, there is still a different error in
> bacula.Job and bacula.Pool:
>
> ,----
> | Error in foreign key constraint of table `bacula`.`Pool`:
> | Create table `bacula`.`Pool` with foreign key (ScratchPoolId)
> constraint
> | failed. There is only prefix index in the referenced table where the
> | referenced columns appear as the first columns.
> `----
>
> I have not yet found any explanation about that specific error on the
> net anywhere.

I have elaborated a bit on your progress and come up with following
patch (attachment) which processes fine on current Bullseye.

I don't really have an exact explanation but at least the schema seem to
be created ...


bodik
--- mysql.bacula.orig	2020-11-27 18:54:38.623338653 +0100
+++ mysql.bacula	2020-11-27 18:56:03.987850181 +0100
@@ -1,3 +1,5 @@
+SET @@FOREIGN_KEY_CHECKS=0; 
+
 --
 -- Note, we use BLOB rather than TEXT because in MySQL,
 --  BLOBs are identical to TEXT except that BLOB is case
@@ -35,9 +37,9 @@
 CREATE TABLE File (
    FileId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
    FileIndex INTEGER DEFAULT 0,
-   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
-   PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
-   FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,
+   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job(JobId),
+   PathId INTEGER UNSIGNED NOT NULL REFERENCES Path(PathId),
+   FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename(FilenameId),
    DeltaSeq SMALLINT UNSIGNED DEFAULT 0,
    MarkId INTEGER UNSIGNED DEFAULT 0,
    LStat TINYBLOB NOT NULL,
@@ -113,7 +115,7 @@
    Name TINYBLOB NOT NULL,
    Type BINARY(1) NOT NULL,
    Level BINARY(1) NOT NULL,
-   ClientId INTEGER DEFAULT 0 REFERENCES Client,
+   ClientId INTEGER UNSIGNED DEFAULT 0 REFERENCES Client(ClientId),
    JobStatus BINARY(1) NOT NULL,
    SchedTime DATETIME DEFAULT NULL,
    StartTime DATETIME DEFAULT NULL,
@@ -127,9 +129,9 @@
    ReadBytes BIGINT UNSIGNED DEFAULT 0,
    JobErrors INTEGER UNSIGNED DEFAULT 0,
    JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
-   PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
-   FileSetId INTEGER UNSIGNED DEFAULT 0 REFERENCES FileSet,
-   PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,
+   PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool(PoolId),
+   FileSetId INTEGER UNSIGNED DEFAULT 0 REFERENCES FileSet(FileSetId),
+   PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job(JobId),
    PurgedFiles TINYINT DEFAULT 0,
    HasBase TINYINT DEFAULT 0,
    HasCache TINYINT DEFAULT 0,
@@ -302,9 +304,9 @@
    LabelType TINYINT DEFAULT 0,
    LabelFormat TINYBLOB,
    Enabled TINYINT DEFAULT 1,
-   ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
-   RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
-   NextPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
+   ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool(PoolId),
+   RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool(PoolId),
+   NextPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool(PoolId),
    MigrationHighBytes BIGINT UNSIGNED DEFAULT 0,
    MigrationLowBytes BIGINT UNSIGNED DEFAULT 0,
    MigrationTime BIGINT UNSIGNED DEFAULT 0,
@@ -336,9 +338,9 @@
 
 CREATE TABLE BaseFiles (
    BaseId BIGINT UNSIGNED AUTO_INCREMENT,
-   BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
-   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
-   FileId BIGINT UNSIGNED NOT NULL REFERENCES File,
+   BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job(JobId),
+   JobId INTEGER UNSIGNED NOT NULL REFERENCES Job(JobId),
+   FileId BIGINT UNSIGNED NOT NULL REFERENCES File(FileId),
    FileIndex INTEGER DEFAULT 0,
    PRIMARY KEY(BaseId)
    );

Reply via email to