CreateTable(
"dbo.Provider",
c => new
{
ProviderId = c.Int(nullable: false, identity: true),
ProviderCode = c.String(nullable: false, maxLength: 10),
ProviderName = c.String(nullable: false, maxLength: 200),
GoliveDateTime = c.DateTime(),
FileFormatId = c.Int(nullable: false),
ShortName = c.String(maxLength: 20),
NeedsMmiApproval = c.Boolean(nullable: false),
InterfaceXml = c.Boolean(nullable: false),
InterfaceSoap = c.Boolean(nullable: false),
InterfaceBatch = c.Boolean(nullable: false),
OnBehalf = c.Boolean(nullable: false),
ActiveDurationDays = c.Int(nullable: false),
ManualMergeRequired = c.Boolean(nullable: false),
})
.PrimaryKey(t => t.ProviderId)
.ForeignKey("dbo.Reference_FileFormat", t => t.FileFormatId)
.Index(t => t.FileFormatId);
bool exists = context.Database
.SqlQuery<int?>(@"
SELECT 1 FROM sys.tables AS T
INNER JOIN sys.schemas AS S ON T.schema_id = S.schema_id
WHERE S.Name = 'SchemaName' AND T.Name = 'TableName'")
.SingleOrDefault() != null;