You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

284 lines
13 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. namespace Sevomin.Models.Migrations
  2. {
  3. using System;
  4. using System.Data.Entity.Migrations;
  5. public partial class Init : DbMigration
  6. {
  7. public override void Up()
  8. {
  9. CreateTable(
  10. "dbo.Ads",
  11. c => new
  12. {
  13. Id = c.Long(nullable: false, identity: true),
  14. Title = c.String(),
  15. Description = c.String(),
  16. Duration = c.Int(nullable: false),
  17. ClickCount = c.Long(nullable: false),
  18. Link = c.String(),
  19. CreatedDate = c.DateTime(nullable: false),
  20. Active = c.Boolean(nullable: false),
  21. })
  22. .PrimaryKey(t => t.Id);
  23. CreateTable(
  24. "dbo.DovominJobs",
  25. c => new
  26. {
  27. Id = c.Long(nullable: false, identity: true),
  28. DovominId = c.String(nullable: false, maxLength: 128),
  29. JobId = c.Long(nullable: false),
  30. ApplyDate = c.DateTime(nullable: false),
  31. CoverLetter = c.String(),
  32. Affinity = c.Decimal(nullable: false, precision: 18, scale: 2),
  33. MinimumRequirement = c.Boolean(nullable: false),
  34. AvalinSeen = c.DateTime(),
  35. AvalinComment = c.String(),
  36. AvalinDelete = c.Boolean(nullable: false),
  37. })
  38. .PrimaryKey(t => t.Id)
  39. .ForeignKey("dbo.Dovomin", t => t.DovominId)
  40. .ForeignKey("dbo.Jobs", t => t.JobId, cascadeDelete: true)
  41. .Index(t => new { t.DovominId, t.JobId }, unique: true, name: "IX_DovominJobUniqueIndex")
  42. .Index(t => t.JobId);
  43. CreateTable(
  44. "dbo.AspNetUsers",
  45. c => new
  46. {
  47. Id = c.String(nullable: false, maxLength: 128),
  48. DisplayName = c.String(),
  49. SignUpDate = c.DateTime(nullable: false),
  50. ConfirmationCode = c.String(),
  51. Email = c.String(maxLength: 256),
  52. EmailConfirmed = c.Boolean(nullable: false),
  53. PasswordHash = c.String(),
  54. SecurityStamp = c.String(),
  55. PhoneNumber = c.String(),
  56. PhoneNumberConfirmed = c.Boolean(nullable: false),
  57. TwoFactorEnabled = c.Boolean(nullable: false),
  58. LockoutEndDateUtc = c.DateTime(),
  59. LockoutEnabled = c.Boolean(nullable: false),
  60. AccessFailedCount = c.Int(nullable: false),
  61. UserName = c.String(nullable: false, maxLength: 256),
  62. })
  63. .PrimaryKey(t => t.Id)
  64. .Index(t => t.UserName, unique: true, name: "UserNameIndex");
  65. CreateTable(
  66. "dbo.AspNetUserClaims",
  67. c => new
  68. {
  69. Id = c.Int(nullable: false, identity: true),
  70. UserId = c.String(nullable: false, maxLength: 128),
  71. ClaimType = c.String(),
  72. ClaimValue = c.String(),
  73. })
  74. .PrimaryKey(t => t.Id)
  75. .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
  76. .Index(t => t.UserId);
  77. CreateTable(
  78. "dbo.DovominParameters",
  79. c => new
  80. {
  81. Id = c.Long(nullable: false, identity: true),
  82. ParameterId = c.Long(nullable: false),
  83. DovominId = c.String(nullable: false, maxLength: 128),
  84. StringValue = c.String(),
  85. NumericValue = c.Decimal(precision: 18, scale: 2),
  86. })
  87. .PrimaryKey(t => t.Id)
  88. .ForeignKey("dbo.Dovomin", t => t.DovominId)
  89. .ForeignKey("dbo.Parameters", t => t.ParameterId, cascadeDelete: true)
  90. .Index(t => new { t.ParameterId, t.DovominId }, unique: true, name: "IX_DovominParameterUniqueIndex")
  91. .Index(t => t.DovominId);
  92. CreateTable(
  93. "dbo.Parameters",
  94. c => new
  95. {
  96. Id = c.Long(nullable: false, identity: true),
  97. Name = c.String(nullable: false),
  98. Moscow = c.Boolean(nullable: false),
  99. DisplayMethod = c.Byte(nullable: false),
  100. DisplayFormat = c.String(maxLength: 50),
  101. GroupName = c.String(nullable: false),
  102. CommentAvalin = c.String(maxLength: 140),
  103. CommentDovomin = c.String(maxLength: 140),
  104. ParameterValueId = c.String(maxLength: 50),
  105. BasePoint = c.Int(nullable: false),
  106. ParameterType = c.Int(nullable: false),
  107. })
  108. .PrimaryKey(t => t.Id);
  109. CreateTable(
  110. "dbo.JobParameters",
  111. c => new
  112. {
  113. Id = c.Long(nullable: false, identity: true),
  114. ParameterId = c.Long(nullable: false),
  115. JobId = c.Long(nullable: false),
  116. StringValue = c.String(),
  117. NumericValue = c.Decimal(precision: 18, scale: 2),
  118. Moscow = c.Byte(nullable: false),
  119. })
  120. .PrimaryKey(t => t.Id)
  121. .ForeignKey("dbo.Jobs", t => t.JobId, cascadeDelete: true)
  122. .ForeignKey("dbo.Parameters", t => t.ParameterId, cascadeDelete: true)
  123. .Index(t => new { t.ParameterId, t.JobId }, unique: true, name: "IX_JobParameterUniqueIndex")
  124. .Index(t => t.JobId);
  125. CreateTable(
  126. "dbo.Jobs",
  127. c => new
  128. {
  129. Id = c.Long(nullable: false, identity: true),
  130. AvalinId = c.String(nullable: false, maxLength: 128),
  131. CreateDate = c.DateTime(nullable: false),
  132. ExpireDate = c.DateTime(nullable: false),
  133. Description = c.String(),
  134. ResumeType = c.Byte(nullable: false),
  135. ContactPersonName = c.String(),
  136. ContactPersonPhone = c.String(),
  137. ContactPersonEMail = c.String(),
  138. ShowCompanyName = c.Boolean(nullable: false),
  139. ShowCompanyLogo = c.Boolean(nullable: false),
  140. IsFullTime = c.Boolean(nullable: false),
  141. })
  142. .PrimaryKey(t => t.Id)
  143. .ForeignKey("dbo.Avalin", t => t.AvalinId)
  144. .Index(t => t.AvalinId);
  145. CreateTable(
  146. "dbo.AspNetUserLogins",
  147. c => new
  148. {
  149. LoginProvider = c.String(nullable: false, maxLength: 128),
  150. ProviderKey = c.String(nullable: false, maxLength: 128),
  151. UserId = c.String(nullable: false, maxLength: 128),
  152. })
  153. .PrimaryKey(t => new { t.LoginProvider, t.ProviderKey, t.UserId })
  154. .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
  155. .Index(t => t.UserId);
  156. CreateTable(
  157. "dbo.AspNetUserRoles",
  158. c => new
  159. {
  160. UserId = c.String(nullable: false, maxLength: 128),
  161. RoleId = c.String(nullable: false, maxLength: 128),
  162. })
  163. .PrimaryKey(t => new { t.UserId, t.RoleId })
  164. .ForeignKey("dbo.AspNetRoles", t => t.RoleId, cascadeDelete: true)
  165. .ForeignKey("dbo.AspNetUsers", t => t.UserId, cascadeDelete: true)
  166. .Index(t => t.UserId)
  167. .Index(t => t.RoleId);
  168. CreateTable(
  169. "dbo.ParameterValues",
  170. c => new
  171. {
  172. GroupKey = c.String(nullable: false, maxLength: 50),
  173. Value = c.String(nullable: false, maxLength: 50),
  174. NumbericValue = c.Decimal(nullable: false, precision: 18, scale: 2),
  175. })
  176. .PrimaryKey(t => new { t.GroupKey, t.Value })
  177. .Index(t => t.GroupKey);
  178. CreateTable(
  179. "dbo.AspNetRoles",
  180. c => new
  181. {
  182. Id = c.String(nullable: false, maxLength: 128),
  183. Name = c.String(nullable: false, maxLength: 256),
  184. })
  185. .PrimaryKey(t => t.Id)
  186. .Index(t => t.Name, unique: true, name: "RoleNameIndex");
  187. CreateTable(
  188. "dbo.Dovomin",
  189. c => new
  190. {
  191. Id = c.String(nullable: false, maxLength: 128),
  192. FirstName = c.String(),
  193. LastName = c.String(),
  194. BirthDate = c.DateTime(),
  195. IsFulltime = c.Boolean(nullable: false),
  196. IsPartTime = c.Boolean(nullable: false),
  197. Description = c.String(),
  198. EnglishResume = c.String(),
  199. PersianResume = c.String(),
  200. OptOutEmail = c.Boolean(nullable: false),
  201. })
  202. .PrimaryKey(t => t.Id)
  203. .ForeignKey("dbo.AspNetUsers", t => t.Id)
  204. .Index(t => t.Id);
  205. CreateTable(
  206. "dbo.Avalin",
  207. c => new
  208. {
  209. Id = c.String(nullable: false, maxLength: 128),
  210. CompanyName = c.String(nullable: false),
  211. NationalId = c.String(maxLength: 12),
  212. RegisterId = c.String(maxLength: 10),
  213. Address = c.String(),
  214. CompanyPhoneNumber = c.String(),
  215. EMail = c.String(),
  216. })
  217. .PrimaryKey(t => t.Id)
  218. .ForeignKey("dbo.AspNetUsers", t => t.Id)
  219. .Index(t => t.Id);
  220. }
  221. public override void Down()
  222. {
  223. DropForeignKey("dbo.Avalin", "Id", "dbo.AspNetUsers");
  224. DropForeignKey("dbo.Dovomin", "Id", "dbo.AspNetUsers");
  225. DropForeignKey("dbo.AspNetUserRoles", "UserId", "dbo.AspNetUsers");
  226. DropForeignKey("dbo.AspNetUserLogins", "UserId", "dbo.AspNetUsers");
  227. DropForeignKey("dbo.AspNetUserClaims", "UserId", "dbo.AspNetUsers");
  228. DropForeignKey("dbo.AspNetUserRoles", "RoleId", "dbo.AspNetRoles");
  229. DropForeignKey("dbo.JobParameters", "ParameterId", "dbo.Parameters");
  230. DropForeignKey("dbo.JobParameters", "JobId", "dbo.Jobs");
  231. DropForeignKey("dbo.Jobs", "AvalinId", "dbo.Avalin");
  232. DropForeignKey("dbo.DovominJobs", "JobId", "dbo.Jobs");
  233. DropForeignKey("dbo.DovominParameters", "ParameterId", "dbo.Parameters");
  234. DropForeignKey("dbo.DovominParameters", "DovominId", "dbo.Dovomin");
  235. DropForeignKey("dbo.DovominJobs", "DovominId", "dbo.Dovomin");
  236. DropIndex("dbo.Avalin", new[] { "Id" });
  237. DropIndex("dbo.Dovomin", new[] { "Id" });
  238. DropIndex("dbo.AspNetRoles", "RoleNameIndex");
  239. DropIndex("dbo.ParameterValues", new[] { "GroupKey" });
  240. DropIndex("dbo.AspNetUserRoles", new[] { "RoleId" });
  241. DropIndex("dbo.AspNetUserRoles", new[] { "UserId" });
  242. DropIndex("dbo.AspNetUserLogins", new[] { "UserId" });
  243. DropIndex("dbo.Jobs", new[] { "AvalinId" });
  244. DropIndex("dbo.JobParameters", new[] { "JobId" });
  245. DropIndex("dbo.JobParameters", "IX_JobParameterUniqueIndex");
  246. DropIndex("dbo.DovominParameters", new[] { "DovominId" });
  247. DropIndex("dbo.DovominParameters", "IX_DovominParameterUniqueIndex");
  248. DropIndex("dbo.AspNetUserClaims", new[] { "UserId" });
  249. DropIndex("dbo.AspNetUsers", "UserNameIndex");
  250. DropIndex("dbo.DovominJobs", new[] { "JobId" });
  251. DropIndex("dbo.DovominJobs", "IX_DovominJobUniqueIndex");
  252. DropTable("dbo.Avalin");
  253. DropTable("dbo.Dovomin");
  254. DropTable("dbo.AspNetRoles");
  255. DropTable("dbo.ParameterValues");
  256. DropTable("dbo.AspNetUserRoles");
  257. DropTable("dbo.AspNetUserLogins");
  258. DropTable("dbo.Jobs");
  259. DropTable("dbo.JobParameters");
  260. DropTable("dbo.Parameters");
  261. DropTable("dbo.DovominParameters");
  262. DropTable("dbo.AspNetUserClaims");
  263. DropTable("dbo.AspNetUsers");
  264. DropTable("dbo.DovominJobs");
  265. DropTable("dbo.Ads");
  266. }
  267. }
  268. }