<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.heurekaslu.se/w/index.php?action=history&amp;feed=atom&amp;title=Heureka_database_upgrade_script_0.5.1.1</id>
	<title>Heureka database upgrade script 0.5.1.1 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.heurekaslu.se/w/index.php?action=history&amp;feed=atom&amp;title=Heureka_database_upgrade_script_0.5.1.1"/>
	<link rel="alternate" type="text/html" href="https://www.heurekaslu.se/w/index.php?title=Heureka_database_upgrade_script_0.5.1.1&amp;action=history"/>
	<updated>2026-05-05T20:18:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.13</generator>
	<entry>
		<id>https://www.heurekaslu.se/w/index.php?title=Heureka_database_upgrade_script_0.5.1.1&amp;diff=2780&amp;oldid=prev</id>
		<title>Peder at 13:51, 14 July 2009</title>
		<link rel="alternate" type="text/html" href="https://www.heurekaslu.se/w/index.php?title=Heureka_database_upgrade_script_0.5.1.1&amp;diff=2780&amp;oldid=prev"/>
		<updated>2009-07-14T13:51:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:51, 14 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Heureka database upgrade &lt;/del&gt;scripts | Back to scripts]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:Category:Database &lt;/ins&gt;scripts | Back to scripts]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;IF (SELECT COUNT(*) FROM VERSION WHERE ApplicationVersion = '0.5.1.0' OR ApplicationVersion = '0.5.1.1' ) = 0&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;IF (SELECT COUNT(*) FROM VERSION WHERE ApplicationVersion = '0.5.1.0' OR ApplicationVersion = '0.5.1.1' ) = 0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l57&quot; &gt;Line 57:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 57:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Database]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:Database &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;scripts&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Peder</name></author>
	</entry>
	<entry>
		<id>https://www.heurekaslu.se/w/index.php?title=Heureka_database_upgrade_script_0.5.1.1&amp;diff=1202&amp;oldid=prev</id>
		<title>Cawa2: New page:  Back to scripts &lt;pre&gt; IF (SELECT COUNT(*) FROM VERSION WHERE ApplicationVersion = '0.5.1.0' OR ApplicationVersion = '0.5.1.1' ) = 0 BEGIN 	PRINT 'Wro...</title>
		<link rel="alternate" type="text/html" href="https://www.heurekaslu.se/w/index.php?title=Heureka_database_upgrade_script_0.5.1.1&amp;diff=1202&amp;oldid=prev"/>
		<updated>2009-02-16T14:45:08Z</updated>

		<summary type="html">&lt;p&gt;New page: &lt;a href=&quot;/w/index.php?title=Heureka_database_upgrade_scripts&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Heureka database upgrade scripts (page does not exist)&quot;&gt; Back to scripts&lt;/a&gt; &amp;lt;pre&amp;gt; IF (SELECT COUNT(*) FROM VERSION WHERE ApplicationVersion = &amp;#039;0.5.1.0&amp;#039; OR ApplicationVersion = &amp;#039;0.5.1.1&amp;#039; ) = 0 BEGIN 	PRINT &amp;#039;Wro...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Heureka database upgrade scripts | Back to scripts]]&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IF (SELECT COUNT(*) FROM VERSION WHERE ApplicationVersion = '0.5.1.0' OR ApplicationVersion = '0.5.1.1' ) = 0&lt;br /&gt;
BEGIN&lt;br /&gt;
	PRINT 'Wrong Version of database. You must upgrade to version 0.5.1.0 before running this script.';&lt;br /&gt;
	SELECT ApplicationVersion FROM VERSION;&lt;br /&gt;
END&lt;br /&gt;
ELSE &lt;br /&gt;
BEGIN&lt;br /&gt;
&lt;br /&gt;
	-- 1. Add extended property on database to identify heureka forest databases&lt;br /&gt;
&lt;br /&gt;
	IF NOT EXISTS( SELECT 1 FROM fn_listextendedproperty('Heureka Database Type', default, default, default, default, default, default))&lt;br /&gt;
	BEGIN&lt;br /&gt;
		EXEC sp_addextendedproperty @name = N'Heureka Database Type', @value = 'ForestDatabase';&lt;br /&gt;
	END&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	-- 2. Add columns for to StandObject for number of stems per speciesGroup&lt;br /&gt;
&lt;br /&gt;
	IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'StandObject' AND COLUMN_NAME = 'StemProportionPine')&lt;br /&gt;
	BEGIN&lt;br /&gt;
			ALTER TABLE StandObject ADD&lt;br /&gt;
				[StemProportionPine] [real] NULL,&lt;br /&gt;
				[StemProportionSpruce] [real] NULL,&lt;br /&gt;
				[StemProportionBirch] [real] NULL,&lt;br /&gt;
				[StemProportionAspen] [real] NULL,&lt;br /&gt;
				[StemProportionOak] [real] NULL,&lt;br /&gt;
				[StemProportionBeech] [real] NULL,&lt;br /&gt;
				[StemProportionDeciduous] [real] NULL,&lt;br /&gt;
				[StemProportionContorta] [real] NULL,&lt;br /&gt;
				[StemProportionBroadleaf] [real] NULL&lt;br /&gt;
	END&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	-- 3. Add new columns for to InitialState_ForestData&lt;br /&gt;
&lt;br /&gt;
	IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'InitialState_ForestData' AND COLUMN_NAME = 'BasalAreaWeightedMeanDiameterAll')&lt;br /&gt;
	BEGIN&lt;br /&gt;
		ALTER TABLE [dbo].[InitialState_ForestData] ADD&lt;br /&gt;
			[BasalAreaWeightedMeanDiameterAll] [float] NULL,&lt;br /&gt;
			[BasalAreaWeightedMeanDiameterOverstorey] [float] NULL,&lt;br /&gt;
			[BasalAreaWeightedMeanDiameterExclOverstorey] [float] NULL,&lt;br /&gt;
			[MeanHeightAll] [float] NULL,&lt;br /&gt;
			[MeanHeightOverstorey] [float] NULL,&lt;br /&gt;
			[MeanHeightExclOverstorey] [float] NULL&lt;br /&gt;
	END&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	-- Update Version Table&lt;br /&gt;
&lt;br /&gt;
	UPDATE Version SET ApplicationVersion = '0.5.1.1';&lt;br /&gt;
&lt;br /&gt;
	PRINT 'Success! Database upgrade to version 0.5.1.1';&lt;br /&gt;
&lt;br /&gt;
END&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Cawa2</name></author>
	</entry>
</feed>