﻿CREATE TABLE [session].[State]
(
	[Id] BIGINT NOT NULL PRIMARY KEY IDENTITY, 
  [SessionId] [session].[SessionSurrogateKey] NOT NULL, 
  [Document] NVARCHAR(MAX) NOT NULL,
    
  CONSTRAINT [FK_State_ToSession] FOREIGN KEY (SessionId) REFERENCES [session].[Session](Id),
  CONSTRAINT [StateDocument must be JSON] CHECK(ISJSON(Document)=1)
)
