I moved from Access to MySQL (InnoDB)
frontend is Access and Backend is MySQL. InnoDb is used instead of MyISAM to use relation functions.
In my original Access application I had a working 1:1 relationships.You can see it here
For migration I used "Bullzip" for datas and this for the relations.(Ivan Cachicatari reply)
Because this code just gave me 1:N relationships, I had to manually edit the Model of the Schema.
The Model is looking like this:
After I made the Model exactly look like my original Access relations, I Synchronized it with my Schema.
Description of the tables:
I have a StockChange(Bestandsaenderung) table.Primary Key BestandsanederungID
When something is changing in Return (Rückgabe), Postions (Positionen) or Incoming goods (Wareneingang) it also gets registered in StockChange and the Primary key of StockExcahnge is automatically inserted into the tables (X-BestandsaenderungIdREF )
Code in MYSQL ( I just focus on these two tables. When one table has a working 1:1 realtion, the other ones are hopefully easy)
CREATE TABLE `tbl_lager_bestandsaenderungen`
(
`BestandsaenderungID` int(11) NOT NULL AUTO_INCREMENT,
`BestandsaenderungArtikelIDRef` int(11) DEFAULT '0',
`BestandsaenderungAnzahl` int(11) DEFAULT '0',
`BestandsaenderungDatum` datetime DEFAULT NULL,
`BestandsaenderungVorzeichen` int(11) DEFAULT '1',
`BestandsaenderungInventur` tinyint(1) DEFAULT '0',
PRIMARY KEY (`BestandsaenderungID`),
KEY `BestandsaenderungArtikelIDRef` (`BestandsaenderungArtikelIDRef`),
KEY `BestandsaenderungID` (`BestandsaenderungID`),
CONSTRAINT `tbl_Lager_Artikeltbl_Lager_Bestandsaenderungen` FOREIGN KEY (`BestandsaenderungArtikelIDRef`) REFERENCES `tbl_lager_artikel` (`ArtikelID`) )
CREATE TABLE `tbl_lager_wareneingang` (
`WareneingangID` int(11) NOT NULL AUTO_INCREMENT,
`WareneingangLieferantIDRef` int(11) DEFAULT '0',
`Einkaufspreis` decimal(19,4) DEFAULT '0.0000',
`WareneingangBestandsaenderungIDRef` int(11) DEFAULT '0',
PRIMARY KEY (`WareneingangID`),
UNIQUE KEY `WareneingangBestandsaenderungIDRef_UNIQUE` (`WareneingangBestandsaenderungIDRef`),
KEY `WareneingangLieferantIDRef` (`WareneingangLieferantIDRef`),
KEY `WareneingangID` (`WareneingangID`),
KEY `fk_tbl_lager_wareneingang_tbl_lager_bestandsaenderungen1_idx`(`WareneingangBestandsaenderungIDRef`),
CONSTRAINT `fk_tbl_lager_wareneingang_tbl_lager_bestandsaenderungen1` FOREIGN KEY (`WareneingangBestandsaenderungIDRef`) REFERENCES `tbl_lager_bestandsaenderungen` (`BestandsaenderungID`),
CONSTRAINT `tbl_Lager_Firmentbl_Lager_Wareneingang` FOREIGN KEY (`WareneingangLieferantIDRef`) REFERENCES `tbl_lager_firmen` (`LieferantID`)
)
For checking if everything is still okay, I again created a Model through 'Reverse Engineering' to see if the 1:1 realtions still exists, but it's a 1:N relation again.
My problem is, that in my Access form, the PrimaryKey of the stock change isn't getting inserted into the Incoming goods table ForeignKey WareneingangBestandsaenderungIDRef.
For a better explanation I made a video.
In pure Access it worked perfect. Just after migration all 1:1 relations aren't working anymore.
EDIT:
When I enter datas into into the subform (Wareneingang) , the PK of the MainForm ( Bestandsaenderung) gets inserted into WareneingangBestandsaenderungIDREf.
Additionally if I try to commit that second child record I get
"ODBC -- call failed. Duplicate entry '1' for key 'WareneingangBestandsaenderungIDRef_UNIQUE' (#1062)"
... so that shows me that the MySQL engine is enforcing the 1:1 relationship. But in my Form it still dont get entered automatically how you can see in my video.