IF NOT EXISTS ( SELECT  *
                FROM    sysobjects
                WHERE   name = 'IRI_ContractSettings' )
    BEGIN

        CREATE TABLE [dbo].[IRI_ContractSettings]
            (
              [Id] [INT] IDENTITY(1, 1)
                         NOT NULL ,
              [Name] [NVARCHAR](50) NULL ,
              [FirstCoveredCon] [TINYINT] NULL ,
              [NonInsuredCon] [TINYINT] NULL ,
              [FranchiseCon] [TINYINT] NULL ,
              [SendItemsCon] [TINYINT] NULL ,
              [PatientCon] [TINYINT] NULL ,
              [TransactionId] [SMALLINT] NULL ,
              [IranTechnicalFees] [MONEY] NULL ,
	      [PatientTechnicalFees] [MONEY] NULL ,
              CONSTRAINT [PK_IRI_ContractSettings] PRIMARY KEY CLUSTERED
                ( [Id] ASC )
            )
        ON  [PRIMARY];

	CREATE UNIQUE NONCLUSTERED INDEX [IX_IRI_ContractSettingsName] ON [dbo].[IRI_ContractSettings]
	(
	   [Name] ASC
	) ON [PRIMARY]

        ALTER TABLE [dbo].[IRI_ContractSettings] ADD  CONSTRAINT [DF_IRI_ContractSettings_FirstCoveredCon]  DEFAULT ((0)) FOR [FirstCoveredCon];

        ALTER TABLE [dbo].[IRI_ContractSettings] ADD  CONSTRAINT [DF_IRI_ContractSettings_NonInsuredCon]  DEFAULT ((0)) FOR [NonInsuredCon];

        ALTER TABLE [dbo].[IRI_ContractSettings] ADD  CONSTRAINT [DF_IRI_ContractSettings_FranchiseCon]  DEFAULT ((0)) FOR [FranchiseCon];

        ALTER TABLE [dbo].[IRI_ContractSettings] ADD  CONSTRAINT [DF_IRI_ContractSettings_PatientCon]  DEFAULT ((0)) FOR [PatientCon];

        ALTER TABLE [dbo].[IRI_ContractSettings] ADD  CONSTRAINT [DF_IRI_ContractSettings_TransactionId]  DEFAULT ((0)) FOR [TransactionId];

        ALTER TABLE [dbo].[IRI_ContractSettings] ADD  CONSTRAINT [DF_IRI_ContractSettings_IranTechnicalFees]  DEFAULT ((0)) FOR [IranTechnicalFees];

        ALTER TABLE [dbo].[IRI_ContractSettings] ADD  CONSTRAINT [DF_IRI_ContractSettings_PatientTechnicalFees]  DEFAULT ((0)) FOR [PatientTechnicalFees];
    END; 

