Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [FileSharePortal]
- GO
- /****** Object: Table [dbo].[Account] Script Date: 05/17/2013 22:44:03 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- SET ANSI_PADDING ON
- GO
- CREATE TABLE [dbo].[Account](
- [ID] [uniqueidentifier] ROWGUIDCOL NOT NULL,
- [MSISDN] [varchar](20) NULL,
- [Username] [varchar](256) NULL,
- [Password] [varchar](256) NULL,
- [Email] [varchar](256) NULL,
- [IsEnable] [bit] NULL,
- CONSTRAINT [PK_Account] 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]
- GO
- SET ANSI_PADDING OFF
- GO
- INSERT [dbo].[Account] ([ID], [MSISDN], [Username], [Password], [Email], [IsEnable]) VALUES (N'7f8fa012-af79-45da-b207-c5b8c9b545f0', N'0511234567', N'test', N'test', N'test@localhost', 1)
- INSERT [dbo].[Account] ([ID], [MSISDN], [Username], [Password], [Email], [IsEnable]) VALUES (N'cea4259d-c3c6-4d1f-b417-d025a5bf350b', N'0521234567', N'test2', N'test2', N'test2@localhost', 1)
- /****** Object: Table [dbo].[FileStore] Script Date: 05/17/2013 22:44:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- SET ANSI_PADDING ON
- GO
- CREATE TABLE [dbo].[FileStore](
- [ID] [uniqueidentifier] NOT NULL,
- [AccountID] [uniqueidentifier] NULL,
- [Url] [varchar](256) NULL,
- [ContentType] [varchar](256) NULL,
- [DateTime] [datetime] NULL,
- [FileSize] [bigint] NULL,
- [ToMSISDN] [varchar](20) NULL,
- [FromMSISDN] [varchar](20) NULL,
- [FileName] [nvarchar](max) NULL,
- [IsPublic] [bit] NULL,
- [SMSText] [nvarchar](max) NULL,
- CONSTRAINT [PK_FileStore] 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]
- GO
- SET ANSI_PADDING OFF
- GO
- INSERT [dbo].[FileStore] ([ID], [AccountID], [Url], [ContentType], [DateTime], [FileSize], [ToMSISDN], [FromMSISDN], [FileName], [IsPublic], [SMSText]) VALUES (N'00000000-0000-0000-0000-000000000000', N'7f8fa012-af79-45da-b207-c5b8c9b545f0', N'D:\htdocs\fileshare\Files\/1c0c9610-229a-4c2f-ac0c-53f8eee55f01.mp3', N'audio/mpeg', CAST(0x0000A1C0011630BE AS DateTime), 7938253, N'052-123-4567', N'0511234567', N'ji', 0, N'han')
- /****** Object: Table [dbo].[Oprator] Script Date: 05/17/2013 22:44:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- SET ANSI_PADDING ON
- GO
- CREATE TABLE [dbo].[Oprator](
- [ID] [int] IDENTITY(1,1) NOT NULL,
- [Name] [varchar](50) NOT NULL,
- [Status] [bit] NOT NULL,
- CONSTRAINT [PK_Oprator] 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]
- GO
- SET ANSI_PADDING OFF
- GO
- /****** Object: Table [dbo].[Message] Script Date: 05/17/2013 22:44:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- SET ANSI_PADDING ON
- GO
- CREATE TABLE [dbo].[Message](
- [ID] [bigint] IDENTITY(1,1) NOT NULL,
- [MobileNumber] [varchar](20) NOT NULL,
- [Body] [nvarchar](256) NOT NULL,
- [OpratorID] [int] NULL,
- [Type] [tinyint] NOT NULL,
- [Status] [bit] NOT NULL,
- CONSTRAINT [PK_Message] 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]
- GO
- SET ANSI_PADDING OFF
- GO
- /****** Object: View [dbo].[File] Script Date: 05/17/2013 22:44:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE VIEW [dbo].[File]
- AS
- SELECT TOP (100) PERCENT fs.ID, fs.AccountID, fs.Url, SUBSTRING(fs.ContentType, 0, CHARINDEX('/', fs.ContentType)) AS FileType, fs.DateTime, fs.FileSize, fs.FileName,
- fs.IsPublic, fs.SMSText AS Message, fs.ToMSISDN AS SenderNumber, fs.FromMSISDN AS ReceiveNumber,
- (CASE WHEN acc.MSISDN = ToMSISDN THEN 'Receive' ELSE 'Send' END) AS Mode
- FROM dbo.FileStore AS fs INNER JOIN
- dbo.Account AS acc ON fs.AccountID = acc.ID
- ORDER BY fs.DateTime DESC
- GO
- EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
- Begin DesignProperties =
- Begin PaneConfigurations =
- Begin PaneConfiguration = 0
- NumPanes = 4
- Configuration = "(H (1[33] 4[37] 2[26] 3) )"
- End
- Begin PaneConfiguration = 1
- NumPanes = 3
- Configuration = "(H (1 [50] 4 [25] 3))"
- End
- Begin PaneConfiguration = 2
- NumPanes = 3
- Configuration = "(H (1 [50] 2 [25] 3))"
- End
- Begin PaneConfiguration = 3
- NumPanes = 3
- Configuration = "(H (4 [30] 2 [40] 3))"
- End
- Begin PaneConfiguration = 4
- NumPanes = 2
- Configuration = "(H (1 [56] 3))"
- End
- Begin PaneConfiguration = 5
- NumPanes = 2
- Configuration = "(H (2 [66] 3))"
- End
- Begin PaneConfiguration = 6
- NumPanes = 2
- Configuration = "(H (4 [50] 3))"
- End
- Begin PaneConfiguration = 7
- NumPanes = 1
- Configuration = "(V (3))"
- End
- Begin PaneConfiguration = 8
- NumPanes = 3
- Configuration = "(H (1[56] 4[18] 2) )"
- End
- Begin PaneConfiguration = 9
- NumPanes = 2
- Configuration = "(H (1 [75] 4))"
- End
- Begin PaneConfiguration = 10
- NumPanes = 2
- Configuration = "(H (1[66] 2) )"
- End
- Begin PaneConfiguration = 11
- NumPanes = 2
- Configuration = "(H (4 [60] 2))"
- End
- Begin PaneConfiguration = 12
- NumPanes = 1
- Configuration = "(H (1) )"
- End
- Begin PaneConfiguration = 13
- NumPanes = 1
- Configuration = "(V (4))"
- End
- Begin PaneConfiguration = 14
- NumPanes = 1
- Configuration = "(V (2))"
- End
- ActivePaneConfig = 0
- End
- Begin DiagramPane =
- Begin Origin =
- Top = 0
- Left = 0
- End
- Begin Tables =
- Begin Table = "fs"
- Begin Extent =
- Top = 6
- Left = 38
- Bottom = 168
- Right = 198
- End
- DisplayFlags = 280
- TopColumn = 1
- End
- Begin Table = "acc"
- Begin Extent =
- Top = 5
- Left = 305
- Bottom = 151
- Right = 465
- End
- DisplayFlags = 280
- TopColumn = 0
- End
- End
- End
- Begin SQLPane =
- End
- Begin DataPane =
- Begin ParameterDefaults = ""
- End
- Begin ColumnWidths = 13
- Width = 284
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- Width = 1500
- End
- End
- Begin CriteriaPane =
- Begin ColumnWidths = 11
- Column = 5550
- Alias = 2115
- Table = 1170
- Output = 720
- Append = 1400
- NewValue = 1170
- SortType = 1350
- SortOrder = 1410
- GroupBy = 1350
- Filter = 1350
- Or = 1350
- Or = 675
- Or = 1350
- End
- End
- End
- ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'File'
- GO
- EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'File'
- GO
- /****** Object: Default [DF_Account_ID] Script Date: 05/17/2013 22:44:04 ******/
- ALTER TABLE [dbo].[Account] ADD CONSTRAINT [DF_Account_ID] DEFAULT (newid()) FOR [ID]
- GO
- /****** Object: Default [DF_Message_Type] Script Date: 05/17/2013 22:44:04 ******/
- ALTER TABLE [dbo].[Message] ADD CONSTRAINT [DF_Message_Type] DEFAULT ((2)) FOR [Type]
- GO
- /****** Object: Default [DF_Message_Status] Script Date: 05/17/2013 22:44:04 ******/
- ALTER TABLE [dbo].[Message] ADD CONSTRAINT [DF_Message_Status] DEFAULT ((0)) FOR [Status]
- GO
- /****** Object: Default [DF_Oprator_Status] Script Date: 05/17/2013 22:44:04 ******/
- ALTER TABLE [dbo].[Oprator] ADD CONSTRAINT [DF_Oprator_Status] DEFAULT ('True') FOR [Status]
- GO
- /****** Object: ForeignKey [FK_Message_Message] Script Date: 05/17/2013 22:44:04 ******/
- ALTER TABLE [dbo].[Message] WITH CHECK ADD CONSTRAINT [FK_Message_Message] FOREIGN KEY([OpratorID])
- REFERENCES [dbo].[Oprator] ([ID])
- GO
- ALTER TABLE [dbo].[Message] CHECK CONSTRAINT [FK_Message_Message]
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement