SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tuan]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tuan](
	[id] [int] NOT NULL,
	[uid] [int] NULL,
	[shorttitle] [nvarchar](255) NULL,
	[fulltitle] [nvarchar](255) NULL,
	[tuannote] [nvarchar](max) NULL,
	[oldprice] [money] NULL,
	[tuanprice] [money] NULL,
	[lowestbuy] [int] NULL,
	[starttime] [datetime] NULL,
	[endtime] [datetime] NULL,
	[slogan1] [nvarchar](255) NULL,
	[slogan2] [nvarchar](255) NULL,
	[classid] [int] NULL,
	[thumbnail] [nvarchar](255) NULL,
	[content] [nvarchar](max) NULL,
	[time] [datetime] NULL,
	[enable] [bit] NOT NULL,
	[lowesttime] [nvarchar](255) NULL
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tuan_buy]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tuan_buy](
	[id] [int] NOT NULL,
	[time] [datetime] NULL,
	[uid] [int] NULL,
	[fid] [int] NULL,
	[state] [nvarchar](255) NULL,
	[price] [int] NULL,
	[OrderCode] [nvarchar](255) NULL,
	[RandomCode] [nvarchar](255) NULL,
	[tel] [nvarchar](255) NULL
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tuan_class]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tuan_class](
	[id] [int] NOT NULL,
	[n] [nvarchar](255) NULL,
	[sorting] [int] NULL
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tuan_email]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tuan_email](
	[id] [int] NOT NULL,
	[time] [datetime] NULL,
	[address] [nvarchar](255) NULL,
	[enable] [bit] NOT NULL,
	[sendstate] [bit] NOT NULL
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tuan_sms]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tuan_sms](
	[id] [int] NOT NULL,
	[time] [datetime] NULL,
	[address] [nvarchar](255) NULL,
	[enable] [bit] NOT NULL,
	[sendstate] [bit] NOT NULL
) ON [PRIMARY]
END
