SpaceCommunist

Warlord
Joined
Apr 11, 2016
Messages
119
Location
Malachor V
Hi all,

I've been working to update some of my mods on the workshop and I'm having a bit of trouble. Despite my best efforts, the mod(s, it's split in two) crash(es) due to some apparently unseen constraint failures.

Here's the text from the Database.log file:

[2142242.442] [Localization]: StartupErrorMessages.xml
[2142242.443] [Localization]: Input XML does not contain database entry tags. GameData, GameInfo or Database
[2142247.500] [Localization]: Validating Foreign Key Constraints...
[2142247.500] [Localization]: Passed Validation.
[2142247.513] [Configuration]: Validating Foreign Key Constraints...
[2142247.513] [Configuration]: Passed Validation.
[2142256.300] [FullTextSearch]: Initializing FullTextSearch
[2142256.732] [Gameplay]: Validating Foreign Key Constraints...
[2142256.745] [Gameplay]: Passed Validation.
[2142257.364] [Configuration]: Validating Foreign Key Constraints...
[2142257.365] [Configuration]: Passed Validation.
[2142257.417] [Database] ERROR: FOREIGN KEY constraint failed
[2142257.417] [Database] ERROR: FOREIGN KEY constraint failed
[2142258.306] [HallofFame]: Database found. Checking versions...
[2142258.308] [HallofFame]: Database is up-to-date!
[2142273.328] [FullTextSearch]: FTS - Creating Context
[2142282.306] [Configuration]: Validating Foreign Key Constraints...
[2142282.306] [Configuration]: Passed Validation.
[2142282.355] [Database] ERROR: FOREIGN KEY constraint failed
[2142282.355] [Database] ERROR: FOREIGN KEY constraint failed
[2142283.952] [Gameplay] ERROR: CHECK constraint failed: Districts
[2142283.952] [Gameplay] ERROR: CHECK constraint failed: Districts
[2142284.216] [Gameplay] ERROR: near ",": syntax error
[2142288.555] [Gameplay] ERROR: FOREIGN KEY constraint failed
[2142288.555] [Gameplay] ERROR: FOREIGN KEY constraint failed
[2142288.555] [Gameplay]: Validating Foreign Key Constraints...
[2142288.564] [Gameplay] ERROR: Invalid Reference on HistoricalAgendas.AgendaType - "AGENDA_SC_[spoilersnip]" does not exist in Agendas
[2142288.565] [Gameplay] ERROR: Invalid Reference on LeaderTraits.TraitType - "TRAIT_LEADER_SC_[spoilersnip]" does not exist in Traits
[2142288.578] [Gameplay]: Failed Validation.
[2142292.997] [Configuration]: Validating Foreign Key Constraints...
[2142292.998] [Configuration]: Passed Validation.
[2142293.044] [Database] ERROR: FOREIGN KEY constraint failed
[2142293.044] [Database] ERROR: FOREIGN KEY constraint failed
[2142293.599] [FullTextSearch]: FTS - Creating Context
[2142301.366] [FullTextSearch]: FullTextSearch - Shutting down

Basically, what I'm dealing with right now is:
  • The District code (in "Districts") failed a "Check" constraint (never heard of that kind of constraint until now)
  • There is a single syntax error in my Leader's data file (helpfully listed as "near ,", thanks a lot log file)
  • In the same file as above, the Leader Trait and Agenda don't register as existing in "Traits" and "Agendas", despite being perfectly syntaxed and very visibly being in there (I copied and pasted other functioning mods' code for Traits and Agendas to check, still failed)
  • Several different Foreign constraint failures
Frustratingly, there are some other issues that I've managed to "correct" from the log file:
  • In my leader's colours file, there were some alternate colour options (as this is for Gathering Storm). the Database.log file, however, listed an error for the file because "Alt1PrimaryColor does not exist in PlayerColors", despite clearly being listed in the Expansion 2 file and other functioning mods
  • Previously, there were errors with my district and some related dummy buildings. I switched from using a "INSERT INTO w SELECT x FROM y WHEN z" to a "INSERT INTO w VALUES x" format and suddenly it worked out, despite me putting the same values in the code. This is particularly frustrating because one of these is a replacement for an existing district and the others are meant to be "duplicates" of existing buildings; I would prefer that the values for these dummies could adjust for their real/replaced counterparts
I've narrowed the issues I have down to this point, and I'm not sure what else to do but ask for help. I've attached a .zip below of the affected files if anyone wants to take a look.
 

Attachments

  • USSR Help.zip
    5.2 KB · Views: 129
First off, "true" and "false" are not recognized by SQL. Numerical 1 and 0 are used in SQL instead. This is the root cause of the "CHECK" constraint failure. The definition of table "Districts" in the game's base files includes a "CHECK" requirement that all rows in the table for columns "Coast", "RequiresPlacement", "RequiresPopulation", "NoAdjacentCity", "CityCenter", "Aqueduct", "InternalOnly", "ZOC", "FreeEmbark", "CaptureRemovesBuildings", "CaptureRemovesCityDefenses", "TradeEmbark", "OnePerCity", "AllowsHolyCity", "AdjacentToLand", "CanAttack", and "CaptureRemovesDistrict" must conform to SQL's understanding of Boolean values, which is 1 or 0. For example, one of the boolean columns in table Districts is defined as
Code:
"AllowsHolyCity" BOOLEAN NOT NULL CHECK (AllowsHolyCity IN (0,1)) DEFAULT 0,

XML "true" and "false" are auto-parsed into the needed 1 and 0 when translated by the game into SQL code and inserted into the game database, but text 'true' and 'false' in SQL files are not so "auto-translated".

Fix this issue everywhere where relevant before proceeding further.

Note that this issue does not apply to for example Table ModifierArguments Column "Value" since the definition of that column is expecting text-strings rather than boolean (0,1) values. So 'true' or 'false' would be OK in that column in an SQL file, but not for any column of any table that is expecting and requires a boolean value.

---------------------------------

Also, it matters not what is contained within your SQL or XML file so far as the "X does not exist in TalbeName" messages are concerned: all that matters is what successfully gets added to the game database. Fatal syntax errors such as the one you have for incorrect boolean designations cause the game to cease reading anything within an XML or SQL file at the first such error encountered.


--------------------------------------

Code:
('SC_Lenin_USSR_Yields',		1,		10,		 'YIELD_SCIENCE',
	('SC_Lenin_USSR_Yields',		1,		10,		 'YIELD_CULTURE');
 
Last edited:
Your error messages with leading [Database] headers are likely coming from an IconDefinitions file. Messages with "[Database]" at the front are a bit misleading since they aren't referring to anything being added to the game by an UpdateDatabase type of action: they're usually referring to text or icon actions. Probably you've mis-spelled the name of an IconAtlas as you've previously defined it within table <IconTextureAtlases>, but without the mod itself for anyone to look at it is impossible to tell if this is your issue, or if it is any one of a dozen or more other similar mistakes that can be made.
 
Top Bottom