Advertisement
Guest User

sql file

a guest
May 29th, 2013
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.64 KB | None | 0 0
  1. USE [FileSharePortal]
  2. GO
  3. /****** Object: Table [dbo].[Account] Script Date: 05/17/2013 22:44:03 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. SET ANSI_PADDING ON
  9. GO
  10. CREATE TABLE [dbo].[Account](
  11. [ID] [uniqueidentifier] ROWGUIDCOL NOT NULL,
  12. [MSISDN] [varchar](20) NULL,
  13. [Username] [varchar](256) NULL,
  14. [Password] [varchar](256) NULL,
  15. [Email] [varchar](256) NULL,
  16. [IsEnable] [bit] NULL,
  17. CONSTRAINT [PK_Account] PRIMARY KEY CLUSTERED
  18. (
  19. [ID] ASC
  20. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  21. ) ON [PRIMARY]
  22. GO
  23. SET ANSI_PADDING OFF
  24. GO
  25. 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)
  26. 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)
  27. /****** Object: Table [dbo].[FileStore] Script Date: 05/17/2013 22:44:04 ******/
  28. SET ANSI_NULLS ON
  29. GO
  30. SET QUOTED_IDENTIFIER ON
  31. GO
  32. SET ANSI_PADDING ON
  33. GO
  34. CREATE TABLE [dbo].[FileStore](
  35. [ID] [uniqueidentifier] NOT NULL,
  36. [AccountID] [uniqueidentifier] NULL,
  37. [Url] [varchar](256) NULL,
  38. [ContentType] [varchar](256) NULL,
  39. [DateTime] [datetime] NULL,
  40. [FileSize] [bigint] NULL,
  41. [ToMSISDN] [varchar](20) NULL,
  42. [FromMSISDN] [varchar](20) NULL,
  43. [FileName] [nvarchar](max) NULL,
  44. [IsPublic] [bit] NULL,
  45. [SMSText] [nvarchar](max) NULL,
  46. CONSTRAINT [PK_FileStore] PRIMARY KEY CLUSTERED
  47. (
  48. [ID] ASC
  49. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  50. ) ON [PRIMARY]
  51. GO
  52. SET ANSI_PADDING OFF
  53. GO
  54. 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')
  55. /****** Object: Table [dbo].[Oprator] Script Date: 05/17/2013 22:44:04 ******/
  56. SET ANSI_NULLS ON
  57. GO
  58. SET QUOTED_IDENTIFIER ON
  59. GO
  60. SET ANSI_PADDING ON
  61. GO
  62. CREATE TABLE [dbo].[Oprator](
  63. [ID] [int] IDENTITY(1,1) NOT NULL,
  64. [Name] [varchar](50) NOT NULL,
  65. [Status] [bit] NOT NULL,
  66. CONSTRAINT [PK_Oprator] PRIMARY KEY CLUSTERED
  67. (
  68. [ID] ASC
  69. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  70. ) ON [PRIMARY]
  71. GO
  72. SET ANSI_PADDING OFF
  73. GO
  74. /****** Object: Table [dbo].[Message] Script Date: 05/17/2013 22:44:04 ******/
  75. SET ANSI_NULLS ON
  76. GO
  77. SET QUOTED_IDENTIFIER ON
  78. GO
  79. SET ANSI_PADDING ON
  80. GO
  81. CREATE TABLE [dbo].[Message](
  82. [ID] [bigint] IDENTITY(1,1) NOT NULL,
  83. [MobileNumber] [varchar](20) NOT NULL,
  84. [Body] [nvarchar](256) NOT NULL,
  85. [OpratorID] [int] NULL,
  86. [Type] [tinyint] NOT NULL,
  87. [Status] [bit] NOT NULL,
  88. CONSTRAINT [PK_Message] PRIMARY KEY CLUSTERED
  89. (
  90. [ID] ASC
  91. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  92. ) ON [PRIMARY]
  93. GO
  94. SET ANSI_PADDING OFF
  95. GO
  96. /****** Object: View [dbo].[File] Script Date: 05/17/2013 22:44:04 ******/
  97. SET ANSI_NULLS ON
  98. GO
  99. SET QUOTED_IDENTIFIER ON
  100. GO
  101. CREATE VIEW [dbo].[File]
  102. AS
  103. 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,
  104. fs.IsPublic, fs.SMSText AS Message, fs.ToMSISDN AS SenderNumber, fs.FromMSISDN AS ReceiveNumber,
  105. (CASE WHEN acc.MSISDN = ToMSISDN THEN 'Receive' ELSE 'Send' END) AS Mode
  106. FROM dbo.FileStore AS fs INNER JOIN
  107. dbo.Account AS acc ON fs.AccountID = acc.ID
  108. ORDER BY fs.DateTime DESC
  109. GO
  110. EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
  111. Begin DesignProperties =
  112. Begin PaneConfigurations =
  113. Begin PaneConfiguration = 0
  114. NumPanes = 4
  115. Configuration = "(H (1[33] 4[37] 2[26] 3) )"
  116. End
  117. Begin PaneConfiguration = 1
  118. NumPanes = 3
  119. Configuration = "(H (1 [50] 4 [25] 3))"
  120. End
  121. Begin PaneConfiguration = 2
  122. NumPanes = 3
  123. Configuration = "(H (1 [50] 2 [25] 3))"
  124. End
  125. Begin PaneConfiguration = 3
  126. NumPanes = 3
  127. Configuration = "(H (4 [30] 2 [40] 3))"
  128. End
  129. Begin PaneConfiguration = 4
  130. NumPanes = 2
  131. Configuration = "(H (1 [56] 3))"
  132. End
  133. Begin PaneConfiguration = 5
  134. NumPanes = 2
  135. Configuration = "(H (2 [66] 3))"
  136. End
  137. Begin PaneConfiguration = 6
  138. NumPanes = 2
  139. Configuration = "(H (4 [50] 3))"
  140. End
  141. Begin PaneConfiguration = 7
  142. NumPanes = 1
  143. Configuration = "(V (3))"
  144. End
  145. Begin PaneConfiguration = 8
  146. NumPanes = 3
  147. Configuration = "(H (1[56] 4[18] 2) )"
  148. End
  149. Begin PaneConfiguration = 9
  150. NumPanes = 2
  151. Configuration = "(H (1 [75] 4))"
  152. End
  153. Begin PaneConfiguration = 10
  154. NumPanes = 2
  155. Configuration = "(H (1[66] 2) )"
  156. End
  157. Begin PaneConfiguration = 11
  158. NumPanes = 2
  159. Configuration = "(H (4 [60] 2))"
  160. End
  161. Begin PaneConfiguration = 12
  162. NumPanes = 1
  163. Configuration = "(H (1) )"
  164. End
  165. Begin PaneConfiguration = 13
  166. NumPanes = 1
  167. Configuration = "(V (4))"
  168. End
  169. Begin PaneConfiguration = 14
  170. NumPanes = 1
  171. Configuration = "(V (2))"
  172. End
  173. ActivePaneConfig = 0
  174. End
  175. Begin DiagramPane =
  176. Begin Origin =
  177. Top = 0
  178. Left = 0
  179. End
  180. Begin Tables =
  181. Begin Table = "fs"
  182. Begin Extent =
  183. Top = 6
  184. Left = 38
  185. Bottom = 168
  186. Right = 198
  187. End
  188. DisplayFlags = 280
  189. TopColumn = 1
  190. End
  191. Begin Table = "acc"
  192. Begin Extent =
  193. Top = 5
  194. Left = 305
  195. Bottom = 151
  196. Right = 465
  197. End
  198. DisplayFlags = 280
  199. TopColumn = 0
  200. End
  201. End
  202. End
  203. Begin SQLPane =
  204. End
  205. Begin DataPane =
  206. Begin ParameterDefaults = ""
  207. End
  208. Begin ColumnWidths = 13
  209. Width = 284
  210. Width = 1500
  211. Width = 1500
  212. Width = 1500
  213. Width = 1500
  214. Width = 1500
  215. Width = 1500
  216. Width = 1500
  217. Width = 1500
  218. Width = 1500
  219. Width = 1500
  220. Width = 1500
  221. Width = 1500
  222. End
  223. End
  224. Begin CriteriaPane =
  225. Begin ColumnWidths = 11
  226. Column = 5550
  227. Alias = 2115
  228. Table = 1170
  229. Output = 720
  230. Append = 1400
  231. NewValue = 1170
  232. SortType = 1350
  233. SortOrder = 1410
  234. GroupBy = 1350
  235. Filter = 1350
  236. Or = 1350
  237. Or = 675
  238. Or = 1350
  239. End
  240. End
  241. End
  242. ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'File'
  243. GO
  244. EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'File'
  245. GO
  246. /****** Object: Default [DF_Account_ID] Script Date: 05/17/2013 22:44:04 ******/
  247. ALTER TABLE [dbo].[Account] ADD CONSTRAINT [DF_Account_ID] DEFAULT (newid()) FOR [ID]
  248. GO
  249. /****** Object: Default [DF_Message_Type] Script Date: 05/17/2013 22:44:04 ******/
  250. ALTER TABLE [dbo].[Message] ADD CONSTRAINT [DF_Message_Type] DEFAULT ((2)) FOR [Type]
  251. GO
  252. /****** Object: Default [DF_Message_Status] Script Date: 05/17/2013 22:44:04 ******/
  253. ALTER TABLE [dbo].[Message] ADD CONSTRAINT [DF_Message_Status] DEFAULT ((0)) FOR [Status]
  254. GO
  255. /****** Object: Default [DF_Oprator_Status] Script Date: 05/17/2013 22:44:04 ******/
  256. ALTER TABLE [dbo].[Oprator] ADD CONSTRAINT [DF_Oprator_Status] DEFAULT ('True') FOR [Status]
  257. GO
  258. /****** Object: ForeignKey [FK_Message_Message] Script Date: 05/17/2013 22:44:04 ******/
  259. ALTER TABLE [dbo].[Message] WITH CHECK ADD CONSTRAINT [FK_Message_Message] FOREIGN KEY([OpratorID])
  260. REFERENCES [dbo].[Oprator] ([ID])
  261. GO
  262. ALTER TABLE [dbo].[Message] CHECK CONSTRAINT [FK_Message_Message]
  263. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement