text: PRINT N'Create history tables'
  GO
  
  CREATE TABLE [dbo].[PIMS_LEASE_HIST]  (
  	[_LEASE_HIST_ID]                	bigint NOT NULL DEFAULT (NEXT VALUE FOR [PIMS_LEASE_H_ID_SEQ]),
  	[APP_CREATE_TIMESTAMP]          	datetime NOT NULL,
  	[APP_CREATE_USER_DIRECTORY]     	nvarchar(30) NOT NULL,
  	[APP_CREATE_USER_GUID]          	uniqueidentifier NULL,
  	[APP_CREATE_USERID]             	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_TIMESTAMP]     	datetime NOT NULL,
  	[APP_LAST_UPDATE_USER_DIRECTORY]	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_USER_GUID]     	uniqueidentifier NULL,
  	[APP_LAST_UPDATE_USERID]        	nvarchar(30) NOT NULL,
  	[CONCURRENCY_CONTROL_NUMBER]    	bigint NOT NULL,
  	[DB_CREATE_TIMESTAMP]           	datetime NOT NULL,
  	[DB_CREATE_USERID]              	nvarchar(30) NOT NULL,
  	[DB_LAST_UPDATE_TIMESTAMP]      	datetime NOT NULL,
  	[DB_LAST_UPDATE_USERID]         	nvarchar(30) NOT NULL,
  	[EFFECTIVE_DATE_HIST]           	datetime NOT NULL DEFAULT (getutcdate()),
  	[END_DATE_HIST]                 	datetime NULL,
  	[EXPIRED]                       	bit NOT NULL,
  	[EXPIRY_DATE]                   	datetime NULL,
  	[HAS_DIGITAL_FILE]              	bit NOT NULL,
  	[HAS_DIGITAL_LICENSE]           	bit NOT NULL,
  	[HAS_PHYSICAL_FILE]             	bit NOT NULL,
  	[HAS_PHYSICAL_LICENSE]         	bit NOT NULL,
  	[INSPECTION_DATE]               	datetime NULL,
  	[INSPECTION_NOTES]              	nvarchar(4000) NULL,
  	[INSURANCE_END_DATE]            	datetime NULL,
  	[INSURANCE_START_DATE]          	datetime NULL,
  	[L_FILE_NO]                     	nvarchar(50) NULL,
  	[LEASE_AMOUNT]                  	nvarchar(40) NULL,
  	[LEASE_ID]                      	bigint NOT NULL,
  	[LEASE_NOTES]                   	nvarchar(4000) NULL,
  	[LEASE_PMT_FREQ_TYPE_CODE]      	nvarchar(40) NOT NULL,
  	[LEASE_PROGRAM_TYPE_CODE]       	nvarchar(40) NULL,
  	[LEASE_PURPOSE_SUBTYPE_CODE]    	smallint NOT NULL,
  	[LEASE_PURPOSE_TYPE_CODE]       	smallint NOT NULL,
  	[LEASE_STATUS_TYPE_CODE]        	nvarchar(40) NOT NULL,
  	[PROP_MGMT_ORG_ID]              	bigint NULL,
  	[PROPERTY_MANAGER_ID]           	bigint NULL,
  	[PS_FILE_NO]                    	nvarchar(50) NULL,
  	[RENEWAL_DATE]                  	datetime NULL,
  	[SECURITY_END_DATE]             	datetime NULL,
  	[SECURITY_START_DATE]           	datetime NULL,
  	[START_DATE]                    	datetime NULL,
  	[TENANT_ID]                     	bigint NOT NULL,
  	[TFA_FILE_NO]                   	int NULL,
  	[UNIT]                          	nvarchar(2000) NULL,
  	PRIMARY KEY CLUSTERED([_LEASE_HIST_ID])
   ON [PRIMARY])
  
   CREATE TABLE [dbo].[PIMS_PROPERTY_LEASE_HIST]  (
  	[_PROPERTY_LEASE_HIST_ID]       	bigint NOT NULL DEFAULT (NEXT VALUE FOR [PIMS_PROPERTY_LEASE_H_ID_SEQ]),
  	[APP_CREATE_TIMESTAMP]          	datetime NOT NULL,
  	[APP_CREATE_USER_DIRECTORY]     	nvarchar(30) NOT NULL,
  	[APP_CREATE_USER_GUID]          	uniqueidentifier NULL,
  	[APP_CREATE_USERID]             	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_TIMESTAMP]     	datetime NOT NULL,
  	[APP_LAST_UPDATE_USER_DIRECTORY]	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_USER_GUID]     	uniqueidentifier NULL,
  	[APP_LAST_UPDATE_USERID]        	nvarchar(30) NOT NULL,
  	[CONCURRENCY_CONTROL_NUMBER]    	bigint NOT NULL,
  	[DB_CREATE_TIMESTAMP]           	datetime NOT NULL,
  	[DB_CREATE_USERID]              	nvarchar(30) NOT NULL,
  	[DB_LAST_UPDATE_TIMESTAMP]      	datetime NOT NULL,
  	[DB_LAST_UPDATE_USERID]         	nvarchar(30) NOT NULL,
  	[EFFECTIVE_DATE_HIST]           	datetime NOT NULL DEFAULT (getutcdate()),
  	[END_DATE_HIST]                 	datetime NULL,
  	[LEASE_ID]                      	bigint NOT NULL,
  	[PROPERTY_ID]                   	bigint NOT NULL,
  	[PROPERTY_LEASE_ID]             	bigint NOT NULL,
  	PRIMARY KEY CLUSTERED([_PROPERTY_LEASE_HIST_ID])
   ON [PRIMARY])
  
  CREATE TABLE [dbo].[PIMS_EXPECTED_AMOUNT_HIST]  (
  	[_EXPECTED_AMOUNT_HIST_ID]      	bigint NOT NULL DEFAULT (NEXT VALUE FOR [PIMS_EXPECTED_AMOUNT_H_ID_SEQ]),
  	[APP_CREATE_TIMESTAMP]          	datetime NOT NULL,
  	[APP_CREATE_USER_DIRECTORY]     	nvarchar(30) NOT NULL,
  	[APP_CREATE_USER_GUID]          	uniqueidentifier NULL,
  	[APP_CREATE_USERID]             	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_TIMESTAMP]     	datetime NOT NULL,
  	[APP_LAST_UPDATE_USER_DIRECTORY]	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_USER_GUID]     	uniqueidentifier NULL,
  	[APP_LAST_UPDATE_USERID]        	nvarchar(30) NOT NULL,
  	[CONCURRENCY_CONTROL_NUMBER]    	bigint NOT NULL,
  	[DB_CREATE_TIMESTAMP]           	datetime NOT NULL,
  	[DB_CREATE_USERID]              	nvarchar(30) NOT NULL,
  	[DB_LAST_UPDATE_TIMESTAMP]      	datetime NOT NULL,
  	[DB_LAST_UPDATE_USERID]         	nvarchar(30) NOT NULL,
  	[EFFECTIVE_DATE_HIST]           	datetime NOT NULL DEFAULT (getutcdate()),
  	[END_DATE_HIST]                 	datetime NULL,
  	[EXPECTED_AMOUNT]               	money NULL,
  	[EXPECTED_AMOUNT_ID]            	bigint NOT NULL,
  	[LEASE_ACTIVITY_PERIOD_ID]      	bigint NOT NULL,
  	[LEASE_ID]                      	bigint NOT NULL,
  	PRIMARY KEY CLUSTERED([_EXPECTED_AMOUNT_HIST_ID])
   ON [PRIMARY])
  
  CREATE TABLE [dbo].[PIMS_LEASE_ACTIVITY_PERIOD_HIST]  (
  	[_LEASE_ACTIVITY_PERIOD_HIST_ID]	bigint NOT NULL DEFAULT (NEXT VALUE FOR [PIMS_LEASE_ACTIVITY_PERIOD_H_ID_SEQ]),
  	[APP_CREATE_TIMESTAMP]          	datetime NOT NULL,
  	[APP_CREATE_USER_DIRECTORY]     	nvarchar(30) NOT NULL,
  	[APP_CREATE_USER_GUID]          	uniqueidentifier NULL,
  	[APP_CREATE_USERID]             	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_TIMESTAMP]     	datetime NOT NULL,
  	[APP_LAST_UPDATE_USER_DIRECTORY]	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_USER_GUID]     	uniqueidentifier NULL,
  	[APP_LAST_UPDATE_USERID]        	nvarchar(30) NOT NULL,
  	[CONCURRENCY_CONTROL_NUMBER]    	bigint NOT NULL,
  	[DB_CREATE_TIMESTAMP]           	datetime NOT NULL,
  	[DB_CREATE_USERID]              	nvarchar(30) NOT NULL,
  	[DB_LAST_UPDATE_TIMESTAMP]      	datetime NOT NULL,
  	[DB_LAST_UPDATE_USERID]         	nvarchar(30) NOT NULL,
  	[EFFECTIVE_DATE_HIST]           	datetime NOT NULL DEFAULT (getutcdate()),
  	[END_DATE_HIST]                 	datetime NULL,
  	[IS_CLOSED]                     	bit NULL,
  	[LEASE_ACTIVITY_PERIOD_ID]      	bigint NOT NULL,
  	[PERIOD_DATE]                   	datetime NOT NULL,
  	PRIMARY KEY CLUSTERED([_LEASE_ACTIVITY_PERIOD_HIST_ID])
   ON [PRIMARY])
  GO
  
  CREATE TABLE [dbo].[PIMS_LEASE_ACTIVITY_HIST]  (
  	[_LEASE_ACTIVITY_HIST_ID]       	bigint NOT NULL DEFAULT (NEXT VALUE FOR [PIMS_LEASE_ACTIVITY_H_ID_SEQ]),
  	[ACTIVITY_DATE]                 	datetime NULL,
  	[AMOUNT]                        	money NULL,
  	[APP_CREATE_TIMESTAMP]          	datetime NOT NULL,
  	[APP_CREATE_USER_DIRECTORY]     	nvarchar(30) NOT NULL,
  	[APP_CREATE_USER_GUID]          	uniqueidentifier NULL,
  	[APP_CREATE_USERID]             	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_TIMESTAMP]     	datetime NOT NULL,
  	[APP_LAST_UPDATE_USER_DIRECTORY]	nvarchar(30) NOT NULL,
  	[APP_LAST_UPDATE_USER_GUID]     	uniqueidentifier NULL,
  	[APP_LAST_UPDATE_USERID]        	nvarchar(30) NOT NULL,
  	[COMMENT]                       	nvarchar(40) NULL,
  	[CONCURRENCY_CONTROL_NUMBER]    	bigint NOT NULL,
  	[DB_CREATE_TIMESTAMP]           	datetime NOT NULL,
  	[DB_CREATE_USERID]              	nvarchar(30) NOT NULL,
  	[DB_LAST_UPDATE_TIMESTAMP]      	datetime NOT NULL,
  	[DB_LAST_UPDATE_USERID]         	nvarchar(30) NOT NULL,
  	[EFFECTIVE_DATE_HIST]           	datetime NOT NULL DEFAULT (getutcdate()),
  	[END_DATE_HIST]                 	datetime NULL,
  	[LEASE_ACTIVITY_ID]             	bigint NOT NULL,
  	[LEASE_ACTIVITY_PERIOD_ID]      	bigint NOT NULL,
  	[LEASE_ID]                      	bigint NOT NULL,
  	[LEASE_SUBTYPE_CODE]            	nvarchar(20) NOT NULL,
  	[LEASE_TYPE_CODE]               	smallint NOT NULL,
  	PRIMARY KEY CLUSTERED([_LEASE_ACTIVITY_HIST_ID])
   ON [PRIMARY])
  