internal static void DropPackagesTable(SnDataContext ctx) { var sql = @" IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Packages]') AND type in (N'U')) DROP TABLE [dbo].[Packages] "; ctx.ExecuteNonQueryAsync(sql).GetAwaiter().GetResult(); }
internal static void InstallPackagesTable(SnDataContext ctx) { var sql = @" CREATE TABLE [dbo].[Packages]( [Id] [int] IDENTITY(1,1) NOT NULL, [PackageType] [varchar](50) NOT NULL, [ComponentId] [nvarchar](450) NULL, [ComponentVersion] [varchar](50) NULL, [ReleaseDate] [datetime2](7) NOT NULL, [ExecutionDate] [datetime2](7) NOT NULL, [ExecutionResult] [varchar](50) NOT NULL, [ExecutionError] [nvarchar](max) NULL, [Description] [nvarchar](1000) NULL, [Manifest] [nvarchar](max) NULL, CONSTRAINT [PK_Packages] PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] "; ctx.ExecuteNonQueryAsync(sql).GetAwaiter().GetResult(); }