Constraint violation when creating Sphinx database

When I call TAureliusDBSchema.UpdateDatabase method, I'm getting the following error:

Project DCDAuth.exe raised exception class EIBNativeException with message '[FireDAC][Phys][FB]unsuccessful metadata update
CREATE TABLE SX_USER_TOKENS failed
violation of PRIMARY or UNIQUE KEY constraint "RDB$INDEX_15" on table "RDB$RELATION_FIELDS"
Problematic key value is ("RDB$FIELD_NAME" = 'USER_ID', "RDB$RELATION_NAME" = 'SX_USER_TOKENS')'.

I've debugged into TDatabaseManager.ExecuteSQLStatements, and that seems to contain a duplicated line:

CREATE TABLE sx_user_tokens (
id VARCHAR(36) CHARACTER SET ISO8859_1 NOT NULL,
login_provider VARCHAR(255) CHARACTER SET ISO8859_1 NOT NULL,
name VARCHAR(255) CHARACTER SET ISO8859_1 NOT NULL,
token_value VARCHAR(255) CHARACTER SET ISO8859_1 NOT NULL,
user_id VARCHAR(36) CHARACTER SET ISO8859_1 NOT NULL,
user_id VARCHAR(36) CHARACTER SET ISO8859_1 NOT NULL,
CONSTRAINT PK_sx_user_tokens PRIMARY KEY (id))

Have you seen this before, or have any idea what could be causing it?

None of our other applications have this issue.

I'm trying to create a local Firerbird 4 database for Sphinx.

Looking into TAnsiSQLGenerator.GenerateCreateTable in Aurelius.Sql.AnsiSQLGenerator.pas, I actually have 2 instances of the user_id column...

I'm trying to find out how that's created now...

The issue was that one of the entities was abstract...

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.