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.

268 lines
13 KiB

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