protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateMaintenanceProcedures(); migrationBuilder.CreateTestJsonTableSupport(); migrationBuilder.CreateSequence <int>( name: "seqPerson"); migrationBuilder.CreateTable( name: "Person", columns: table => new { PersonId = table.Column <int>(nullable: false, defaultValueSql: "next value for seqPerson"), FirstName = table.Column <string>(maxLength: 20, nullable: true), LastName = table.Column <string>(nullable: true), SysUserId = table.Column <int>(nullable: false, defaultValueSql: "((0))"), SysStart = table.Column <DateTime>(nullable: false, defaultValueSql: "(getdate())"), SysEnd = table.Column <DateTime>(nullable: false, defaultValueSql: "(CONVERT(datetime2, '9999-12-31 23:59:59.9999999'))") }, constraints: table => { table.PrimaryKey("PK_Person", x => x.PersonId); }); migrationBuilder.DoInserts("MigrationsInserts\\Initial_Insert.sql"); }
protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateMaintenanceProcedures(); migrationBuilder.CreateTestJsonTableSupport(); migrationBuilder.CreateTable( name: "AgencyInvestigatorCheck", columns: table => new { Id = table.Column <int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), SysStart = table.Column <DateTime>(nullable: false), EmployeeId = table.Column <int>(nullable: false), DateCompleted = table.Column <DateTime>(nullable: false), Status = table.Column <string>(nullable: true), SysEnd = table.Column <DateTime>(nullable: false), SysUser = table.Column <string>(nullable: true), SysUserNext = table.Column <string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_AgencyInvestigatorCheck", x => x.Id); }); migrationBuilder.SaveMappings(); migrationBuilder.Sql(File.ReadAllText("MigrationsInserts\\AgencyInvestigatorCheck_Insert.sql")); }
protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateMaintenanceProcedures(); migrationBuilder.CreateTestJsonTableSupport(); migrationBuilder.EnsureSchema( name: "dbo"); migrationBuilder.CreateTable( name: "Color", schema: "dbo", columns: table => new { Id = table.Column <int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), SysStart = table.Column <DateTime>(nullable: false), Name = table.Column <string>(unicode: false, maxLength: 30, nullable: true), SysEnd = table.Column <DateTime>(nullable: false), SysUser = table.Column <string>(nullable: true), SysUserNext = table.Column <string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Color", x => x.Id); }); migrationBuilder.SaveMappings(); migrationBuilder.Sql(File.ReadAllText("MigrationsInserts\\Initial_Insert.sql")); }
protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateMaintenanceProcedures(); migrationBuilder.CreateTestJsonTableSupport(); migrationBuilder.CreateTable( name: "Rgb", columns: table => new { Id = table.Column <int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), Name = table.Column <string>(unicode: false, maxLength: 50, nullable: true), Red = table.Column <int>(nullable: false), Green = table.Column <int>(nullable: false), Blue = table.Column <int>(nullable: false), SysUser = table.Column <string>(unicode: false, maxLength: 50, nullable: true), DateAdded = table.Column <DateTime>(nullable: false) }, constraints: table => { table.PrimaryKey("pkRgb", x => x.Id); }); migrationBuilder.SaveMappings(); migrationBuilder.Sql(File.ReadAllText("MigrationsInserts\\RgbInserts.sql")); migrationBuilder.Sql(File.ReadAllText("MigrationsInserts\\vwHsl.sql")); migrationBuilder.Sql(File.ReadAllText("MigrationsInserts\\HslByColorName.sql")); migrationBuilder.Sql(File.ReadAllText("MigrationsInserts\\RgbJsonByColorName.sql")); }
protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateMaintenanceProcedures(); migrationBuilder.CreateTestJsonTableSupport(); migrationBuilder.EnsureSchema( name: "dbo"); migrationBuilder.CreateTable( name: "Employee", schema: "dbo", columns: table => new { Id = table.Column <int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), SysStart = table.Column <DateTime>(nullable: false), FirstName = table.Column <string>(maxLength: 30, nullable: true), SysEnd = table.Column <DateTime>(nullable: false), SysUser = table.Column <string>(nullable: true), SysUserNext = table.Column <string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Employee", x => x.Id); }); migrationBuilder.CreateTable( name: "Position", schema: "dbo", columns: table => new { Id = table.Column <int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), SysStart = table.Column <DateTime>(nullable: false), Title = table.Column <string>(maxLength: 60, nullable: true), IsManager = table.Column <bool>(nullable: false), SysEnd = table.Column <DateTime>(nullable: false), SysUser = table.Column <string>(nullable: true), SysUserNext = table.Column <string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Position", x => x.Id); }); migrationBuilder.CreateTable( name: "EmployeePosition", schema: "dbo", columns: table => new { EmployeeId = table.Column <int>(nullable: false), PositionId = table.Column <int>(nullable: false), SysStart = table.Column <DateTime>(nullable: false), SysEnd = table.Column <DateTime>(nullable: false), SysUser = table.Column <string>(nullable: true), SysUserNext = table.Column <string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_EmployeePosition", x => new { x.EmployeeId, x.PositionId }); table.ForeignKey( name: "fk_EmployeePosition_Employee", column: x => x.EmployeeId, principalSchema: "dbo", principalTable: "Employee", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "fk_EmployeePosition_Position", column: x => x.PositionId, principalSchema: "dbo", principalTable: "Position", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_EmployeePosition_PositionId", schema: "dbo", table: "EmployeePosition", column: "PositionId"); migrationBuilder.SaveMappings(); migrationBuilder.Sql(File.ReadAllText("MigrationsInserts\\Initial_Insert.sql")); }