<commit_before><?xml version="1.0" encoding="UTF-8"?>
 
<databaseChangeLog
	xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
		http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">

  <changeSet author="dhustace" id="1.7.5-addAlarmFkConstraint">
    <delete tableName="alarms">
      <where>nodeid IS NOT NULL AND nodeid NOT IN (SELECT NODEID FROM NODE)</where>
    </delete>
    
    <addForeignKeyConstraint constraintName="fk_alarms_nodeid" onDelete="CASCADE" baseTableName="alarms"
      baseColumnNames="nodeid" referencedTableName="node" referencedColumnNames="nodeid" />

    <rollback>
      <dropForeignKeyConstraint baseTableName="alarms" constraintName="alarm_nodeid" />
    </rollback>
    
  </changeSet>

 <changeSet author="rssntn67" id="fixMapPkConstraint">
	<preConditions onFail="MARK_RAN">
			<and>
				<not><primaryKeyExists tableName="map" primaryKeyName="pk_mapid" /></not>
			</and>
	</preConditions>
    
	<addPrimaryKey tableName="map" columnNames="mapid" constraintName="pk_mapid"/>        
	<rollback>
		<dropPrimaryKey tableName="map" constraintName="pk_mapid" />
		<modifyColumn tableName="map">
			<column name="mapid" type="integer">
				<constraints nullable="false" />
			</column>
		</modifyColumn>
	</rollback>
 
  </changeSet>
  
   <changeSet author="rssntn67" id="fixElementFkConstraint">
	<preConditions onFail="MARK_RAN">
			<and>
				<not><foreignKeyConstraintExists foreignKeyName="pk_mapid" /></not>
			</and>
	</preConditions>
    
	<addForeignKeyConstraint constraintName="fk_mapid" onDelete="CASCADE"
			baseTableName="element" baseColumnNames="mapid"
			referencedTableName="map" referencedColumnNames="mapid" />
		        
  </changeSet>
  
</databaseChangeLog><commit_msg>update changeSet name so it is easier to tell where it came from in the db<commit_after><?xml version="1.0" encoding="UTF-8"?>
 
<databaseChangeLog
	xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
		http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">

  <changeSet author="dhustace" id="1.7.5-addAlarmFkConstraint">
    <delete tableName="alarms">
      <where>nodeid IS NOT NULL AND nodeid NOT IN (SELECT NODEID FROM NODE)</where>
    </delete>
    
    <addForeignKeyConstraint constraintName="fk_alarms_nodeid" onDelete="CASCADE" baseTableName="alarms"
      baseColumnNames="nodeid" referencedTableName="node" referencedColumnNames="nodeid" />

    <rollback>
      <dropForeignKeyConstraint baseTableName="alarms" constraintName="alarm_nodeid" />
    </rollback>
    
  </changeSet>

 <changeSet author="rssntn67" id="1.7.5-fixMapPkConstraint">
	<preConditions onFail="MARK_RAN">
			<and>
				<not><primaryKeyExists tableName="map" primaryKeyName="pk_mapid" /></not>
			</and>
	</preConditions>
    
	<addPrimaryKey tableName="map" columnNames="mapid" constraintName="pk_mapid"/>        
	<rollback>
		<dropPrimaryKey tableName="map" constraintName="pk_mapid" />
		<modifyColumn tableName="map">
			<column name="mapid" type="integer">
				<constraints nullable="false" />
			</column>
		</modifyColumn>
	</rollback>
 
  </changeSet>
  
   <changeSet author="rssntn67" id="1.7.5-fixElementFkConstraint">
	<preConditions onFail="MARK_RAN">
			<and>
				<not><foreignKeyConstraintExists foreignKeyName="pk_mapid" /></not>
			</and>
	</preConditions>
    
	<addForeignKeyConstraint constraintName="fk_mapid" onDelete="CASCADE"
			baseTableName="element" baseColumnNames="mapid"
			referencedTableName="map" referencedColumnNames="mapid" />
		        
  </changeSet>
  
</databaseChangeLog>

{'fraction_non_alphanumeric': 0.14886901630720673, 'fraction_numerical': 0.01262493424513414, 'mean_word_length': 4.806106870229008, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 2, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2974183', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1314, 'n_words': 194}