I am using the newest version of Aurelius.
Some time ago, I defined a table definition very similary to the one, I try to create now. And the "old" one has created successfully.
Today I try to create the following one:
And now, I am getting the following error message, when the application is started (compiling finished successfully):
Error: duplicate column name: MandantId
CREATE TABLE Clients (
Id TEXT NOT NULL,
MandantID TEXT,
MacAdresse TEXT NOT NULL,
IsActive TEXT,
LastUsed REAL NOT NULL,
MandantId TEXT NOT NULL,
CONSTRAINT PK_Clients PRIMARY KEY (Id),
CONSTRAINT FK_Clients_Mandants_MandantID FOREIGN KEY (MandantID) REFERENCES Mandants (MandantID),
CONSTRAINT UK_A222CAE9_Clients UNIQUE (MandantID, MacAdresse))
Deleting the database and recreate it by code (ORM) ends with a problem on the old table, which had no creation problem in the past.
Why does this happen? Please help
I think I have located the problem.
In the Mandants class I defined a ManyValueAssociation to the Clients.
The Mandant Class has also a column "MandantID" which is used as ID
After removing the ManyValueAssociation in Mandants table, the problem is gone.
So, when the Create table SQL statment is build, it should check deeper, if an column with the same name is already there with the same column definition. If yes, it should not add the column used by the Association (if both are "MandantId TEXT" - in my code the association was declared as "required" to the column, so the "NOT NULL" addition was there).
Also it would be nice, if the mapping problem is being shown on startup (debug mode) - if possible.
For now Aurelius mapper doesn't check for duplicated column names until it actually uses it. To really explain what happened I'd have to see the full original mapping. But indeed, if you mapped two columns with same name, it will complain.