text: ﻿--
  -- Script was generated by Devart dbForge Studio 2021 for SQL Server, Version 6.0.563.0
  -- Product home page: http://www.devart.com/dbforge/sql/studio
  -- Script date 11/11/2021 1:09:35 AM
  -- Server version: 15.00.2080
  --
  
  
  
  USE Oberon
  GO
  
  IF DB_NAME() <> N'Oberon' SET NOEXEC ON
  GO
  
  --
  -- Create table [tmp].[IntegrationServicesInfo]
  --
  PRINT (N'Create table [tmp].[IntegrationServicesInfo]')
  GO
  CREATE TABLE tmp.IntegrationServicesInfo (
    Id int IDENTITY,
    TableSchema nvarchar(50) NOT NULL,
    TableName nvarchar(50) NOT NULL,
    Script1Part1 nvarchar(4000) NOT NULL,
    Script1Part2 nvarchar(4000) NOT NULL,
    Script1Part3 nvarchar(4000) NOT NULL,
    Script1Part4 nvarchar(4000) NOT NULL,
    LogTableSchema nvarchar(50) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[Websites]
  --
  PRINT (N'Create table [meta].[Websites]')
  GO
  CREATE TABLE meta.Websites (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    Url nvarchar(255) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ValueTypes]
  --
  PRINT (N'Create table [meta].[ValueTypes]')
  GO
  CREATE TABLE meta.ValueTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[TimerTypes]
  --
  PRINT (N'Create table [meta].[TimerTypes]')
  GO
  CREATE TABLE meta.TimerTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(512) NOT NULL,
    NoticeTypeGID uniqueidentifier NULL,
    ActionTypeGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[TimerStatuses]
  --
  PRINT (N'Create table [meta].[TimerStatuses]')
  GO
  CREATE TABLE meta.TimerStatuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[SubscriptionTypes]
  --
  PRINT (N'Create table [meta].[SubscriptionTypes]')
  GO
  CREATE TABLE meta.SubscriptionTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[StatusProperties]
  --
  PRINT (N'Create table [meta].[StatusProperties]')
  GO
  CREATE TABLE meta.StatusProperties (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(250) NOT NULL,
    ValueTypeGID uniqueidentifier NOT NULL,
    DefaultValue sql_variant NULL,
    Explanation ntext NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[StatusParameters]
  --
  PRINT (N'Create table [meta].[StatusParameters]')
  GO
  CREATE TABLE meta.StatusParameters (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL,
    ValueTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[Statuses]
  --
  PRINT (N'Create table [meta].[Statuses]')
  GO
  CREATE TABLE meta.Statuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[Routes]
  --
  PRINT (N'Create table [meta].[Routes]')
  GO
  CREATE TABLE meta.Routes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    IsDeleted bit NOT NULL,
    IsForBranch bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[Roles]
  --
  PRINT (N'Create table [meta].[Roles]')
  GO
  CREATE TABLE meta.Roles (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(70) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ReservationCalculationTypes]
  --
  PRINT (N'Create table [meta].[ReservationCalculationTypes]')
  GO
  CREATE TABLE meta.ReservationCalculationTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(100) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RequirementStatuses]
  --
  PRINT (N'Create table [meta].[RequirementStatuses]')
  GO
  CREATE TABLE meta.RequirementStatuses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RequiredDocumentTypeSourceTypes]
  --
  PRINT (N'Create table [meta].[RequiredDocumentTypeSourceTypes]')
  GO
  CREATE TABLE meta.RequiredDocumentTypeSourceTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RequiredDocumentTypes]
  --
  PRINT (N'Create table [meta].[RequiredDocumentTypes]')
  GO
  CREATE TABLE meta.RequiredDocumentTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NULL,
    SubmitterTypeGID uniqueidentifier NULL,
    IsRequired bit NOT NULL,
    OrderNumber int NULL,
    ExpressionGID uniqueidentifier NULL,
    FileNameTemplate nvarchar(255) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RequiredDocumentTypeDeliveryTypes]
  --
  PRINT (N'Create table [meta].[RequiredDocumentTypeDeliveryTypes]')
  GO
  CREATE TABLE meta.RequiredDocumentTypeDeliveryTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ReinsuranceTypes]
  --
  PRINT (N'Create table [meta].[ReinsuranceTypes]')
  GO
  CREATE TABLE meta.ReinsuranceTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ReinsuranceStatuses]
  --
  PRINT (N'Create table [meta].[ReinsuranceStatuses]')
  GO
  CREATE TABLE meta.ReinsuranceStatuses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ReinsuranceForms]
  --
  PRINT (N'Create table [meta].[ReinsuranceForms]')
  GO
  CREATE TABLE meta.ReinsuranceForms (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ProductTypeAbbreviations]
  --
  PRINT (N'Create table [meta].[ProductTypeAbbreviations]')
  GO
  CREATE TABLE meta.ProductTypeAbbreviations (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ProductTypeGID uniqueidentifier NOT NULL,
    Abbreviation nvarchar(10) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PrintGroupTemplates]
  --
  PRINT (N'Create table [meta].[PrintGroupTemplates]')
  GO
  CREATE TABLE meta.PrintGroupTemplates (
    Id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimPrintGroupGID uniqueidentifier NOT NULL,
    TemplateGID uniqueidentifier NOT NULL,
    TemplateName nvarchar(50) NULL,
    OrderNumber int NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PostIndexes]
  --
  PRINT (N'Create table [meta].[PostIndexes]')
  GO
  CREATE TABLE meta.PostIndexes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Value nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PaymentTypes]
  --
  PRINT (N'Create table [meta].[PaymentTypes]')
  GO
  CREATE TABLE meta.PaymentTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PaymentPurposeTemplates]
  --
  PRINT (N'Create table [meta].[PaymentPurposeTemplates]')
  GO
  CREATE TABLE meta.PaymentPurposeTemplates (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PayableTypes]
  --
  PRINT (N'Create table [meta].[PayableTypes]')
  GO
  CREATE TABLE meta.PayableTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PayableDetailsAdjustmentType]
  --
  PRINT (N'Create table [meta].[PayableDetailsAdjustmentType]')
  GO
  CREATE TABLE meta.PayableDetailsAdjustmentType (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ParticipantTypes]
  --
  PRINT (N'Create table [meta].[ParticipantTypes]')
  GO
  CREATE TABLE meta.ParticipantTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationTypes]
  --
  PRINT (N'Create table [meta].[NotificationTypes]')
  GO
  CREATE TABLE meta.NotificationTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    SourceTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationStatuses]
  --
  PRINT (N'Create table [meta].[NotificationStatuses]')
  GO
  CREATE TABLE meta.NotificationStatuses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(100) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationSourceTypes]
  --
  PRINT (N'Create table [meta].[NotificationSourceTypes]')
  GO
  CREATE TABLE meta.NotificationSourceTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationProperties]
  --
  PRINT (N'Create table [meta].[NotificationProperties]')
  GO
  CREATE TABLE meta.NotificationProperties (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(250) NOT NULL,
    ValueTypeGID uniqueidentifier NOT NULL,
    DefaultValue sql_variant NULL,
    OriginalName nvarchar(50) NULL,
    Explanation ntext NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NoticeTypes]
  --
  PRINT (N'Create table [meta].[NoticeTypes]')
  GO
  CREATE TABLE meta.NoticeTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(512) NOT NULL,
    Template nvarchar(1000) NOT NULL,
    IsSendToAllSubscribers bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NoticeStatuses]
  --
  PRINT (N'Create table [meta].[NoticeStatuses]')
  GO
  CREATE TABLE meta.NoticeStatuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[LitigationSubjects]
  --
  PRINT (N'Create table [meta].[LitigationSubjects]')
  GO
  CREATE TABLE meta.LitigationSubjects (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[LetterTypes]
  --
  PRINT (N'Create table [meta].[LetterTypes]')
  GO
  CREATE TABLE meta.LetterTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[LetterFeatures]
  --
  PRINT (N'Create table [meta].[LetterFeatures]')
  GO
  CREATE TABLE meta.LetterFeatures (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[Expressions]
  --
  PRINT (N'Create table [meta].[Expressions]')
  GO
  CREATE TABLE meta.Expressions (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ExpressionTypeGID uniqueidentifier NOT NULL,
    Name nvarchar(250) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ErrorMessages]
  --
  PRINT (N'Create table [meta].[ErrorMessages]')
  GO
  CREATE TABLE meta.ErrorMessages (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Message nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[DocumentTypesToClaimTypes]')
  GO
  CREATE TABLE meta.DocumentTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    TemplateName nvarchar(50) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypes]
  --
  PRINT (N'Create table [meta].[DocumentTypes]')
  GO
  CREATE TABLE meta.DocumentTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    TemplateName nvarchar(50) NULL,
    ValidationExpression nvarchar(255) NULL,
    InputMessage nvarchar(50) NULL,
    Note nvarchar(255) NULL,
    CanBeAttachedToCase bit NOT NULL,
    CanBePrinted bit NOT NULL,
    IsRegulationCost bit NOT NULL,
    CalculationTypeGID uniqueidentifier NULL,
    PayableTypeGID uniqueidentifier NULL,
    IsRegress bit NOT NULL,
    IsReinsurance bit NOT NULL,
    IsLetter bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypeProperties]
  --
  PRINT (N'Create table [meta].[DocumentTypeProperties]')
  GO
  CREATE TABLE meta.DocumentTypeProperties (
    Id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(250) NULL,
    ValueTypeGID uniqueidentifier NOT NULL,
    DefaultValue sql_variant NULL,
    Explanation ntext NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypeGroups]
  --
  PRINT (N'Create table [meta].[DocumentTypeGroups]')
  GO
  CREATE TABLE meta.DocumentTypeGroups (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentSubmitterTypes]
  --
  PRINT (N'Create table [meta].[DocumentSubmitterTypes]')
  GO
  CREATE TABLE meta.DocumentSubmitterTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentStatuses]
  --
  PRINT (N'Create table [meta].[DocumentStatuses]')
  GO
  CREATE TABLE meta.DocumentStatuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentProcessingStatuses]
  --
  PRINT (N'Create table [meta].[DocumentProcessingStatuses]')
  GO
  CREATE TABLE meta.DocumentProcessingStatuses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentParameters]
  --
  PRINT (N'Create table [meta].[DocumentParameters]')
  GO
  CREATE TABLE meta.DocumentParameters (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    ValueTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DependentEntityTypes]
  --
  PRINT (N'Create table [meta].[DependentEntityTypes]')
  GO
  CREATE TABLE meta.DependentEntityTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL,
    IsCollected bit NOT NULL,
    IsField bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DependentEntityTypeAttributes]
  --
  PRINT (N'Create table [meta].[DependentEntityTypeAttributes]')
  GO
  CREATE TABLE meta.DependentEntityTypeAttributes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    ControlName nvarchar(255) NOT NULL,
    DependentEntityTypeGID uniqueidentifier NOT NULL,
    ValueTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[Currencies]
  --
  PRINT (N'Create table [meta].[Currencies]')
  GO
  CREATE TABLE meta.Currencies (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    Code nvarchar(50) NOT NULL,
    Abbr nvarchar(5) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CourtRulingTypes]
  --
  PRINT (N'Create table [meta].[CourtRulingTypes]')
  GO
  CREATE TABLE meta.CourtRulingTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    Level int NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CommissarExaminationTypes]
  --
  PRINT (N'Create table [meta].[CommissarExaminationTypes]')
  GO
  CREATE TABLE meta.CommissarExaminationTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CommissarExaminationStatuses]
  --
  PRINT (N'Create table [meta].[CommissarExaminationStatuses]')
  GO
  CREATE TABLE meta.CommissarExaminationStatuses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    SecurityTypeGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CommissarExaminationSecurityTypes]
  --
  PRINT (N'Create table [meta].[CommissarExaminationSecurityTypes]')
  GO
  CREATE TABLE meta.CommissarExaminationSecurityTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimTypes]
  --
  PRINT (N'Create table [meta].[ClaimTypes]')
  GO
  CREATE TABLE meta.ClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimTypeProperties]
  --
  PRINT (N'Create table [meta].[ClaimTypeProperties]')
  GO
  CREATE TABLE meta.ClaimTypeProperties (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(250) NULL,
    ValueTypeGID uniqueidentifier NOT NULL,
    DefaultValue sql_variant NULL,
    Explanation ntext NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimPrintGroups]
  --
  PRINT (N'Create table [meta].[ClaimPrintGroups]')
  GO
  CREATE TABLE meta.ClaimPrintGroups (
    Id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL,
    OrderNumber int NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CaseReasons]
  --
  PRINT (N'Create table [meta].[CaseReasons]')
  GO
  CREATE TABLE meta.CaseReasons (
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    id bigint IDENTITY
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CaseHistoryStepStatuses]
  --
  PRINT (N'Create table [meta].[CaseHistoryStepStatuses]')
  GO
  CREATE TABLE meta.CaseHistoryStepStatuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CallReasons]
  --
  PRINT (N'Create table [meta].[CallReasons]')
  GO
  CREATE TABLE meta.CallReasons (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    NotificationTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CallReasonProperties]
  --
  PRINT (N'Create table [meta].[CallReasonProperties]')
  GO
  CREATE TABLE meta.CallReasonProperties (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(250) NOT NULL,
    ValueTypeGID uniqueidentifier NOT NULL,
    DefaultValue sql_variant NULL,
    Explanation ntext NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CalculationTypes]
  --
  PRINT (N'Create table [meta].[CalculationTypes]')
  GO
  CREATE TABLE meta.CalculationTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AuctionTypes]
  --
  PRINT (N'Create table [meta].[AuctionTypes]')
  GO
  CREATE TABLE meta.AuctionTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AssociationValueGroups]
  --
  PRINT (N'Create table [meta].[AssociationValueGroups]')
  GO
  CREATE TABLE meta.AssociationValueGroups (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    AssociationEntityGID uniqueidentifier NOT NULL,
    Name nvarchar(50) NULL,
    IsAllNotIncluded bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AssociationEntities]
  --
  PRINT (N'Create table [meta].[AssociationEntities]')
  GO
  CREATE TABLE meta.AssociationEntities (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DependentEntityTypeGID uniqueidentifier NOT NULL,
    DependentEntityGID uniqueidentifier NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    Name nvarchar(100) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AffectingValueGroups]
  --
  PRINT (N'Create table [meta].[AffectingValueGroups]')
  GO
  CREATE TABLE meta.AffectingValueGroups (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    AffectingEntityGID uniqueidentifier NOT NULL,
    Name nvarchar(50) NULL,
    IsAllNotIncluded bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AddressItemTypes]
  --
  PRINT (N'Create table [meta].[AddressItemTypes]')
  GO
  CREATE TABLE meta.AddressItemTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(100) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AccountStatuses]
  --
  PRINT (N'Create table [meta].[AccountStatuses]')
  GO
  CREATE TABLE meta.AccountStatuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL,
    Description nvarchar(255) NULL,
    [Group] int NOT NULL,
    IsPassable bit NOT NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AccountPurposes]
  --
  PRINT (N'Create table [meta].[AccountPurposes]')
  GO
  CREATE TABLE meta.AccountPurposes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(50) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AccidentReceivingTimes]
  --
  PRINT (N'Create table [meta].[AccidentReceivingTimes]')
  GO
  CREATE TABLE meta.AccidentReceivingTimes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(max) NOT NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Vehicles]
  --
  PRINT (N'Create table [log].[Vehicles]')
  GO
  CREATE TABLE log.Vehicles (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    RegistrationNumber nvarchar(50) NULL,
    AuthorGID uniqueidentifier NULL,
    ModelGID uniqueidentifier NOT NULL,
    ManufacturerGID uniqueidentifier NOT NULL,
    ColorGID uniqueidentifier NULL,
    ColorTypeGID uniqueidentifier NULL,
    OwnerGID uniqueidentifier NULL,
    BodyNumber nvarchar(50) NULL,
    ProducedDate int NULL,
    RegistrationCertificate nvarchar(20) NULL,
    RegistrationDate datetime NULL,
    Cost decimal(18, 2) NULL,
    NumberOfSeats int NULL,
    AnticreepDevice nvarchar(250) NULL,
    AdditionalEquipment nvarchar(250) NULL,
    AuthorizedToManage nvarchar(250) NULL,
    SpecialConditions nvarchar(250) NULL,
    RegistrationPlace nvarchar(100) NULL,
    Mileage decimal(18, 2) NULL,
    Capacity decimal(18, 2) NULL,
    TechDocModel nvarchar(250) NULL,
    SettlementGID uniqueidentifier NULL,
    BodyTypeGID uniqueidentifier NULL,
    EngineTypeGID uniqueidentifier NULL,
    TransmissionTypeGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NULL,
    EngineNumber nvarchar(50) NULL,
    ChasisNumber nvarchar(50) NULL,
    PostAddressGID uniqueidentifier NULL,
    Address nvarchar(255) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Users]
  --
  PRINT (N'Create table [log].[Users]')
  GO
  CREATE TABLE log.Users (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    LastName nvarchar(50) NULL,
    FirstName nvarchar(50) NULL,
    SecondName nvarchar(50) NULL,
    UserName nvarchar(50) NULL,
    BranchGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[SightingDetails]
  --
  PRINT (N'Create table [log].[SightingDetails]')
  GO
  CREATE TABLE log.SightingDetails (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Position nvarchar(255) NULL,
    InsuranceActSighting nvarchar(500) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ServiceStations]
  --
  PRINT (N'Create table [log].[ServiceStations]')
  GO
  CREATE TABLE log.ServiceStations (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(255) NOT NULL,
    PersonTypeID int NOT NULL,
    IdentificationCodeEDRPOU nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Reinsurances]
  --
  PRINT (N'Create table [log].[Reinsurances]')
  GO
  CREATE TABLE log.Reinsurances (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    InsuranceCompanyGID uniqueidentifier NULL,
    ReinsuranceTypeGID uniqueidentifier NULL,
    ReinsuranceFormGID uniqueidentifier NULL,
    PolisNumber nvarchar(50) NULL,
    PolisDate datetime NULL,
    Retention decimal(18, 2) NULL,
    Liability decimal(18, 2) NULL,
    Tariff decimal(18, 2) NULL,
    Premium decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL,
    Notes nvarchar(255) NULL,
    ReinsuranceStatusGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[RegressParticipants]
  --
  PRINT (N'Create table [log].[RegressParticipants]')
  GO
  CREATE TABLE log.RegressParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    RegressGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Regresses]
  --
  PRINT (N'Create table [log].[Regresses]')
  GO
  CREATE TABLE log.Regresses (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    IncomingNumber nvarchar(255) NULL,
    IncomingDate datetime NULL,
    OutgoingNumber nvarchar(255) NULL,
    OutgoingDate datetime NULL,
    Amount decimal(18, 2) NULL,
    IsProperty bit NOT NULL,
    InsuranceCompanyGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    PayableGID uniqueidentifier NULL,
    DamagedProperty nvarchar(255) NULL,
    Notes nvarchar(255) NULL,
    BranchGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[RailRoadObjects]
  --
  PRINT (N'Create table [log].[RailRoadObjects]')
  GO
  CREATE TABLE log.RailRoadObjects (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(255) NOT NULL,
    SerialNumber nvarchar(255) NULL,
    Cost decimal(18, 2) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    Count int NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Products]
  --
  PRINT (N'Create table [log].[Products]')
  GO
  CREATE TABLE log.Products (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ProductTypeGID uniqueidentifier NULL,
    PolisNumber nvarchar(50) NOT NULL,
    AuthorGID uniqueidentifier NULL,
    IsFromBlackWater bit NOT NULL,
    BeginingDate datetime NULL,
    EndingDate datetime NULL,
    RegisteredDate date NULL,
    IsReinsured bit NULL,
    ReinsurancePolisNumber nvarchar(50) NULL,
    BranchGID uniqueidentifier NULL,
    ExternalGID uniqueidentifier NULL,
    InsuredGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PostAddress]
  --
  PRINT (N'Create table [log].[PostAddress]')
  GO
  CREATE TABLE log.PostAddress (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PostCode nvarchar(10) NULL,
    SettlementGID uniqueidentifier NULL,
    Street nvarchar(250) NULL,
    House nvarchar(100) NULL,
    Flat int NULL,
    StreetTypeGID uniqueidentifier NULL,
    Latitude decimal(18, 6) NULL,
    Longitude decimal(18, 6) NULL,
    RegionName nvarchar(250) NULL,
    SettlementName nvarchar(250) NULL,
    AuthorGID uniqueidentifier NOT NULL,
    IsOutsideTheSettlement bit NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PaymentPeriods]
  --
  PRINT (N'Create table [log].[PaymentPeriods]')
  GO
  CREATE TABLE log.PaymentPeriods (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PayableGID uniqueidentifier NOT NULL,
    Amount decimal(18, 2) NOT NULL,
    AccountingDate datetime NULL,
    RefusalDate datetime NULL,
    RefusalReason nvarchar(2000) NULL,
    ExportDate datetime NULL,
    ExportSuccessDate datetime NULL,
    Period datetime NOT NULL,
    Deleted bit NOT NULL,
    CreateDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    OrderNumber int NOT NULL,
    Fixed bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Payables]
  --
  PRINT (N'Create table [log].[Payables]')
  GO
  CREATE TABLE log.Payables (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    MFO nvarchar(255) NULL,
    PaymentAccount nvarchar(255) NULL,
    RecipientGID uniqueidentifier NULL,
    AmountUAH decimal(18, 2) NULL,
    Commission money NULL,
    DateTransferToAccounting datetime NULL,
    PaymentDate datetime NULL,
    Notes nvarchar(255) NULL,
    Deleted bit NOT NULL,
    AmountEuro money NULL,
    Amount money NULL,
    CurrencyTypeGID uniqueidentifier NULL,
    CalculationGID uniqueidentifier NULL,
    AccountStatusGID uniqueidentifier NULL,
    AccountPurposeGID uniqueidentifier NULL,
    AddUserGID uniqueidentifier NULL,
    FolderNumber int NOT NULL,
    ActSignDate datetime NULL,
    IsExported bit NOT NULL,
    ActNumber nvarchar(50) NULL,
    AuthorGID uniqueidentifier NULL,
    RefusalDate datetime NULL,
    RefusalLetterNumber nvarchar(50) NULL,
    RefusalReason nvarchar(2000) NULL,
    RequirementStatusGID uniqueidentifier NULL,
    PaymentPurpose nvarchar(2000) NULL,
    TransferNumber nvarchar(255) NULL,
    CalculationDate datetime NULL,
    ExportDate datetime NULL,
    ExportSuccessDate datetime NULL,
    OrderAccepted bit NOT NULL,
    OrderDate datetime NULL,
    OrderNumber nvarchar(50) NULL,
    PaymentPeriodsCount int NULL,
    PaymentPeriodDate datetime NULL,
    PaymentPeriodAmountFirst decimal(18, 2) NULL,
    PaymentPeriodAmount decimal(18, 2) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PayablePayments]
  --
  PRINT (N'Create table [log].[PayablePayments]')
  GO
  CREATE TABLE log.PayablePayments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PayableGID uniqueidentifier NOT NULL,
    PayableDetailGID uniqueidentifier NULL,
    Amount decimal(18, 2) NULL,
    CompensationAmount decimal(18, 2) NULL,
    CompensationDate datetime NULL,
    PaymentNumber nvarchar(255) NULL,
    OrderNumber nvarchar(255) NULL,
    RefusalReason nvarchar(2000) NULL,
    ReportDate datetime NULL,
    PaymentID nvarchar(255) NULL,
    CreateDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    PaymentPeriodGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PayablePartnerPayableAccounts]
  --
  PRINT (N'Create table [log].[PayablePartnerPayableAccounts]')
  GO
  CREATE TABLE log.PayablePartnerPayableAccounts (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PartnerGID uniqueidentifier NOT NULL,
    AccountGID uniqueidentifier NOT NULL,
    PaymentTypeGID uniqueidentifier NOT NULL,
    RecipientName nvarchar(255) NULL,
    Deleted bit NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PayableParticipants]
  --
  PRINT (N'Create table [log].[PayableParticipants]')
  GO
  CREATE TABLE log.PayableParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    PayableGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PayableDetails]
  --
  PRINT (N'Create table [log].[PayableDetails]')
  GO
  CREATE TABLE log.PayableDetails (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ParentGID uniqueidentifier NULL,
    PayableGID uniqueidentifier NOT NULL,
    OwnerGID uniqueidentifier NULL,
    OwnerName nvarchar(255) NULL,
    RepresentativePayment bit NOT NULL,
    RepresentativeGID uniqueidentifier NULL,
    RepresentativeName nvarchar(255) NULL,
    AttorneyDate datetime NULL,
    AttorneyNumber nvarchar(50) NULL,
    PaymentTypeGID uniqueidentifier NULL,
    PartnerGID uniqueidentifier NULL,
    BankGID uniqueidentifier NULL,
    BankName nvarchar(255) NULL,
    RecipientName nvarchar(255) NULL,
    RecipientIdentificationCode nvarchar(15) NULL,
    BankAccount nvarchar(50) NULL,
    PersonalAccount nvarchar(50) NULL,
    OffsetPolisNumber nvarchar(50) NULL,
    PaymentPurpose nvarchar(255) NULL,
    CreateDate datetime NULL,
    AdjustmentTypeGID uniqueidentifier NULL,
    AdjustmentAccountingDate datetime NULL,
    AdjustmentCancelDate datetime NULL,
    ExportDate datetime NULL,
    ExportSuccessDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    BankMFO nvarchar(10) NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    PaymentPurposeTemplateGID uniqueidentifier NULL,
    RecipientBankName nvarchar(255) NULL,
    RefusalDate datetime NULL,
    RefusalReason nvarchar(2000) NULL,
    RecipientGID uniqueidentifier NULL,
    AccountGID uniqueidentifier NULL,
    ProductGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ObjectsFoto]
  --
  PRINT (N'Create table [log].[ObjectsFoto]')
  GO
  CREATE TABLE log.ObjectsFoto (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ObjectGID uniqueidentifier NOT NULL,
    FileGID uniqueidentifier NOT NULL,
    Name nvarchar(256) NOT NULL,
    IsImage bit NOT NULL,
    Width int NULL,
    Height int NULL,
    ObjectFotoSiteGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    DocumentGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    CreatedDate datetime NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Objects]
  --
  PRINT (N'Create table [log].[Objects]')
  GO
  CREATE TABLE log.Objects (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    CountryGID uniqueidentifier NULL,
    Comment nvarchar(max) NULL,
    CreatorUserGID uniqueidentifier NULL,
    CreateDate datetime NULL,
    LastModifiedAuthorGID uniqueidentifier NULL,
    LastModifiedDate datetime NULL,
    OriginalGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ObjectDocuments]
  --
  PRINT (N'Create table [log].[ObjectDocuments]')
  GO
  CREATE TABLE log.ObjectDocuments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(50) NOT NULL,
    Number nvarchar(50) NOT NULL,
    StartDate datetime NULL,
    EndDate datetime NULL,
    IssuedDate date NULL,
    IssuedBy nvarchar(200) NULL,
    ObjectGID uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    IsActive bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[NotificationStatusChanges]
  --
  PRINT (N'Create table [log].[NotificationStatusChanges]')
  GO
  CREATE TABLE log.NotificationStatusChanges (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    NotificationGID uniqueidentifier NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    CreatorUserGID uniqueidentifier NOT NULL,
    CreatedDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Comment nvarchar(max) NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Notifications]
  --
  PRINT (N'Create table [log].[Notifications]')
  GO
  CREATE TABLE log.Notifications (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ContactPhone nvarchar(50) NULL,
    EventPostAddressGID uniqueidentifier NULL,
    EventAddress nvarchar(255) NULL,
    ProductGID uniqueidentifier NULL,
    PolisNumber nvarchar(50) NULL,
    RiskGID uniqueidentifier NULL,
    EventDescription nvarchar(max) NULL,
    DamageDescription nvarchar(max) NULL,
    Comment nvarchar(max) NULL,
    CreateDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    InsurerGID uniqueidentifier NULL,
    NotifierGID uniqueidentifier NULL,
    InsuranceObjectGID uniqueidentifier NULL,
    InsuranceObjectDescription nvarchar(max) NULL,
    EventDate datetime NULL,
    CountryGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    ContractGID uniqueidentifier NULL,
    RecipientGID uniqueidentifier NULL,
    TicketGID uniqueidentifier NULL,
    CommissarGID uniqueidentifier NULL,
    SourceTypeGID uniqueidentifier NOT NULL,
    NotificationTypeGID uniqueidentifier NULL,
    CallReasonGID uniqueidentifier NULL,
    CaseGID uniqueidentifier NULL,
    CaseNumbers nvarchar(max) NULL,
    ParticipantFaceNames nvarchar(max) NULL,
    ParticipantObjectNames nvarchar(max) NULL,
    ResponsibilityArea nvarchar(255) NULL,
    AppealType nvarchar(255) NULL,
    AppealContent nvarchar(255) NULL,
    RequirementNumber nvarchar(255) NULL,
    InputNumber nvarchar(255) NULL,
    ReceiptDate datetime NULL,
    DeclarantName nvarchar(255) NULL,
    PropertyRequirements bit NULL,
    ResponseNumber nvarchar(255) NULL,
    ResponseDate datetime NULL,
    WithoutClaimType bit NOT NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[NotificationParticipants]
  --
  PRINT (N'Create table [log].[NotificationParticipants]')
  GO
  CREATE TABLE log.NotificationParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    NotificationGID uniqueidentifier NOT NULL,
    Name nvarchar(255) NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Notices]
  --
  PRINT (N'Create table [log].[Notices]')
  GO
  CREATE TABLE log.Notices (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    Date datetime NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    Subject nvarchar(255) NOT NULL,
    Body nvarchar(1000) NOT NULL,
    UserGID uniqueidentifier NULL,
    EntityGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Marines]
  --
  PRINT (N'Create table [log].[Marines]')
  GO
  CREATE TABLE log.Marines (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(50) NOT NULL,
    RegistrationNumber nvarchar(50) NULL,
    Port nvarchar(50) NULL,
    ProducedDate datetime NULL,
    CrewCount int NULL,
    PassengersCount int NULL,
    Height decimal(18, 2) NULL,
    Width decimal(18, 2) NULL,
    Manufacturer nvarchar(50) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    Cost decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Letters]
  --
  PRINT (N'Create table [log].[Letters]')
  GO
  CREATE TABLE log.Letters (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    AddUserGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    LetterTypeGID uniqueidentifier NULL,
    Date datetime NULL,
    Notes nvarchar(2000) NULL,
    IsCanceled bit NOT NULL,
    LetterFeatureGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[LetterParticipants]
  --
  PRINT (N'Create table [log].[LetterParticipants]')
  GO
  CREATE TABLE log.LetterParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    LetterGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[InsuranceObjects]
  --
  PRINT (N'Create table [log].[InsuranceObjects]')
  GO
  CREATE TABLE log.InsuranceObjects (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ObjectCategory nvarchar(50) NULL,
    InsuranceObjectTypeGID uniqueidentifier NULL,
    Comment nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    InsuranceSum decimal(18, 2) NULL,
    InsurancePayment decimal(18, 2) NULL,
    InsuranceRate decimal(18, 10) NULL,
    AuthorGID uniqueidentifier NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(900) NULL,
    CalculatedInsuranceRate decimal(18, 10) NULL,
    CalculatedPayment decimal(18, 2) NULL,
    ParentInsuranceObjectGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[InsuranceActs]
  --
  PRINT (N'Create table [log].[InsuranceActs]')
  GO
  CREATE TABLE log.InsuranceActs (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Number nvarchar(255) NULL,
    Date datetime NULL,
    Sum decimal(18, 2) NULL,
    ReceiverGID uniqueidentifier NULL,
    IsFullPaid bit NULL,
    FullyPaidDate datetime NULL,
    IsSentForPayment bit NULL,
    SetForPaymentDate datetime NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Faces]
  --
  PRINT (N'Create table [log].[Faces]')
  GO
  CREATE TABLE log.Faces (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(255) NOT NULL,
    AuthorGID uniqueidentifier NULL,
    PersonTypeID bigint NOT NULL,
    FullNameEnglish nvarchar(255) NULL,
    IdentificationCode nvarchar(15) NULL,
    Profession nvarchar(255) NULL,
    Address nvarchar(255) NULL,
    ActualAddress nvarchar(255) NULL,
    PhoneNumber nvarchar(30) NULL,
    Fax nvarchar(30) NULL,
    AdditionalContactInfo nvarchar(255) NULL,
    Email nvarchar(130) NULL,
    PostAddressGID uniqueidentifier NULL,
    PostActualAddressGID uniqueidentifier NULL,
    ActivityGID uniqueidentifier NULL,
    WebAddress nvarchar(50) NULL,
    PhoneNumberAdditional nvarchar(30) NULL,
    MobilePhoneNumber nvarchar(30) NULL,
    HomePhoneNumber nvarchar(30) NULL,
    WorkPhoneNumber nvarchar(30) NULL,
    FullName nvarchar(255) NULL,
    ParentGID uniqueidentifier NULL,
    EDRPOU nvarchar(15) NULL,
    IsResponsible bit NULL,
    Firstname nvarchar(50) NULL,
    Secondname nvarchar(50) NULL,
    Lastname nvarchar(50) NULL,
    IsMan bit NULL,
    Birthdate datetime NULL,
    DriverFrom int NULL,
    GenitiveName nvarchar(255) NULL,
    GenitivePost nvarchar(255) NULL,
    Post nvarchar(255) NULL,
    FaceID nvarchar(15) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ExpertAppraisers]
  --
  PRINT (N'Create table [log].[ExpertAppraisers]')
  GO
  CREATE TABLE log.ExpertAppraisers (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(255) NOT NULL,
    PersonTypeID int NOT NULL,
    IdentificationCodeEDRPOU nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Events]
  --
  PRINT (N'Create table [log].[Events]')
  GO
  CREATE TABLE log.Events (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Date datetime NULL,
    CountryGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    Address nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL,
    Comment nvarchar(255) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[EventParticipants]
  --
  PRINT (N'Create table [log].[EventParticipants]')
  GO
  CREATE TABLE log.EventParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    EventGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[EventDepartures]
  --
  PRINT (N'Create table [log].[EventDepartures]')
  GO
  CREATE TABLE log.EventDepartures (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    Date datetime NOT NULL,
    AccidentReceivingTimeGID uniqueidentifier NOT NULL,
    IsDefrauded bit NULL,
    PostAddressGID uniqueidentifier NOT NULL,
    Address nvarchar(255) NULL,
    ReportDate datetime NULL,
    Comment nvarchar(max) NULL,
    MobileCommissarGID uniqueidentifier NOT NULL,
    CreateDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Estates]
  --
  PRINT (N'Create table [log].[Estates]')
  GO
  CREATE TABLE log.Estates (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(450) NOT NULL,
    OwnerGID uniqueidentifier NOT NULL,
    Address nvarchar(255) NULL,
    Cost decimal(18, 2) NULL,
    AcquisitionReason nvarchar(50) NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Documents]
  --
  PRINT (N'Create table [log].[Documents]')
  GO
  CREATE TABLE log.Documents (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(255) NOT NULL,
    Serial nvarchar(50) NULL,
    Number nvarchar(255) NOT NULL,
    StartDate datetime NULL,
    EndDate datetime NULL,
    IssuedDate date NULL,
    IssuedBy nvarchar(200) NULL,
    ObjectGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NULL,
    Type nvarchar(255) NULL,
    IsLockedOut bit NOT NULL,
    AddDate datetime NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    AutoGeneratNumbere bigint NULL,
    WorkflowGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[DigitalCopies]
  --
  PRINT (N'Create table [log].[DigitalCopies]')
  GO
  CREATE TABLE log.DigitalCopies (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    DocumentGID uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    IsImage bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CourtRulings]
  --
  PRINT (N'Create table [log].[CourtRulings]')
  GO
  CREATE TABLE log.CourtRulings (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AmountToLevy money NOT NULL,
    AmountToPayout money NULL,
    Fine money NULL,
    Inflation money NULL,
    ThreeProc money NULL,
    MoralInjury money NULL,
    CourtFee money NULL,
    ForcedAbscence money NULL,
    WageIndexing money NULL,
    Other money NULL,
    Comment nvarchar(255) NULL,
    RulingDate datetime NOT NULL,
    RulingResult nvarchar(500) NOT NULL,
    RulingTypeGID uniqueidentifier NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CourtHearings]
  --
  PRINT (N'Create table [log].[CourtHearings]')
  GO
  CREATE TABLE log.CourtHearings (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CourtCaseGID uniqueidentifier NOT NULL,
    DateOfHearing datetime NOT NULL,
    Comment nvarchar(255) NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Contracts]
  --
  PRINT (N'Create table [log].[Contracts]')
  GO
  CREATE TABLE log.Contracts (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ContractNumber nvarchar(50) NOT NULL,
    ContragentGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ConstructionLoadingWorks]
  --
  PRINT (N'Create table [log].[ConstructionLoadingWorks]')
  GO
  CREATE TABLE log.ConstructionLoadingWorks (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(255) NOT NULL,
    Purpose nvarchar(255) NULL,
    Location nvarchar(255) NULL,
    Cost decimal(18, 2) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CommissarExaminations]
  --
  PRINT (N'Create table [log].[CommissarExaminations]')
  GO
  CREATE TABLE log.CommissarExaminations (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    Number nvarchar(50) NOT NULL,
    Date datetime NULL,
    PostAddressGID uniqueidentifier NULL,
    Address nvarchar(255) NULL,
    MobileCommissarGID uniqueidentifier NULL,
    ActualDate datetime NULL,
    IsFinished bit NULL,
    Notes nvarchar(1024) NULL,
    BackToDirectionDate datetime NULL,
    AttachedToCaseDate datetime NULL,
    SentToAccountsCenterDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    ActualPostAddressGID uniqueidentifier NULL,
    ActualAddress nvarchar(255) NULL,
    ObjectName nvarchar(255) NOT NULL,
    ObjectGID uniqueidentifier NULL,
    SecurityTypeGID uniqueidentifier NOT NULL,
    ServiceStationGID uniqueidentifier NULL,
    BranchGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    ExpertAppraiserGID uniqueidentifier NULL,
    CreateDate datetime NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CommissarExaminationParticipants]
  --
  PRINT (N'Create table [log].[CommissarExaminationParticipants]')
  GO
  CREATE TABLE log.CommissarExaminationParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    CommissarExaminationGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Claims]
  --
  PRINT (N'Create table [log].[Claims]')
  GO
  CREATE TABLE log.Claims (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ClaimerGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NOT NULL,
    DateWriting datetime NULL,
    Notes nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL,
    RiskGID uniqueidentifier NULL,
    InsurerGID uniqueidentifier NULL,
    InsuranceObjectGID uniqueidentifier NULL,
    RecipientGID uniqueidentifier NULL,
    ProgramTypeGID uniqueidentifier NOT NULL,
    OwnerPostAddressGID uniqueidentifier NULL,
    IsVipClient bit NOT NULL,
    InsuranceSum decimal(18, 2) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ClaimParticipants]
  --
  PRINT (N'Create table [log].[ClaimParticipants]')
  GO
  CREATE TABLE log.ClaimParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    ClaimGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Cases]
  --
  PRINT (N'Create table [log].[Cases]')
  GO
  CREATE TABLE log.Cases (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Number nvarchar(255) NOT NULL,
    InnerNumber nvarchar(50) NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    ResponsibleGID uniqueidentifier NOT NULL,
    Year int NOT NULL,
    EventGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NULL,
    IsRegressPossible bit NULL,
    AddDate datetime NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    PinCode nvarchar(7) NULL,
    Executor nvarchar(255) NULL,
    ForumTopicGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    WorkflowGID uniqueidentifier NULL,
    PolisNumber nvarchar(max) NULL,
    InsuredName nvarchar(max) NULL,
    InsuredObjectName nvarchar(max) NULL,
    ParticipantFaceNames nvarchar(max) NULL,
    ParticipantObjectNames nvarchar(max) NULL,
    LastModifiedAuthorGID uniqueidentifier NULL,
    LastModifiedDate datetime NULL,
    Deleted bit NOT NULL,
    CreateDate datetime NOT NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseHistorySteps]
  --
  PRINT (N'Create table [log].[CaseHistorySteps]')
  GO
  CREATE TABLE log.CaseHistorySteps (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NULL,
    UserGID uniqueidentifier NULL,
    DocumentStatusGID uniqueidentifier NULL,
    StatusGID uniqueidentifier NOT NULL,
    Comment nvarchar(500) NULL,
    AuthorGID uniqueidentifier NULL,
    AddDate datetime NULL,
    AddUserGID uniqueidentifier NULL,
    BranchGID uniqueidentifier NULL,
    Date datetime NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseComments]
  --
  PRINT (N'Create table [log].[CaseComments]')
  GO
  CREATE TABLE log.CaseComments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    Content nvarchar(max) NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Cargos]
  --
  PRINT (N'Create table [log].[Cargos]')
  GO
  CREATE TABLE log.Cargos (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(255) NOT NULL,
    Valume nvarchar(255) NULL,
    IsPacked bit NULL,
    PackName nvarchar(50) NULL,
    TransportationVehicleGID uniqueidentifier NULL,
    TransportationVehicleName nvarchar(255) NULL,
    SendDate datetime NULL,
    ReceiveDate datetime NULL,
    OwnerGID uniqueidentifier NOT NULL,
    TransportDocument nvarchar(255) NULL,
    TransportationRoute nvarchar(255) NULL,
    UnitCost decimal(18, 2) NULL,
    SeatsNumber int NULL,
    Cost decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Calculations]
  --
  PRINT (N'Create table [log].[Calculations]')
  GO
  CREATE TABLE log.Calculations (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    RecipientGID uniqueidentifier NULL,
    PrintDate datetime NULL,
    PrintUserGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    CommissarExaminationGID uniqueidentifier NULL,
    CostWork decimal NULL,
    Materials decimal(18, 2) NULL,
    CostRepair decimal(18, 2) NULL,
    DamageWear decimal(18, 2) NULL,
    ObjectName nvarchar(255) NULL,
    Parts decimal(18, 2) NULL,
    DocumentStatus nvarchar(255) NULL,
    OrganizationExpert nvarchar(255) NULL,
    DamageAmount decimal(18, 2) NULL,
    AgreementType nvarchar(255) NULL,
    AgreementAmount decimal(18, 2) NULL,
    CalculationTypeGID uniqueidentifier NOT NULL,
    ServiceStationGID uniqueidentifier NULL,
    ExpertAppraiserGID uniqueidentifier NULL,
    BranchGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CalculationParticipants]
  --
  PRINT (N'Create table [log].[CalculationParticipants]')
  GO
  CREATE TABLE log.CalculationParticipants (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    CalculationGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Branches]
  --
  PRINT (N'Create table [log].[Branches]')
  GO
  CREATE TABLE log.Branches (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Code nvarchar(10) NULL,
    Name nvarchar(255) NOT NULL,
    PhoneNumber nvarchar(50) NULL,
    OrganizationGID uniqueidentifier NULL,
    ParentGID uniqueidentifier NULL,
    BranchCode nvarchar(50) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[AuthorityNotifications]
  --
  PRINT (N'Create table [log].[AuthorityNotifications]')
  GO
  CREATE TABLE log.AuthorityNotifications (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    NotificationGID uniqueidentifier NULL,
    FaceGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    Date datetime NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    ClaimGID uniqueidentifier NULL,
    EventGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Auctions]
  --
  PRINT (N'Create table [log].[Auctions]')
  GO
  CREATE TABLE log.Auctions (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    IsActive bit NULL,
    StartDate datetime NULL,
    StartPrice decimal(18, 2) NULL,
    EndDate datetime NULL,
    Result decimal(18, 2) NULL,
    WinnerWebsiteGID uniqueidentifier NULL,
    AreDocumentsAvailable bit NULL,
    CaseGID uniqueidentifier NOT NULL,
    IsNotifiedAboutEndDateApproached bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NULL,
    CalculationDate datetime NULL,
    ProtocolNumber nvarchar(255) NULL,
    ProtocolDate datetime NULL,
    CalculationGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Animals]
  --
  PRINT (N'Create table [log].[Animals]')
  GO
  CREATE TABLE log.Animals (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(50) NOT NULL,
    Age nvarchar(50) NULL,
    SuitAndSigns nvarchar(250) NULL,
    Weight decimal(18, 2) NULL,
    Cost decimal(18, 2) NULL,
    Address nvarchar(250) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Airs]
  --
  PRINT (N'Create table [log].[Airs]')
  GO
  CREATE TABLE log.Airs (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(50) NOT NULL,
    StateAndRegistrationMarks nvarchar(50) NULL,
    ProducedDate int NULL,
    SerialNumber nvarchar(50) NULL,
    AirportBased nvarchar(50) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    OperatorGID uniqueidentifier NOT NULL,
    MaximumPassengers int NULL,
    MaximumTakeOffWeight decimal(18, 2) NULL,
    MaximumCapacity decimal(18, 2) NULL,
    Cost decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Agricultures]
  --
  PRINT (N'Create table [log].[Agricultures]')
  GO
  CREATE TABLE log.Agricultures (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Name nvarchar(50) NOT NULL,
    UnitCost decimal(18, 2) NULL,
    InsuranceYield decimal(18, 2) NULL,
    AverageYield decimal(18, 2) NULL,
    InsuranceCover decimal(5, 2) NULL,
    CropsArea decimal(18, 2) NULL,
    Address nvarchar(255) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Accounts]
  --
  PRINT (N'Create table [log].[Accounts]')
  GO
  CREATE TABLE log.Accounts (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AccountNumber nvarchar(50) NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    FaceGID uniqueidentifier NOT NULL,
    BankGID uniqueidentifier NOT NULL,
    ParentGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Vehicles]
  --
  PRINT (N'Create table [dbo].[Vehicles]')
  GO
  CREATE TABLE dbo.Vehicles (
    gid uniqueidentifier NOT NULL,
    RegistrationNumber nvarchar(50) NULL,
    id bigint IDENTITY,
    AuthorGID uniqueidentifier NULL,
    ModelGID uniqueidentifier NOT NULL,
    ManufacturerGID uniqueidentifier NOT NULL,
    ColorGID uniqueidentifier NULL,
    ColorTypeGID uniqueidentifier NULL,
    OwnerGID uniqueidentifier NULL,
    BodyNumber nvarchar(50) NULL,
    ProducedDate int NULL,
    RegistrationCertificate nvarchar(20) NULL,
    RegistrationDate datetime NULL,
    Cost decimal(18, 2) NULL,
    NumberOfSeats int NULL,
    AnticreepDevice nvarchar(250) NULL,
    AdditionalEquipment nvarchar(250) NULL,
    AuthorizedToManage nvarchar(250) NULL,
    SpecialConditions nvarchar(250) NULL,
    RegistrationPlace nvarchar(100) NULL,
    Mileage decimal(18, 2) NULL,
    Capacity decimal(18, 2) NULL,
    TechDocModel nvarchar(250) NULL,
    SettlementGID uniqueidentifier NULL,
    BodyTypeGID uniqueidentifier NULL,
    EngineTypeGID uniqueidentifier NULL,
    TransmissionTypeGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NULL,
    EngineNumber nvarchar(50) NULL,
    ChasisNumber nvarchar(50) NULL,
    PostAddressGID uniqueidentifier NULL,
    Address nvarchar(255) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Users]
  --
  PRINT (N'Create table [dbo].[Users]')
  GO
  CREATE TABLE dbo.Users (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    LastName nvarchar(50) NULL,
    FirstName nvarchar(50) NULL,
    SecondName nvarchar(50) NULL,
    UserName nvarchar(50) NULL,
    BranchGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[SightingDetails]
  --
  PRINT (N'Create table [dbo].[SightingDetails]')
  GO
  CREATE TABLE dbo.SightingDetails (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Position nvarchar(255) NULL,
    InsuranceActSighting nvarchar(500) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ServiceStations]
  --
  PRINT (N'Create table [dbo].[ServiceStations]')
  GO
  CREATE TABLE dbo.ServiceStations (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    PersonTypeID int NOT NULL,
    IdentificationCodeEDRPOU nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Reinsurances]
  --
  PRINT (N'Create table [dbo].[Reinsurances]')
  GO
  CREATE TABLE dbo.Reinsurances (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    InsuranceCompanyGID uniqueidentifier NULL,
    ReinsuranceTypeGID uniqueidentifier NULL,
    ReinsuranceFormGID uniqueidentifier NULL,
    PolisNumber nvarchar(50) NULL,
    PolisDate datetime NULL,
    Retention decimal(18, 2) NULL,
    Liability decimal(18, 2) NULL,
    Tariff decimal(18, 2) NULL,
    Premium decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL,
    Notes nvarchar(255) NULL,
    ReinsuranceStatusGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[RegressParticipants]
  --
  PRINT (N'Create table [dbo].[RegressParticipants]')
  GO
  CREATE TABLE dbo.RegressParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    TypeGID uniqueidentifier NOT NULL,
    RegressGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Regresses]
  --
  PRINT (N'Create table [dbo].[Regresses]')
  GO
  CREATE TABLE dbo.Regresses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    IncomingNumber nvarchar(255) NULL,
    IncomingDate datetime NULL,
    OutgoingNumber nvarchar(255) NULL,
    OutgoingDate datetime NULL,
    Amount decimal(18, 2) NULL,
    IsProperty bit NOT NULL,
    InsuranceCompanyGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    PayableGID uniqueidentifier NULL,
    DamagedProperty nvarchar(255) NULL,
    Notes nvarchar(255) NULL,
    BranchGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[RailRoadObjects]
  --
  PRINT (N'Create table [dbo].[RailRoadObjects]')
  GO
  CREATE TABLE dbo.RailRoadObjects (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    SerialNumber nvarchar(255) NULL,
    Cost decimal(18, 2) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    Count int NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Products]
  --
  PRINT (N'Create table [dbo].[Products]')
  GO
  CREATE TABLE dbo.Products (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ProductTypeGID uniqueidentifier NULL,
    PolisNumber nvarchar(50) NOT NULL,
    AuthorGID uniqueidentifier NULL,
    IsFromBlackWater bit NOT NULL,
    BeginingDate datetime NULL,
    EndingDate datetime NULL,
    RegisteredDate date NULL,
    IsReinsured bit NULL,
    ReinsurancePolisNumber nvarchar(50) NULL,
    BranchGID uniqueidentifier NULL,
    ExternalGID uniqueidentifier NULL,
    InsuredGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PostAddress]
  --
  PRINT (N'Create table [dbo].[PostAddress]')
  GO
  CREATE TABLE dbo.PostAddress (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    PostCode nvarchar(10) NULL,
    SettlementGID uniqueidentifier NULL,
    Street nvarchar(250) NULL,
    House nvarchar(100) NULL,
    Flat int NULL,
    StreetTypeGID uniqueidentifier NULL,
    Latitude decimal(18, 6) NULL,
    Longitude decimal(18, 6) NULL,
    RegionName nvarchar(250) NULL,
    SettlementName nvarchar(250) NULL,
    AuthorGID uniqueidentifier NOT NULL,
    IsOutsideTheSettlement bit NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PaymentPeriods]
  --
  PRINT (N'Create table [dbo].[PaymentPeriods]')
  GO
  CREATE TABLE dbo.PaymentPeriods (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    PayableGID uniqueidentifier NOT NULL,
    Amount decimal(18, 2) NOT NULL,
    AccountingDate datetime NULL,
    RefusalDate datetime NULL,
    RefusalReason nvarchar(2000) NULL,
    ExportDate datetime NULL,
    ExportSuccessDate datetime NULL,
    Period datetime NOT NULL,
    Deleted bit NOT NULL,
    CreateDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    OrderNumber int NOT NULL,
    Fixed bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Payables]
  --
  PRINT (N'Create table [dbo].[Payables]')
  GO
  CREATE TABLE dbo.Payables (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    MFO nvarchar(255) NULL,
    PaymentAccount nvarchar(255) NULL,
    RecipientGID uniqueidentifier NULL,
    AmountUAH decimal(18, 2) NULL,
    Commission money NULL,
    DateTransferToAccounting datetime NULL,
    PaymentDate datetime NULL,
    Notes nvarchar(255) NULL,
    Deleted bit NOT NULL,
    AmountEuro money NULL,
    Amount money NULL,
    CurrencyTypeGID uniqueidentifier NULL,
    CalculationGID uniqueidentifier NULL,
    AccountStatusGID uniqueidentifier NULL,
    AccountPurposeGID uniqueidentifier NULL,
    AddUserGID uniqueidentifier NULL,
    FolderNumber int NOT NULL,
    ActSignDate datetime NULL,
    IsExported bit NOT NULL,
    ActNumber nvarchar(50) NULL,
    AuthorGID uniqueidentifier NULL,
    RefusalDate datetime NULL,
    RefusalLetterNumber nvarchar(50) NULL,
    RefusalReason nvarchar(2000) NULL,
    RequirementStatusGID uniqueidentifier NULL,
    PaymentPurpose nvarchar(2000) NULL,
    TransferNumber nvarchar(255) NULL,
    CalculationDate datetime NULL,
    ExportDate datetime NULL,
    ExportSuccessDate datetime NULL,
    OrderAccepted bit NOT NULL,
    OrderDate datetime NULL,
    OrderNumber nvarchar(50) NULL,
    PaymentPeriodsCount int NULL,
    PaymentPeriodDate datetime NULL,
    PaymentPeriodAmountFirst decimal(18, 2) NULL,
    PaymentPeriodAmount decimal(18, 2) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PayablePayments]
  --
  PRINT (N'Create table [dbo].[PayablePayments]')
  GO
  CREATE TABLE dbo.PayablePayments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    PayableGID uniqueidentifier NOT NULL,
    PayableDetailGID uniqueidentifier NULL,
    Amount decimal(18, 2) NULL,
    CompensationAmount decimal(18, 2) NULL,
    CompensationDate datetime NULL,
    PaymentNumber nvarchar(255) NULL,
    OrderNumber nvarchar(255) NULL,
    RefusalReason nvarchar(2000) NULL,
    ReportDate datetime NULL,
    PaymentID nvarchar(255) NULL,
    CreateDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    PaymentPeriodGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PayablePartnerPayableAccounts]
  --
  PRINT (N'Create table [dbo].[PayablePartnerPayableAccounts]')
  GO
  CREATE TABLE dbo.PayablePartnerPayableAccounts (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    PartnerGID uniqueidentifier NOT NULL,
    AccountGID uniqueidentifier NOT NULL,
    PaymentTypeGID uniqueidentifier NOT NULL,
    RecipientName nvarchar(255) NULL,
    Deleted bit NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PayableParticipants]
  --
  PRINT (N'Create table [dbo].[PayableParticipants]')
  GO
  CREATE TABLE dbo.PayableParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    PayableGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PayableDetails]
  --
  PRINT (N'Create table [dbo].[PayableDetails]')
  GO
  CREATE TABLE dbo.PayableDetails (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ParentGID uniqueidentifier NULL,
    PayableGID uniqueidentifier NOT NULL,
    OwnerGID uniqueidentifier NULL,
    OwnerName nvarchar(255) NULL,
    RepresentativePayment bit NOT NULL,
    RepresentativeGID uniqueidentifier NULL,
    RepresentativeName nvarchar(255) NULL,
    AttorneyDate datetime NULL,
    AttorneyNumber nvarchar(50) NULL,
    PaymentTypeGID uniqueidentifier NULL,
    PartnerGID uniqueidentifier NULL,
    BankGID uniqueidentifier NULL,
    BankName nvarchar(255) NULL,
    RecipientName nvarchar(255) NULL,
    RecipientIdentificationCode nvarchar(15) NULL,
    BankAccount nvarchar(50) NULL,
    PersonalAccount nvarchar(50) NULL,
    OffsetPolisNumber nvarchar(50) NULL,
    PaymentPurpose nvarchar(255) NULL,
    CreateDate datetime NULL,
    AdjustmentTypeGID uniqueidentifier NULL,
    AdjustmentAccountingDate datetime NULL,
    AdjustmentCancelDate datetime NULL,
    ExportDate datetime NULL,
    ExportSuccessDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    BankMFO nvarchar(10) NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    PaymentPurposeTemplateGID uniqueidentifier NULL,
    RecipientBankName nvarchar(255) NULL,
    RefusalDate datetime NULL,
    RefusalReason nvarchar(2000) NULL,
    RecipientGID uniqueidentifier NULL,
    AccountGID uniqueidentifier NULL,
    ProductGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ObjectsFoto]
  --
  PRINT (N'Create table [dbo].[ObjectsFoto]')
  GO
  CREATE TABLE dbo.ObjectsFoto (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ObjectGID uniqueidentifier NOT NULL,
    FileGID uniqueidentifier NOT NULL,
    Name nvarchar(256) NOT NULL,
    IsImage bit NOT NULL,
    Width int NULL,
    Height int NULL,
    ObjectFotoSiteGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    DocumentGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    CreatedDate datetime NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Objects]
  --
  PRINT (N'Create table [dbo].[Objects]')
  GO
  CREATE TABLE dbo.Objects (
    gid uniqueidentifier NOT NULL,
    id bigint IDENTITY,
    AuthorGID uniqueidentifier NULL,
    CountryGID uniqueidentifier NULL,
    Comment nvarchar(max) NULL,
    CreatorUserGID uniqueidentifier NULL,
    CreateDate datetime NULL,
    LastModifiedAuthorGID uniqueidentifier NULL,
    LastModifiedDate datetime NULL,
    OriginalGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ObjectDocuments]
  --
  PRINT (N'Create table [dbo].[ObjectDocuments]')
  GO
  CREATE TABLE dbo.ObjectDocuments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL,
    Number nvarchar(50) NOT NULL,
    StartDate datetime NULL,
    EndDate datetime NULL,
    IssuedDate date NULL,
    IssuedBy nvarchar(200) NULL,
    ObjectGID uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    IsActive bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[NotificationStatusChanges]
  --
  PRINT (N'Create table [dbo].[NotificationStatusChanges]')
  GO
  CREATE TABLE dbo.NotificationStatusChanges (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    NotificationGID uniqueidentifier NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    CreatorUserGID uniqueidentifier NOT NULL,
    CreatedDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Comment nvarchar(max) NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Notifications]
  --
  PRINT (N'Create table [dbo].[Notifications]')
  GO
  CREATE TABLE dbo.Notifications (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ContactPhone nvarchar(50) NULL,
    EventPostAddressGID uniqueidentifier NULL,
    EventAddress nvarchar(255) NULL,
    ProductGID uniqueidentifier NULL,
    PolisNumber nvarchar(50) NULL,
    RiskGID uniqueidentifier NULL,
    EventDescription nvarchar(max) NULL,
    DamageDescription nvarchar(max) NULL,
    Comment nvarchar(max) NULL,
    CreateDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    InsurerGID uniqueidentifier NULL,
    NotifierGID uniqueidentifier NULL,
    InsuranceObjectGID uniqueidentifier NULL,
    InsuranceObjectDescription nvarchar(max) NULL,
    EventDate datetime NULL,
    CountryGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    ContractGID uniqueidentifier NULL,
    RecipientGID uniqueidentifier NULL,
    TicketGID uniqueidentifier NULL,
    CommissarGID uniqueidentifier NULL,
    SourceTypeGID uniqueidentifier NOT NULL,
    NotificationTypeGID uniqueidentifier NULL,
    CallReasonGID uniqueidentifier NULL,
    CaseGID uniqueidentifier NULL,
    CaseNumbers nvarchar(max) NULL,
    ParticipantFaceNames nvarchar(max) NULL,
    ParticipantObjectNames nvarchar(max) NULL,
    ResponsibilityArea nvarchar(255) NULL,
    AppealType nvarchar(255) NULL,
    AppealContent nvarchar(255) NULL,
    RequirementNumber nvarchar(255) NULL,
    InputNumber nvarchar(255) NULL,
    ReceiptDate datetime NULL,
    DeclarantName nvarchar(255) NULL,
    PropertyRequirements bit NULL,
    ResponseNumber nvarchar(255) NULL,
    ResponseDate datetime NULL,
    WithoutClaimType bit NOT NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[NotificationParticipants]
  --
  PRINT (N'Create table [dbo].[NotificationParticipants]')
  GO
  CREATE TABLE dbo.NotificationParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    TypeGID uniqueidentifier NOT NULL,
    NotificationGID uniqueidentifier NOT NULL,
    Name nvarchar(255) NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Notices]
  --
  PRINT (N'Create table [dbo].[Notices]')
  GO
  CREATE TABLE dbo.Notices (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    Date datetime NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    Subject nvarchar(255) NOT NULL,
    Body nvarchar(1000) NOT NULL,
    UserGID uniqueidentifier NULL,
    EntityGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Marines]
  --
  PRINT (N'Create table [dbo].[Marines]')
  GO
  CREATE TABLE dbo.Marines (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL,
    RegistrationNumber nvarchar(50) NULL,
    Port nvarchar(50) NULL,
    ProducedDate datetime NULL,
    CrewCount int NULL,
    PassengersCount int NULL,
    Height decimal(18, 2) NULL,
    Width decimal(18, 2) NULL,
    Manufacturer nvarchar(50) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    Cost decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Letters]
  --
  PRINT (N'Create table [dbo].[Letters]')
  GO
  CREATE TABLE dbo.Letters (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    AuthorGID uniqueidentifier NULL,
    AddUserGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    LetterTypeGID uniqueidentifier NULL,
    Date datetime NULL,
    Notes nvarchar(2000) NULL,
    IsCanceled bit NOT NULL,
    LetterFeatureGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[LetterParticipants]
  --
  PRINT (N'Create table [dbo].[LetterParticipants]')
  GO
  CREATE TABLE dbo.LetterParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    TypeGID uniqueidentifier NOT NULL,
    LetterGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[InsuranceObjects]
  --
  PRINT (N'Create table [dbo].[InsuranceObjects]')
  GO
  CREATE TABLE dbo.InsuranceObjects (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ObjectCategory nvarchar(50) NULL,
    InsuranceObjectTypeGID uniqueidentifier NULL,
    Comment nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    InsuranceSum decimal(18, 2) NULL,
    InsurancePayment decimal(18, 2) NULL,
    InsuranceRate decimal(18, 10) NULL,
    AuthorGID uniqueidentifier NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(900) NULL,
    CalculatedInsuranceRate decimal(18, 10) NULL,
    CalculatedPayment decimal(18, 2) NULL,
    ParentInsuranceObjectGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[InsuranceActs]
  --
  PRINT (N'Create table [dbo].[InsuranceActs]')
  GO
  CREATE TABLE dbo.InsuranceActs (
    gid uniqueidentifier NOT NULL,
    Number nvarchar(255) NULL,
    Date datetime NULL,
    Sum decimal(18, 2) NULL,
    ReceiverGID uniqueidentifier NULL,
    IsFullPaid bit NULL,
    FullyPaidDate datetime NULL,
    IsSentForPayment bit NULL,
    SetForPaymentDate datetime NULL,
    id bigint IDENTITY,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  SET QUOTED_IDENTIFIER ON
  GO
  
  --
  -- Create table [dbo].[Faces]
  --
  PRINT (N'Create table [dbo].[Faces]')
  GO
  CREATE TABLE dbo.Faces (
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    id bigint IDENTITY,
    AuthorGID uniqueidentifier NULL,
    PersonTypeID bigint NOT NULL,
    FullNameEnglish nvarchar(255) NULL,
    IdentificationCode nvarchar(15) NULL,
    Profession nvarchar(255) NULL,
    Address nvarchar(255) NULL,
    ActualAddress nvarchar(255) NULL,
    PhoneNumber nvarchar(30) NULL,
    Fax nvarchar(30) NULL,
    AdditionalContactInfo nvarchar(255) NULL,
    Email nvarchar(130) NULL,
    PostAddressGID uniqueidentifier NULL,
    PostActualAddressGID uniqueidentifier NULL,
    ActivityGID uniqueidentifier NULL,
    WebAddress nvarchar(50) NULL,
    PhoneNumberAdditional nvarchar(30) NULL,
    MobilePhoneNumber nvarchar(30) NULL,
    HomePhoneNumber nvarchar(30) NULL,
    WorkPhoneNumber nvarchar(30) NULL,
    FullName nvarchar(255) NULL,
    ParentGID uniqueidentifier NULL,
    EDRPOU nvarchar(15) NULL,
    IsResponsible bit NULL,
    Firstname nvarchar(50) NULL,
    Secondname nvarchar(50) NULL,
    Lastname nvarchar(50) NULL,
    IsMan bit NULL,
    Birthdate datetime NULL,
    DriverFrom int NULL,
    GenitiveName nvarchar(255) NULL,
    GenitivePost nvarchar(255) NULL,
    Post nvarchar(255) NULL,
    FaceID AS (isnull(nullif([EDRPOU],''),[IdentificationCode])) PERSISTED
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ExpertAppraisers]
  --
  PRINT (N'Create table [dbo].[ExpertAppraisers]')
  GO
  CREATE TABLE dbo.ExpertAppraisers (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    PersonTypeID int NOT NULL,
    IdentificationCodeEDRPOU nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Events]
  --
  PRINT (N'Create table [dbo].[Events]')
  GO
  CREATE TABLE dbo.Events (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Date datetime NULL,
    CountryGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    Address nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL,
    Comment nvarchar(255) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[EventParticipants]
  --
  PRINT (N'Create table [dbo].[EventParticipants]')
  GO
  CREATE TABLE dbo.EventParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    TypeGID uniqueidentifier NOT NULL,
    EventGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[EventDepartures]
  --
  PRINT (N'Create table [dbo].[EventDepartures]')
  GO
  CREATE TABLE dbo.EventDepartures (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CaseGID uniqueidentifier NOT NULL,
    Date datetime NOT NULL,
    AccidentReceivingTimeGID uniqueidentifier NOT NULL,
    IsDefrauded bit NULL,
    PostAddressGID uniqueidentifier NOT NULL,
    Address nvarchar(255) NULL,
    ReportDate datetime NULL,
    Comment nvarchar(max) NULL,
    MobileCommissarGID uniqueidentifier NOT NULL,
    CreateDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Estates]
  --
  PRINT (N'Create table [dbo].[Estates]')
  GO
  CREATE TABLE dbo.Estates (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(450) NOT NULL,
    OwnerGID uniqueidentifier NOT NULL,
    Address nvarchar(255) NULL,
    Cost decimal(18, 2) NULL,
    AcquisitionReason nvarchar(50) NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Documents]
  --
  PRINT (N'Create table [dbo].[Documents]')
  GO
  CREATE TABLE dbo.Documents (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    Serial nvarchar(50) NULL,
    Number nvarchar(255) NOT NULL,
    StartDate datetime NULL,
    EndDate datetime NULL,
    IssuedDate date NULL,
    IssuedBy nvarchar(200) NULL,
    ObjectGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NULL,
    Type nvarchar(255) NULL,
    IsLockedOut bit NOT NULL,
    AddDate datetime NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    AutoGeneratNumbere bigint NULL,
    WorkflowGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[DigitalCopies]
  --
  PRINT (N'Create table [dbo].[DigitalCopies]')
  GO
  CREATE TABLE dbo.DigitalCopies (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentGID uniqueidentifier NOT NULL,
    Name nvarchar(255) NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    IsImage bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CourtRulings]
  --
  PRINT (N'Create table [dbo].[CourtRulings]')
  GO
  CREATE TABLE dbo.CourtRulings (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    AmountToLevy money NOT NULL,
    AmountToPayout money NULL,
    Fine money NULL,
    Inflation money NULL,
    ThreeProc money NULL,
    MoralInjury money NULL,
    CourtFee money NULL,
    ForcedAbscence money NULL,
    WageIndexing money NULL,
    Other money NULL,
    Comment nvarchar(255) NULL,
    RulingDate datetime NOT NULL,
    RulingResult nvarchar(500) NOT NULL,
    RulingTypeGID uniqueidentifier NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CourtHearings]
  --
  PRINT (N'Create table [dbo].[CourtHearings]')
  GO
  CREATE TABLE dbo.CourtHearings (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CourtCaseGID uniqueidentifier NOT NULL,
    DateOfHearing datetime NOT NULL,
    Comment nvarchar(255) NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Contracts]
  --
  PRINT (N'Create table [dbo].[Contracts]')
  GO
  CREATE TABLE dbo.Contracts (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    ContractNumber nvarchar(50) NOT NULL,
    ContragentGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ConstructionLoadingWorks]
  --
  PRINT (N'Create table [dbo].[ConstructionLoadingWorks]')
  GO
  CREATE TABLE dbo.ConstructionLoadingWorks (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    Purpose nvarchar(255) NULL,
    Location nvarchar(255) NULL,
    Cost decimal(18, 2) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CommissarExaminations]
  --
  PRINT (N'Create table [dbo].[CommissarExaminations]')
  GO
  CREATE TABLE dbo.CommissarExaminations (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CaseGID uniqueidentifier NOT NULL,
    Number nvarchar(50) NOT NULL,
    Date datetime NULL,
    PostAddressGID uniqueidentifier NULL,
    Address nvarchar(255) NULL,
    MobileCommissarGID uniqueidentifier NULL,
    ActualDate datetime NULL,
    IsFinished bit NULL,
    Notes nvarchar(1024) NULL,
    BackToDirectionDate datetime NULL,
    AttachedToCaseDate datetime NULL,
    SentToAccountsCenterDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    ActualPostAddressGID uniqueidentifier NULL,
    ActualAddress nvarchar(255) NULL,
    ObjectName nvarchar(255) NOT NULL,
    ObjectGID uniqueidentifier NULL,
    SecurityTypeGID uniqueidentifier NOT NULL,
    ServiceStationGID uniqueidentifier NULL,
    BranchGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    ExpertAppraiserGID uniqueidentifier NULL,
    CreateDate datetime NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CommissarExaminationParticipants]
  --
  PRINT (N'Create table [dbo].[CommissarExaminationParticipants]')
  GO
  CREATE TABLE dbo.CommissarExaminationParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    TypeGID uniqueidentifier NOT NULL,
    CommissarExaminationGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Claims]
  --
  PRINT (N'Create table [dbo].[Claims]')
  GO
  CREATE TABLE dbo.Claims (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimerGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NOT NULL,
    DateWriting datetime NULL,
    Notes nvarchar(255) NULL,
    AuthorGID uniqueidentifier NULL,
    RiskGID uniqueidentifier NULL,
    InsurerGID uniqueidentifier NULL,
    InsuranceObjectGID uniqueidentifier NULL,
    RecipientGID uniqueidentifier NULL,
    ProgramTypeGID uniqueidentifier NOT NULL,
    OwnerPostAddressGID uniqueidentifier NULL,
    IsVipClient bit NOT NULL,
    InsuranceSum decimal(18, 2) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ClaimParticipants]
  --
  PRINT (N'Create table [dbo].[ClaimParticipants]')
  GO
  CREATE TABLE dbo.ClaimParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    ClaimGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Cases]
  --
  PRINT (N'Create table [dbo].[Cases]')
  GO
  CREATE TABLE dbo.Cases (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Number nvarchar(255) NOT NULL,
    InnerNumber nvarchar(50) NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    ResponsibleGID uniqueidentifier NOT NULL,
    Year int NOT NULL,
    EventGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NULL,
    IsRegressPossible bit NULL,
    AddDate datetime NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    PinCode nvarchar(7) NULL,
    Executor nvarchar(255) NULL,
    ForumTopicGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    WorkflowGID uniqueidentifier NULL,
    PolisNumber nvarchar(max) NULL,
    InsuredName nvarchar(max) NULL,
    InsuredObjectName nvarchar(max) NULL,
    ParticipantFaceNames nvarchar(max) NULL,
    ParticipantObjectNames nvarchar(max) NULL,
    LastModifiedAuthorGID uniqueidentifier NULL,
    LastModifiedDate datetime NULL,
    Deleted bit NOT NULL,
    CreateDate datetime NOT NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseHistorySteps]
  --
  PRINT (N'Create table [dbo].[CaseHistorySteps]')
  GO
  CREATE TABLE dbo.CaseHistorySteps (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NULL,
    UserGID uniqueidentifier NULL,
    DocumentStatusGID uniqueidentifier NULL,
    StatusGID uniqueidentifier NOT NULL,
    Comment nvarchar(500) NULL,
    AuthorGID uniqueidentifier NULL,
    AddDate datetime NULL,
    AddUserGID uniqueidentifier NULL,
    BranchGID uniqueidentifier NULL,
    Date datetime NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseComments]
  --
  PRINT (N'Create table [dbo].[CaseComments]')
  GO
  CREATE TABLE dbo.CaseComments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    Content nvarchar(max) NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  TEXTIMAGE_ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Cargos]
  --
  PRINT (N'Create table [dbo].[Cargos]')
  GO
  CREATE TABLE dbo.Cargos (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(255) NOT NULL,
    Valume nvarchar(255) NULL,
    IsPacked bit NULL,
    PackName nvarchar(50) NULL,
    TransportationVehicleGID uniqueidentifier NULL,
    TransportationVehicleName nvarchar(255) NULL,
    SendDate datetime NULL,
    ReceiveDate datetime NULL,
    OwnerGID uniqueidentifier NOT NULL,
    TransportDocument nvarchar(255) NULL,
    TransportationRoute nvarchar(255) NULL,
    UnitCost decimal(18, 2) NULL,
    SeatsNumber int NULL,
    Cost decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Calculations]
  --
  PRINT (N'Create table [dbo].[Calculations]')
  GO
  CREATE TABLE dbo.Calculations (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    RecipientGID uniqueidentifier NULL,
    PrintDate datetime NULL,
    PrintUserGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    CommissarExaminationGID uniqueidentifier NULL,
    CostWork decimal NULL,
    Materials decimal(18, 2) NULL,
    CostRepair decimal(18, 2) NULL,
    DamageWear decimal(18, 2) NULL,
    ObjectName nvarchar(255) NULL,
    Parts decimal(18, 2) NULL,
    DocumentStatus nvarchar(255) NULL,
    OrganizationExpert nvarchar(255) NULL,
    DamageAmount decimal(18, 2) NULL,
    AgreementType nvarchar(255) NULL,
    AgreementAmount decimal(18, 2) NULL,
    CalculationTypeGID uniqueidentifier NOT NULL,
    ServiceStationGID uniqueidentifier NULL,
    ExpertAppraiserGID uniqueidentifier NULL,
    BranchGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CalculationParticipants]
  --
  PRINT (N'Create table [dbo].[CalculationParticipants]')
  GO
  CREATE TABLE dbo.CalculationParticipants (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    CalculationGID uniqueidentifier NOT NULL,
    ObjectGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    ObjectTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Branches]
  --
  PRINT (N'Create table [dbo].[Branches]')
  GO
  CREATE TABLE dbo.Branches (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Code nvarchar(10) NULL,
    Name nvarchar(255) NOT NULL,
    PhoneNumber nvarchar(50) NULL,
    OrganizationGID uniqueidentifier NULL,
    ParentGID uniqueidentifier NULL,
    BranchCode nvarchar(50) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[AuthorityNotifications]
  --
  PRINT (N'Create table [dbo].[AuthorityNotifications]')
  GO
  CREATE TABLE dbo.AuthorityNotifications (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    NotificationGID uniqueidentifier NULL,
    FaceGID uniqueidentifier NULL,
    Name nvarchar(255) NULL,
    Date datetime NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    ClaimGID uniqueidentifier NULL,
    EventGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Auctions]
  --
  PRINT (N'Create table [dbo].[Auctions]')
  GO
  CREATE TABLE dbo.Auctions (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    IsActive bit NULL,
    StartDate datetime NULL,
    StartPrice decimal(18, 2) NULL,
    EndDate datetime NULL,
    Result decimal(18, 2) NULL,
    WinnerWebsiteGID uniqueidentifier NULL,
    AreDocumentsAvailable bit NULL,
    CaseGID uniqueidentifier NOT NULL,
    IsNotifiedAboutEndDateApproached bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    TypeGID uniqueidentifier NULL,
    CalculationDate datetime NULL,
    ProtocolNumber nvarchar(255) NULL,
    ProtocolDate datetime NULL,
    CalculationGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Animals]
  --
  PRINT (N'Create table [dbo].[Animals]')
  GO
  CREATE TABLE dbo.Animals (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL,
    Age nvarchar(50) NULL,
    SuitAndSigns nvarchar(250) NULL,
    Weight decimal(18, 2) NULL,
    Cost decimal(18, 2) NULL,
    Address nvarchar(250) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Airs]
  --
  PRINT (N'Create table [dbo].[Airs]')
  GO
  CREATE TABLE dbo.Airs (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL,
    StateAndRegistrationMarks nvarchar(50) NULL,
    ProducedDate int NULL,
    SerialNumber nvarchar(50) NULL,
    AirportBased nvarchar(50) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    OperatorGID uniqueidentifier NOT NULL,
    MaximumPassengers int NULL,
    MaximumTakeOffWeight decimal(18, 2) NULL,
    MaximumCapacity decimal(18, 2) NULL,
    Cost decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Agricultures]
  --
  PRINT (N'Create table [dbo].[Agricultures]')
  GO
  CREATE TABLE dbo.Agricultures (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Name nvarchar(50) NOT NULL,
    UnitCost decimal(18, 2) NULL,
    InsuranceYield decimal(18, 2) NULL,
    AverageYield decimal(18, 2) NULL,
    InsuranceCover decimal(5, 2) NULL,
    CropsArea decimal(18, 2) NULL,
    Address nvarchar(255) NULL,
    OwnerGID uniqueidentifier NOT NULL,
    PostAddressGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Accounts]
  --
  PRINT (N'Create table [dbo].[Accounts]')
  GO
  CREATE TABLE dbo.Accounts (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    AccountNumber nvarchar(50) NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    FaceGID uniqueidentifier NOT NULL,
    BankGID uniqueidentifier NOT NULL,
    ParentGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [cfg].[ModuleSettings]
  --
  PRINT (N'Create table [cfg].[ModuleSettings]')
  GO
  CREATE TABLE cfg.ModuleSettings (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    KeyName nvarchar(50) NOT NULL,
    KeyValue sql_variant NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[UsersInRoles]
  --
  PRINT (N'Create table [log].[UsersInRoles]')
  GO
  CREATE TABLE log.UsersInRoles (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    UserGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[UsersInRoles]
  --
  PRINT (N'Create table [dbo].[UsersInRoles]')
  GO
  CREATE TABLE dbo.UsersInRoles (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    UserGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Timers]
  --
  PRINT (N'Create table [log].[Timers]')
  GO
  CREATE TABLE log.Timers (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    DateStart datetime NOT NULL,
    DateEnd datetime NOT NULL,
    StatusGID uniqueidentifier NULL,
    UserGID uniqueidentifier NULL,
    EntityGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Timers]
  --
  PRINT (N'Create table [dbo].[Timers]')
  GO
  CREATE TABLE dbo.Timers (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    DateStart datetime NOT NULL,
    DateEnd datetime NOT NULL,
    StatusGID uniqueidentifier NULL,
    UserGID uniqueidentifier NULL,
    EntityGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [tmp].[TempGIDs]
  --
  PRINT (N'Create table [tmp].[TempGIDs]')
  GO
  CREATE TABLE tmp.TempGIDs (
    Identifier uniqueidentifier NOT NULL,
    TempGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Subscriptions]
  --
  PRINT (N'Create table [dbo].[Subscriptions]')
  GO
  CREATE TABLE dbo.Subscriptions (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    UserGID uniqueidentifier NOT NULL,
    NoticeTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Subscriptions]
  --
  PRINT (N'Create table [log].[Subscriptions]')
  GO
  CREATE TABLE log.Subscriptions (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    TypeGID uniqueidentifier NOT NULL,
    UserGID uniqueidentifier NOT NULL,
    NoticeTypeGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[StatusPropertiesToStatusValues]
  --
  PRINT (N'Create table [meta].[StatusPropertiesToStatusValues]')
  GO
  CREATE TABLE meta.StatusPropertiesToStatusValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Value sql_variant NOT NULL,
    ChildValueGID uniqueidentifier NULL,
    StatusPropertiesToStatusGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[StatusPropertiesToStatuses]
  --
  PRINT (N'Create table [meta].[StatusPropertiesToStatuses]')
  GO
  CREATE TABLE meta.StatusPropertiesToStatuses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    StatusGID uniqueidentifier NOT NULL,
    StatusPropertyGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[StatusParameterValueToStatuses]
  --
  PRINT (N'Create table [meta].[StatusParameterValueToStatuses]')
  GO
  CREATE TABLE meta.StatusParameterValueToStatuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    StatusGID uniqueidentifier NOT NULL,
    StatusParameterValueGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[StatusParameterValueToCaseStatuses]
  --
  PRINT (N'Create table [meta].[StatusParameterValueToCaseStatuses]')
  GO
  CREATE TABLE meta.StatusParameterValueToCaseStatuses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CaseStatusGID uniqueidentifier NOT NULL,
    StatusParameterValueGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[StatusParameterValues]
  --
  PRINT (N'Create table [meta].[StatusParameterValues]')
  GO
  CREATE TABLE meta.StatusParameterValues (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    StatusParameterGID uniqueidentifier NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[StatusChangeParameterValues]
  --
  PRINT (N'Create table [log].[StatusChangeParameterValues]')
  GO
  CREATE TABLE log.StatusChangeParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    StatusChangeGID uniqueidentifier NOT NULL,
    StatusParameterGID uniqueidentifier NOT NULL,
    StatusParameterValue sql_variant NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[StatusChangeParameterValues]
  --
  PRINT (N'Create table [dbo].[StatusChangeParameterValues]')
  GO
  CREATE TABLE dbo.StatusChangeParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    StatusChangeGID uniqueidentifier NOT NULL,
    StatusParameterGID uniqueidentifier NOT NULL,
    StatusParameterValue sql_variant NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Signers]
  --
  PRINT (N'Create table [dbo].[Signers]')
  GO
  CREATE TABLE dbo.Signers (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    FaceGID uniqueidentifier NOT NULL,
    RepresentativeGID uniqueidentifier NULL,
    AccountGID uniqueidentifier NULL,
    DocumentGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Signers]
  --
  PRINT (N'Create table [log].[Signers]')
  GO
  CREATE TABLE log.Signers (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    FaceGID uniqueidentifier NOT NULL,
    RepresentativeGID uniqueidentifier NULL,
    AccountGID uniqueidentifier NULL,
    DocumentGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ServiceStationsToVehicleManufacturers]
  --
  PRINT (N'Create table [log].[ServiceStationsToVehicleManufacturers]')
  GO
  CREATE TABLE log.ServiceStationsToVehicleManufacturers (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ServiceStationGID uniqueidentifier NOT NULL,
    VehicleManufacturerGID uniqueidentifier NOT NULL,
    IsOfficial bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ServiceStationsToVehicleManufacturers]
  --
  PRINT (N'Create table [dbo].[ServiceStationsToVehicleManufacturers]')
  GO
  CREATE TABLE dbo.ServiceStationsToVehicleManufacturers (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    ServiceStationGID uniqueidentifier NOT NULL,
    VehicleManufacturerGID uniqueidentifier NOT NULL,
    IsOfficial bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ServiceStationsToClaimTypes]
  --
  PRINT (N'Create table [dbo].[ServiceStationsToClaimTypes]')
  GO
  CREATE TABLE dbo.ServiceStationsToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    ServiceStationGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ServiceStationsToClaimTypes]
  --
  PRINT (N'Create table [log].[ServiceStationsToClaimTypes]')
  GO
  CREATE TABLE log.ServiceStationsToClaimTypes (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ServiceStationGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ServiceStationsToBranches]
  --
  PRINT (N'Create table [dbo].[ServiceStationsToBranches]')
  GO
  CREATE TABLE dbo.ServiceStationsToBranches (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    ServiceStationGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ServiceStationsToBranches]
  --
  PRINT (N'Create table [log].[ServiceStationsToBranches]')
  GO
  CREATE TABLE log.ServiceStationsToBranches (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ServiceStationGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RoutesToClaimTypes]
  --
  PRINT (N'Create table [meta].[RoutesToClaimTypes]')
  GO
  CREATE TABLE meta.RoutesToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    RouteGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RouteStepToUsers]
  --
  PRINT (N'Create table [meta].[RouteStepToUsers]')
  GO
  CREATE TABLE meta.RouteStepToUsers (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    UserGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RouteStepToRoles]
  --
  PRINT (N'Create table [meta].[RouteStepToRoles]')
  GO
  CREATE TABLE meta.RouteStepToRoles (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RouteSteps]
  --
  PRINT (N'Create table [meta].[RouteSteps]')
  GO
  CREATE TABLE meta.RouteSteps (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    RouteGID uniqueidentifier NOT NULL,
    PreviousGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RouteRisks]
  --
  PRINT (N'Create table [meta].[RouteRisks]')
  GO
  CREATE TABLE meta.RouteRisks (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    RouteGID uniqueidentifier NOT NULL,
    RiskGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RoleStatuses]
  --
  PRINT (N'Create table [meta].[RoleStatuses]')
  GO
  CREATE TABLE meta.RoleStatuses (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL,
    StatusGID uniqueidentifier NOT NULL,
    CanEdit bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RisksToClaimTypes]
  --
  PRINT (N'Create table [meta].[RisksToClaimTypes]')
  GO
  CREATE TABLE meta.RisksToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    RiskGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Responsibles]
  --
  PRINT (N'Create table [log].[Responsibles]')
  GO
  CREATE TABLE log.Responsibles (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Responsibles]
  --
  PRINT (N'Create table [dbo].[Responsibles]')
  GO
  CREATE TABLE dbo.Responsibles (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Reservations]
  --
  PRINT (N'Create table [log].[Reservations]')
  GO
  CREATE TABLE log.Reservations (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    Amount decimal(18, 2) NOT NULL,
    PreviousDamageAmount decimal(18, 2) NULL,
    CreateUserGID uniqueidentifier NOT NULL,
    CreateDate datetime NOT NULL,
    CalculationTypeGID uniqueidentifier NOT NULL,
    CurrencyTypeGID uniqueidentifier NOT NULL,
    AmountHRN decimal(18, 2) NULL,
    AmountEuro decimal(18, 2) NULL,
    CaseGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL,
    ClaimDate datetime NULL,
    EndingDate datetime NULL,
    ParentGID uniqueidentifier NULL,
    DocumentGID uniqueidentifier NULL,
    ParentDocumentGID uniqueidentifier NULL,
    LastModifiedDate datetime NULL,
    LastModifiedAuthorGID uniqueidentifier NULL,
    ExportDate datetime NULL,
    DoNotExport bit NOT NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Reservations]
  --
  PRINT (N'Create table [dbo].[Reservations]')
  GO
  CREATE TABLE dbo.Reservations (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    Amount decimal(18, 2) NOT NULL,
    PreviousDamageAmount decimal(18, 2) NULL,
    CreateUserGID uniqueidentifier NOT NULL,
    CreateDate datetime NOT NULL,
    CalculationTypeGID uniqueidentifier NOT NULL,
    CurrencyTypeGID uniqueidentifier NOT NULL,
    AmountHRN decimal(18, 2) NULL,
    AmountEuro decimal(18, 2) NULL,
    CaseGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL,
    ClaimDate datetime NULL,
    EndingDate datetime NULL,
    ParentGID uniqueidentifier NULL,
    DocumentGID uniqueidentifier NULL,
    ParentDocumentGID uniqueidentifier NULL,
    LastModifiedDate datetime NULL,
    LastModifiedAuthorGID uniqueidentifier NULL,
    ExportDate datetime NULL,
    DoNotExport bit NOT NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ReservationDefaults]
  --
  PRINT (N'Create table [meta].[ReservationDefaults]')
  GO
  CREATE TABLE meta.ReservationDefaults (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ProgramTypeGID uniqueidentifier NULL,
    BranchGID uniqueidentifier NULL,
    Value decimal(18, 2) NULL,
    ActivationDate datetime NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[RegulationCosts]
  --
  PRINT (N'Create table [dbo].[RegulationCosts]')
  GO
  CREATE TABLE dbo.RegulationCosts (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CostDocumentTypeGID uniqueidentifier NULL,
    Value decimal(18, 2) NOT NULL,
    ContragentGID uniqueidentifier NOT NULL,
    PaidDate datetime NULL,
    PaidValue decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[RegulationCosts]
  --
  PRINT (N'Create table [log].[RegulationCosts]')
  GO
  CREATE TABLE log.RegulationCosts (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CostDocumentTypeGID uniqueidentifier NULL,
    Value decimal(18, 2) NOT NULL,
    ContragentGID uniqueidentifier NOT NULL,
    PaidDate datetime NULL,
    PaidValue decimal(18, 2) NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[RegressToParameterValues]
  --
  PRINT (N'Create table [log].[RegressToParameterValues]')
  GO
  CREATE TABLE log.RegressToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    RegressGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[RegressToParameterValues]
  --
  PRINT (N'Create table [dbo].[RegressToParameterValues]')
  GO
  CREATE TABLE dbo.RegressToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    RegressGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[RegressPayments]
  --
  PRINT (N'Create table [dbo].[RegressPayments]')
  GO
  CREATE TABLE dbo.RegressPayments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    RegressGID uniqueidentifier NOT NULL,
    Date datetime NULL,
    Amount decimal(18, 2) NULL,
    AmoutLeft decimal(18, 2) NULL,
    IsClosed bit NOT NULL,
    AddDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    AddUserGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[RegressPayments]
  --
  PRINT (N'Create table [log].[RegressPayments]')
  GO
  CREATE TABLE log.RegressPayments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    RegressGID uniqueidentifier NOT NULL,
    Date datetime NULL,
    Amount decimal(18, 2) NULL,
    AmoutLeft decimal(18, 2) NULL,
    IsClosed bit NOT NULL,
    AddDate datetime NULL,
    AuthorGID uniqueidentifier NULL,
    AddUserGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RegressParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[RegressParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.RegressParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    RegressParticipantTypesToClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RegressParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[RegressParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.RegressParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasRepresentative bit NOT NULL,
    HasPermissionGID uniqueidentifier NULL,
    AsInsured bit NOT NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RegressDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[RegressDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.RegressDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[RegressDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[RegressDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.RegressDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[RealPayments]
  --
  PRINT (N'Create table [dbo].[RealPayments]')
  GO
  CREATE TABLE dbo.RealPayments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    PaymentDate date NOT NULL,
    Value decimal(18, 2) NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[RealPayments]
  --
  PRINT (N'Create table [log].[RealPayments]')
  GO
  CREATE TABLE log.RealPayments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PaymentDate date NOT NULL,
    Value decimal(18, 2) NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ProgramTypeToClaimTypes]
  --
  PRINT (N'Create table [meta].[ProgramTypeToClaimTypes]')
  GO
  CREATE TABLE meta.ProgramTypeToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ProgramTypeGID uniqueidentifier NOT NULL,
    ProductTypeGID uniqueidentifier NOT NULL,
    Reserve decimal(18, 2) NULL,
    RegulationCost decimal(18, 2) NULL,
    RetentionLimit decimal(18, 2) NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PayableToRealPayments]
  --
  PRINT (N'Create table [dbo].[PayableToRealPayments]')
  GO
  CREATE TABLE dbo.PayableToRealPayments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    PayableGID uniqueidentifier NOT NULL,
    RealPaymentGID uniqueidentifier NOT NULL,
    Value decimal(18, 2) NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PayableToRealPayments]
  --
  PRINT (N'Create table [log].[PayableToRealPayments]')
  GO
  CREATE TABLE log.PayableToRealPayments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PayableGID uniqueidentifier NOT NULL,
    RealPaymentGID uniqueidentifier NOT NULL,
    Value decimal(18, 2) NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PayableToParameterValues]
  --
  PRINT (N'Create table [dbo].[PayableToParameterValues]')
  GO
  CREATE TABLE dbo.PayableToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    PayableGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PayableToParameterValues]
  --
  PRINT (N'Create table [log].[PayableToParameterValues]')
  GO
  CREATE TABLE log.PayableToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PayableGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[PayablePartners]
  --
  PRINT (N'Create table [log].[PayablePartners]')
  GO
  CREATE TABLE log.PayablePartners (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[PayablePartners]
  --
  PRINT (N'Create table [dbo].[PayablePartners]')
  GO
  CREATE TABLE dbo.PayablePartners (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PayableParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[PayableParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.PayableParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    PayableParticipantTypesToClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PayableParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[PayableParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.PayableParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasRepresentative bit NOT NULL,
    HasPermissionGID uniqueidentifier NULL,
    AsInsured bit NOT NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PayableDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[PayableDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.PayableDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[PayableDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[PayableDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.PayableDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[OutgoingRegressToParameterValues]
  --
  PRINT (N'Create table [log].[OutgoingRegressToParameterValues]')
  GO
  CREATE TABLE log.OutgoingRegressToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    OutgoingRegressGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[OutgoingRegressToParameterValues]
  --
  PRINT (N'Create table [dbo].[OutgoingRegressToParameterValues]')
  GO
  CREATE TABLE dbo.OutgoingRegressToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    OutgoingRegressGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[OutgoingRegresses]
  --
  PRINT (N'Create table [dbo].[OutgoingRegresses]')
  GO
  CREATE TABLE dbo.OutgoingRegresses (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[OutgoingRegresses]
  --
  PRINT (N'Create table [log].[OutgoingRegresses]')
  GO
  CREATE TABLE log.OutgoingRegresses (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[OutgoingRegressDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[OutgoingRegressDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.OutgoingRegressDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[OutgoingRegressDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[OutgoingRegressDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.OutgoingRegressDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ObjectTypeToClaimTypes]
  --
  PRINT (N'Create table [meta].[ObjectTypeToClaimTypes]')
  GO
  CREATE TABLE meta.ObjectTypeToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[NotificationToParameterValues]
  --
  PRINT (N'Create table [dbo].[NotificationToParameterValues]')
  GO
  CREATE TABLE dbo.NotificationToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    NotificationGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[NotificationToParameterValues]
  --
  PRINT (N'Create table [log].[NotificationToParameterValues]')
  GO
  CREATE TABLE log.NotificationToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    NotificationGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationStatusWorkflows]
  --
  PRINT (N'Create table [meta].[NotificationStatusWorkflows]')
  GO
  CREATE TABLE meta.NotificationStatusWorkflows (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    FromGID uniqueidentifier NOT NULL,
    ToGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationPropertiesToClaimTypeValues]
  --
  PRINT (N'Create table [meta].[NotificationPropertiesToClaimTypeValues]')
  GO
  CREATE TABLE meta.NotificationPropertiesToClaimTypeValues (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Value sql_variant NOT NULL,
    ChildValueGID uniqueidentifier NULL,
    NotificationPropertiesToClaimTypeGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationPropertiesToClaimTypes]
  --
  PRINT (N'Create table [meta].[NotificationPropertiesToClaimTypes]')
  GO
  CREATE TABLE meta.NotificationPropertiesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    NotificationPropertyGID uniqueidentifier NOT NULL,
    ClaimTypeDID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[NotificationParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.NotificationParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasPermissionGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[NotificationDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.NotificationDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL,
    CallReasonGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[NotificationDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[NotificationDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.NotificationDocumentParameterToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL,
    CallReasonGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[LivingWages]
  --
  PRINT (N'Create table [meta].[LivingWages]')
  GO
  CREATE TABLE meta.LivingWages (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Date datetime NOT NULL,
    Under6 decimal(18, 2) NOT NULL,
    Under18 decimal(18, 2) NOT NULL,
    UnableToWork decimal(18, 2) NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[Litigations]
  --
  PRINT (N'Create table [dbo].[Litigations]')
  GO
  CREATE TABLE dbo.Litigations (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CaseGID uniqueidentifier NULL,
    LitigantGID uniqueidentifier NULL,
    AppellateGID uniqueidentifier NULL,
    ThirdPersonGID uniqueidentifier NULL,
    IsOrantaLitigant bit NOT NULL,
    IsOrantaAppellate bit NOT NULL,
    IsOrantaThirdPerson bit NOT NULL,
    Amount money NOT NULL,
    LitigationDate datetime NOT NULL,
    SubjectGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[Litigations]
  --
  PRINT (N'Create table [log].[Litigations]')
  GO
  CREATE TABLE log.Litigations (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseGID uniqueidentifier NULL,
    LitigantGID uniqueidentifier NULL,
    AppellateGID uniqueidentifier NULL,
    ThirdPersonGID uniqueidentifier NULL,
    IsOrantaLitigant bit NOT NULL,
    IsOrantaAppellate bit NOT NULL,
    IsOrantaThirdPerson bit NOT NULL,
    Amount money NOT NULL,
    LitigationDate datetime NOT NULL,
    SubjectGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[LetterTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[LetterTypesToClaimTypes]')
  GO
  CREATE TABLE meta.LetterTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LetterTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[LetterPhotos]
  --
  PRINT (N'Create table [dbo].[LetterPhotos]')
  GO
  CREATE TABLE dbo.LetterPhotos (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LetterGID uniqueidentifier NOT NULL,
    DigitalCopyGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[LetterPhotos]
  --
  PRINT (N'Create table [log].[LetterPhotos]')
  GO
  CREATE TABLE log.LetterPhotos (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    LetterGID uniqueidentifier NOT NULL,
    DigitalCopyGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[LetterParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[LetterParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.LetterParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LetterParticipantTypesToClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[LetterParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[LetterParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.LetterParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasRepresentative bit NOT NULL,
    HasPermissionGID uniqueidentifier NULL,
    AsInsured bit NOT NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ExpressionOperands]
  --
  PRINT (N'Create table [meta].[ExpressionOperands]')
  GO
  CREATE TABLE meta.ExpressionOperands (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ExpressionGID uniqueidentifier NOT NULL,
    Value sql_variant NOT NULL,
    DependentEntityTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ExpertAppraisersToBranches]
  --
  PRINT (N'Create table [dbo].[ExpertAppraisersToBranches]')
  GO
  CREATE TABLE dbo.ExpertAppraisersToBranches (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    ExpertAppraiserGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ExpertAppraisersToBranches]
  --
  PRINT (N'Create table [log].[ExpertAppraisersToBranches]')
  GO
  CREATE TABLE log.ExpertAppraisersToBranches (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ExpertAppraiserGID uniqueidentifier NOT NULL,
    BranchGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[EventToParameterValues]
  --
  PRINT (N'Create table [log].[EventToParameterValues]')
  GO
  CREATE TABLE log.EventToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    EventGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[EventToParameterValues]
  --
  PRINT (N'Create table [dbo].[EventToParameterValues]')
  GO
  CREATE TABLE dbo.EventToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    EventGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[EventParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[EventParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.EventParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    EventParticipantTypesToClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[EventParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[EventParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.EventParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasRepresentative bit NOT NULL,
    HasPermissionGID uniqueidentifier NULL,
    AsInsured bit NOT NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[EventDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[EventDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.EventDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[EventDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[EventDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.EventDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[EventDepartureToParameterValues]
  --
  PRINT (N'Create table [dbo].[EventDepartureToParameterValues]')
  GO
  CREATE TABLE dbo.EventDepartureToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    EventDepartureGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[EventDepartureToParameterValues]
  --
  PRINT (N'Create table [log].[EventDepartureToParameterValues]')
  GO
  CREATE TABLE log.EventDepartureToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    EventDepartureGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[EventDeparturePhotos]
  --
  PRINT (N'Create table [log].[EventDeparturePhotos]')
  GO
  CREATE TABLE log.EventDeparturePhotos (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    EventDepartureGID uniqueidentifier NOT NULL,
    DigitalCopyGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[EventDeparturePhotos]
  --
  PRINT (N'Create table [dbo].[EventDeparturePhotos]')
  GO
  CREATE TABLE dbo.EventDeparturePhotos (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    EventDepartureGID uniqueidentifier NOT NULL,
    DigitalCopyGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[EventDepartureDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[EventDepartureDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.EventDepartureDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[EventDepartureDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[EventDepartureDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.EventDepartureDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[EntityAttributes]
  --
  PRINT (N'Create table [dbo].[EntityAttributes]')
  GO
  CREATE TABLE dbo.EntityAttributes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    EntityGID uniqueidentifier NOT NULL,
    AttributeGID uniqueidentifier NOT NULL,
    Value sql_variant NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[EntityAttributes]
  --
  PRINT (N'Create table [log].[EntityAttributes]')
  GO
  CREATE TABLE log.EntityAttributes (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    EntityGID uniqueidentifier NOT NULL,
    AttributeGID uniqueidentifier NOT NULL,
    Value sql_variant NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypePropertiesToDocumentTypeValues]
  --
  PRINT (N'Create table [meta].[DocumentTypePropertiesToDocumentTypeValues]')
  GO
  CREATE TABLE meta.DocumentTypePropertiesToDocumentTypeValues (
    Id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Value sql_variant NOT NULL,
    ChildValueGID uniqueidentifier NULL,
    DocumentTypePropertiesToDocumentTypeGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypePropertiesToDocumentTypes]
  --
  PRINT (N'Create table [meta].[DocumentTypePropertiesToDocumentTypes]')
  GO
  CREATE TABLE meta.DocumentTypePropertiesToDocumentTypes (
    Id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    DocumentTypePropertyGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypeGroupsToDocumentTypeToClaimTypesToDocumentTypes]
  --
  PRINT (N'Create table [meta].[DocumentTypeGroupsToDocumentTypeToClaimTypesToDocumentTypes]')
  GO
  CREATE TABLE meta.DocumentTypeGroupsToDocumentTypeToClaimTypesToDocumentTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGroupsToDocumentTypeToClaimTypeGID uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentTypeGroupsToDocumentTypeToClaimTypes]
  --
  PRINT (N'Create table [meta].[DocumentTypeGroupsToDocumentTypeToClaimTypes]')
  GO
  CREATE TABLE meta.DocumentTypeGroupsToDocumentTypeToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    DocumentTypeGroupGID uniqueidentifier NOT NULL,
    DocumentTypeToClaimTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[DocumentsToDocuments]
  --
  PRINT (N'Create table [log].[DocumentsToDocuments]')
  GO
  CREATE TABLE log.DocumentsToDocuments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    DocumentGID uniqueidentifier NOT NULL,
    BindedDocumentGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    DocumentTypeGroupGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[DocumentsToDocuments]
  --
  PRINT (N'Create table [dbo].[DocumentsToDocuments]')
  GO
  CREATE TABLE dbo.DocumentsToDocuments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentGID uniqueidentifier NOT NULL,
    BindedDocumentGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL,
    DocumentTypeGroupGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DocumentParameterValues]
  --
  PRINT (N'Create table [meta].[DocumentParameterValues]')
  GO
  CREATE TABLE meta.DocumentParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[DependentEntityTypeAttributeValues]
  --
  PRINT (N'Create table [meta].[DependentEntityTypeAttributeValues]')
  GO
  CREATE TABLE meta.DependentEntityTypeAttributeValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    AttributeGID uniqueidentifier NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CourtCases]
  --
  PRINT (N'Create table [dbo].[CourtCases]')
  GO
  CREATE TABLE dbo.CourtCases (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CourtGID uniqueidentifier NOT NULL,
    CourtTypeGID uniqueidentifier NOT NULL,
    JudgeGID uniqueidentifier NOT NULL,
    LitigationGID uniqueidentifier NOT NULL,
    CourtRulingGID uniqueidentifier NULL,
    PayableGID uniqueidentifier NULL,
    InitialCourtGID uniqueidentifier NULL,
    DateOfHearing datetime NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CourtCases]
  --
  PRINT (N'Create table [log].[CourtCases]')
  GO
  CREATE TABLE log.CourtCases (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CourtGID uniqueidentifier NOT NULL,
    CourtTypeGID uniqueidentifier NOT NULL,
    JudgeGID uniqueidentifier NOT NULL,
    LitigationGID uniqueidentifier NOT NULL,
    CourtRulingGID uniqueidentifier NULL,
    PayableGID uniqueidentifier NULL,
    InitialCourtGID uniqueidentifier NULL,
    DateOfHearing datetime NULL,
    AddUserGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CommissarExaminationToParameterValues]
  --
  PRINT (N'Create table [log].[CommissarExaminationToParameterValues]')
  GO
  CREATE TABLE log.CommissarExaminationToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CommissarExaminationGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CommissarExaminationToParameterValues]
  --
  PRINT (N'Create table [dbo].[CommissarExaminationToParameterValues]')
  GO
  CREATE TABLE dbo.CommissarExaminationToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CommissarExaminationGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CommissarExaminationPhotos]
  --
  PRINT (N'Create table [log].[CommissarExaminationPhotos]')
  GO
  CREATE TABLE log.CommissarExaminationPhotos (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CommissarExaminationGID uniqueidentifier NOT NULL,
    DigitalCopyGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CommissarExaminationPhotos]
  --
  PRINT (N'Create table [dbo].[CommissarExaminationPhotos]')
  GO
  CREATE TABLE dbo.CommissarExaminationPhotos (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CommissarExaminationGID uniqueidentifier NOT NULL,
    DigitalCopyGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CommissarExaminationParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[CommissarExaminationParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.CommissarExaminationParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CommissarExaminationParticipantTypesToClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CommissarExaminationParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[CommissarExaminationParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.CommissarExaminationParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    SecurityTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasRepresentative bit NOT NULL,
    HasPermissionGID uniqueidentifier NULL,
    AsInsured bit NOT NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CommissarExaminationDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[CommissarExaminationDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.CommissarExaminationDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL,
    SecurityTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CommissarExaminationDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[CommissarExaminationDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.CommissarExaminationDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL,
    SecurityTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimTypePropertiesToClaimTypeValues]
  --
  PRINT (N'Create table [meta].[ClaimTypePropertiesToClaimTypeValues]')
  GO
  CREATE TABLE meta.ClaimTypePropertiesToClaimTypeValues (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    Value sql_variant NOT NULL,
    ChildValueGID uniqueidentifier NULL,
    ClaimTypePropertiesToClaimTypeGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimTypePropertiesToClaimTypes]
  --
  PRINT (N'Create table [meta].[ClaimTypePropertiesToClaimTypes]')
  GO
  CREATE TABLE meta.ClaimTypePropertiesToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ClaimTypePropertyGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ClaimToParameterValues]
  --
  PRINT (N'Create table [dbo].[ClaimToParameterValues]')
  GO
  CREATE TABLE dbo.ClaimToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ClaimToParameterValues]
  --
  PRINT (N'Create table [log].[ClaimToParameterValues]')
  GO
  CREATE TABLE log.ClaimToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ClaimGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[ClaimParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.ClaimParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    ClaimParticipantTypesToClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[ClaimParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.ClaimParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasRepresentative bit NOT NULL,
    HasPermissionGID uniqueidentifier NULL,
    AsInsured bit NOT NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[ClaimDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.ClaimDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ClaimDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[ClaimDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.ClaimDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[ClaimAdditionalRisks]
  --
  PRINT (N'Create table [dbo].[ClaimAdditionalRisks]')
  GO
  CREATE TABLE dbo.ClaimAdditionalRisks (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    ClaimGID uniqueidentifier NOT NULL,
    RiskGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[ClaimAdditionalRisks]
  --
  PRINT (N'Create table [log].[ClaimAdditionalRisks]')
  GO
  CREATE TABLE log.ClaimAdditionalRisks (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    ClaimGID uniqueidentifier NOT NULL,
    RiskGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[ChronologicalAssociationEntities]
  --
  PRINT (N'Create table [meta].[ChronologicalAssociationEntities]')
  GO
  CREATE TABLE meta.ChronologicalAssociationEntities (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    AssociationEntityGID uniqueidentifier NOT NULL,
    Date datetime NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CaseStatusWorkflows]
  --
  PRINT (N'Create table [meta].[CaseStatusWorkflows]')
  GO
  CREATE TABLE meta.CaseStatusWorkflows (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    FromGID uniqueidentifier NOT NULL,
    ToGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CasesDocuments]
  --
  PRINT (N'Create table [dbo].[CasesDocuments]')
  GO
  CREATE TABLE dbo.CasesDocuments (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CaseGID uniqueidentifier NOT NULL,
    DocumentGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    ProcessingStatusGID uniqueidentifier NULL,
    StatusGID uniqueidentifier NOT NULL,
    IsAccepted bit NOT NULL,
    ParentGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CasesDocuments]
  --
  PRINT (N'Create table [log].[CasesDocuments]')
  GO
  CREATE TABLE log.CasesDocuments (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    DocumentGID uniqueidentifier NOT NULL,
    AddDate datetime NOT NULL,
    AddUserGID uniqueidentifier NOT NULL,
    ProcessingStatusGID uniqueidentifier NULL,
    StatusGID uniqueidentifier NOT NULL,
    IsAccepted bit NOT NULL,
    ParentGID uniqueidentifier NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseRouteStepToUsers]
  --
  PRINT (N'Create table [dbo].[CaseRouteStepToUsers]')
  GO
  CREATE TABLE dbo.CaseRouteStepToUsers (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    UserGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseRouteStepToUsers]
  --
  PRINT (N'Create table [log].[CaseRouteStepToUsers]')
  GO
  CREATE TABLE log.CaseRouteStepToUsers (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    UserGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseRouteStepToRoles]
  --
  PRINT (N'Create table [dbo].[CaseRouteStepToRoles]')
  GO
  CREATE TABLE dbo.CaseRouteStepToRoles (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseRouteStepToRoles]
  --
  PRINT (N'Create table [log].[CaseRouteStepToRoles]')
  GO
  CREATE TABLE log.CaseRouteStepToRoles (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    StepGID uniqueidentifier NOT NULL,
    RoleGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseRouteSteps]
  --
  PRINT (N'Create table [dbo].[CaseRouteSteps]')
  GO
  CREATE TABLE dbo.CaseRouteSteps (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    PreviousGID uniqueidentifier NULL,
    CaseGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseRouteSteps]
  --
  PRINT (N'Create table [log].[CaseRouteSteps]')
  GO
  CREATE TABLE log.CaseRouteSteps (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    PreviousGID uniqueidentifier NULL,
    CaseGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseRequiredDocumentTypes]
  --
  PRINT (N'Create table [log].[CaseRequiredDocumentTypes]')
  GO
  CREATE TABLE log.CaseRequiredDocumentTypes (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseGID uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    IsRequired bit NOT NULL,
    IsNeeded bit NOT NULL,
    DateIsNeeded datetime NULL,
    IsAdded bit NOT NULL,
    AddUserGID uniqueidentifier NULL,
    DateIsAdded datetime NULL,
    OrderNumber int NULL,
    SubmitterTypeGID uniqueidentifier NULL,
    IsUploadAllowed bit NULL,
    UploadUserGID uniqueidentifier NULL,
    DateIsUploaded datetime NULL,
    SourceTypeGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    DeliveryTypeGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseRequiredDocumentTypes]
  --
  PRINT (N'Create table [dbo].[CaseRequiredDocumentTypes]')
  GO
  CREATE TABLE dbo.CaseRequiredDocumentTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CaseGID uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    IsRequired bit NOT NULL,
    IsNeeded bit NOT NULL,
    DateIsNeeded datetime NULL,
    IsAdded bit NOT NULL,
    AddUserGID uniqueidentifier NULL,
    DateIsAdded datetime NULL,
    OrderNumber int NULL,
    SubmitterTypeGID uniqueidentifier NULL,
    IsUploadAllowed bit NULL,
    UploadUserGID uniqueidentifier NULL,
    DateIsUploaded datetime NULL,
    SourceTypeGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    DeliveryTypeGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseHistoryStepToParameterValues]
  --
  PRINT (N'Create table [dbo].[CaseHistoryStepToParameterValues]')
  GO
  CREATE TABLE dbo.CaseHistoryStepToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CaseHistoryStepGID uniqueidentifier NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseHistoryStepToParameterValues]
  --
  PRINT (N'Create table [log].[CaseHistoryStepToParameterValues]')
  GO
  CREATE TABLE log.CaseHistoryStepToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CaseHistoryStepGID uniqueidentifier NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    AuthorGID uniqueidentifier NULL,
    Deleted bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CaseHistoryReasons]
  --
  PRINT (N'Create table [log].[CaseHistoryReasons]')
  GO
  CREATE TABLE log.CaseHistoryReasons (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    SourceCaseGID uniqueidentifier NOT NULL,
    NewCaseGID uniqueidentifier NOT NULL,
    ReasonGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CaseHistoryReasons]
  --
  PRINT (N'Create table [dbo].[CaseHistoryReasons]')
  GO
  CREATE TABLE dbo.CaseHistoryReasons (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    SourceCaseGID uniqueidentifier NOT NULL,
    NewCaseGID uniqueidentifier NOT NULL,
    ReasonGID uniqueidentifier NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CallReasonPropertiesToCallReasonsValues]
  --
  PRINT (N'Create table [meta].[CallReasonPropertiesToCallReasonsValues]')
  GO
  CREATE TABLE meta.CallReasonPropertiesToCallReasonsValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    Value sql_variant NOT NULL,
    ChildValueGID uniqueidentifier NULL,
    CallReasonPropertiesToCallReasonGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CallReasonPropertiesToCallReasons]
  --
  PRINT (N'Create table [meta].[CallReasonPropertiesToCallReasons]')
  GO
  CREATE TABLE meta.CallReasonPropertiesToCallReasons (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    CallReasonGID uniqueidentifier NOT NULL,
    CallReasonPropertyGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[CalculationToParameterValues]
  --
  PRINT (N'Create table [dbo].[CalculationToParameterValues]')
  GO
  CREATE TABLE dbo.CalculationToParameterValues (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CalculationGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[CalculationToParameterValues]
  --
  PRINT (N'Create table [log].[CalculationToParameterValues]')
  GO
  CREATE TABLE log.CalculationToParameterValues (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    CalculationGID uniqueidentifier NOT NULL,
    ParameterValue sql_variant NOT NULL,
    ParameterGID uniqueidentifier NOT NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CalculationParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[CalculationParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.CalculationParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    CalculationParticipantTypesToClaimTypeGID uniqueidentifier NOT NULL,
    ObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CalculationParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[CalculationParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.CalculationParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    ParticipantTypeGID uniqueidentifier NOT NULL,
    HasRepresentative bit NOT NULL,
    HasPermissionGID uniqueidentifier NULL,
    AsInsured bit NOT NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CalculationDocumentParameterValueToClaimTypes]
  --
  PRINT (N'Create table [meta].[CalculationDocumentParameterValueToClaimTypes]')
  GO
  CREATE TABLE meta.CalculationDocumentParameterValueToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterValueGID uniqueidentifier NOT NULL,
    IsDefault bit NOT NULL,
    Value sql_variant NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[CalculationDocumentParameterToClaimTypes]
  --
  PRINT (N'Create table [meta].[CalculationDocumentParameterToClaimTypes]')
  GO
  CREATE TABLE meta.CalculationDocumentParameterToClaimTypes (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DocumentTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL,
    DocumentParameterGID uniqueidentifier NOT NULL,
    IsMulti bit NOT NULL,
    IsCopied bit NOT NULL,
    DefaultValue sql_variant NULL,
    IsNotOrderByName bit NOT NULL,
    IsRequired bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [log].[AuctionWebsites]
  --
  PRINT (N'Create table [log].[AuctionWebsites]')
  GO
  CREATE TABLE log.AuctionWebsites (
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    LoggedEntityGID uniqueidentifier NOT NULL,
    ActionDate datetime NOT NULL,
    AuctionGID uniqueidentifier NOT NULL,
    WebsiteGID uniqueidentifier NOT NULL,
    Result decimal(18, 2) NULL,
    WinnerGID uniqueidentifier NULL,
    DocumentGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [dbo].[AuctionWebsites]
  --
  PRINT (N'Create table [dbo].[AuctionWebsites]')
  GO
  CREATE TABLE dbo.AuctionWebsites (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    AuctionGID uniqueidentifier NOT NULL,
    WebsiteGID uniqueidentifier NOT NULL,
    Result decimal(18, 2) NULL,
    WinnerGID uniqueidentifier NULL,
    DocumentGID uniqueidentifier NULL,
    Deleted bit NOT NULL,
    AuthorGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AttributesToRegressParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[AttributesToRegressParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.AttributesToRegressParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    AttributeGID uniqueidentifier NOT NULL,
    RegressParticipantTypesToClaimTypesToObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AttributesToPayableParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[AttributesToPayableParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.AttributesToPayableParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    AttributeGID uniqueidentifier NOT NULL,
    PayableParticipantTypesToClaimTypesToObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AttributesToObjectTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[AttributesToObjectTypesToClaimTypes]')
  GO
  CREATE TABLE meta.AttributesToObjectTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    AttributesToObjectTypeGID uniqueidentifier NOT NULL,
    ClaimTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AttributesToNotificationParticipantTypesToClaimTypes]
  --
  PRINT (N'Create table [meta].[AttributesToNotificationParticipantTypesToClaimTypes]')
  GO
  CREATE TABLE meta.AttributesToNotificationParticipantTypesToClaimTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL ROWGUIDCOL,
    AttributeGID uniqueidentifier NULL,
    NotificationParticipantTypesToClaimTypeGID uniqueidentifier NULL,
    IsMulti bit NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AttributesToClaimParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[AttributesToClaimParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.AttributesToClaimParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    AttributeGID uniqueidentifier NOT NULL,
    ClaimParticipantTypesToClaimTypesToObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AttributesToCalculationParticipantTypesToClaimTypesToObjectTypes]
  --
  PRINT (N'Create table [meta].[AttributesToCalculationParticipantTypesToClaimTypesToObjectTypes]')
  GO
  CREATE TABLE meta.AttributesToCalculationParticipantTypesToClaimTypesToObjectTypes (
    id bigint IDENTITY,
    gid uniqueidentifier NOT NULL,
    AttributeGID uniqueidentifier NOT NULL,
    CalculationParticipantTypesToClaimTypesToObjectTypeGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AssociationValues]
  --
  PRINT (N'Create table [meta].[AssociationValues]')
  GO
  CREATE TABLE meta.AssociationValues (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DependentEntityValueGID uniqueidentifier NULL,
    LowerBoundValue sql_variant NULL,
    UpperBoundValue sql_variant NULL,
    BoolValue bit NULL,
    AssociationValueGroupGID uniqueidentifier NOT NULL,
    ParentGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AssociationValueGroupToOperations]
  --
  PRINT (N'Create table [meta].[AssociationValueGroupToOperations]')
  GO
  CREATE TABLE meta.AssociationValueGroupToOperations (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    AssociationValueGroupGID uniqueidentifier NOT NULL,
    AssociationEntityToOperationGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AssociationEntityToOperations]
  --
  PRINT (N'Create table [meta].[AssociationEntityToOperations]')
  GO
  CREATE TABLE meta.AssociationEntityToOperations (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    AssociationEntityGID uniqueidentifier NOT NULL,
    AssociatedOperationGID uniqueidentifier NOT NULL,
    ExpressionGID uniqueidentifier NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AffectingValues]
  --
  PRINT (N'Create table [meta].[AffectingValues]')
  GO
  CREATE TABLE meta.AffectingValues (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DependentEntityValueGID uniqueidentifier NULL,
    LowerBoundValue sql_variant NULL,
    UpperBoundValue sql_variant NULL,
    BoolValue bit NULL,
    AffectingValueGroupGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AffectingValueGroupToOperations]
  --
  PRINT (N'Create table [meta].[AffectingValueGroupToOperations]')
  GO
  CREATE TABLE meta.AffectingValueGroupToOperations (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    AffectingValueGroupGID uniqueidentifier NOT NULL,
    AssociationEntityToOperationGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AffectingEntities]
  --
  PRINT (N'Create table [meta].[AffectingEntities]')
  GO
  CREATE TABLE meta.AffectingEntities (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    DependentEntityTypeGID uniqueidentifier NOT NULL,
    DependentEntityGID uniqueidentifier NULL,
    AssociationEntityGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  
  --
  -- Create table [meta].[AccountStatusWorkflows]
  --
  PRINT (N'Create table [meta].[AccountStatusWorkflows]')
  GO
  CREATE TABLE meta.AccountStatusWorkflows (
    id int IDENTITY,
    gid uniqueidentifier NOT NULL,
    CurrentStatusGID uniqueidentifier NOT NULL,
    AvailableStatusGID uniqueidentifier NOT NULL
  )
  ON [PRIMARY]
  GO
  SET NOEXEC OFF
  GO