Defense--Column Type is not unique

Iconian

Chieftain
Joined
May 16, 2021
Messages
73
I've been trying to give some buildings a defense stat that didn't have it originally, like so.

<Row>
<Type>BUILDING_KREPOST</Type>
<Defense>250</Defense>
</Row>

But this gave me a "column Type is not unique" in Database.log. I've been trying to figure out what I ought to change this to but I'm not finding anything on it.

[1722452.781] column Type is not unique
[1722452.781] While executing - 'insert into Buildings('Type', 'Defense') values (?, ?);'
[1722452.781] In XMLSerializer while inserting row into table insert into Buildings('Type', 'Defense') with values (BUILDING_KREPOST, 250, ).
[1722452.781] In XMLSerializer while updating table Buildings from file Buildings/Buildings.xml.
[1722452.781] column Type is not unique
 
You will need to use <Update> (change an existing entry) not <Row> (add a new entry). The error is telling you that it's trying to create a second entry for Type='BUILDING_KREPOST' and only one is allowed (as Type has to be unique)
 
You have to alter (Update) the existing row. It does not matter that the existing row where Type='BUILDING_KREPOST' does not set a value for the Defense column. .What matters is there is already a row where Type='BUILDING_KREPOST' , so you have to make an update to that row.
Code:
<GameData>
	<Buildings>
		<Update>
			<Where Type="BUILDING_KREPOST"/>
			<Set Defense="250" />
		</Update>
	</Buildings>
</GameData>
 
Top Bottom