using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SIFinance.Shared.Migrations { /// public partial class AddBudgetsService : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "budgets_service", schema: "achats", columns: table => new { id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), service_id = table.Column(type: "int", nullable: false), exercice_annee = table.Column(type: "int", nullable: false), montant_initial = table.Column(type: "decimal(18,2)", nullable: false), montant_revise = table.Column(type: "decimal(18,2)", nullable: true), date_revision = table.Column(type: "datetime", nullable: true), revise_par = table.Column(type: "int", nullable: true), commentaire_revision = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), saisie_par_id = table.Column(type: "int", nullable: false), date_creation = table.Column(type: "datetime", nullable: true, defaultValueSql: "(getdate())"), date_derniere_maj = table.Column(type: "datetime", nullable: true) }, constraints: table => { table.PrimaryKey("PK_budgets_service", x => x.id); table.ForeignKey( name: "FK_budgets_service_revise_par", column: x => x.revise_par, principalSchema: "core", principalTable: "utilisateurs", principalColumn: "id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_budgets_service_saisie_par", column: x => x.saisie_par_id, principalSchema: "core", principalTable: "utilisateurs", principalColumn: "id"); table.ForeignKey( name: "FK_budgets_service_service", column: x => x.service_id, principalSchema: "ref", principalTable: "services", principalColumn: "id"); }); migrationBuilder.CreateIndex( name: "IX_budgets_service_revise_par", schema: "achats", table: "budgets_service", column: "revise_par"); migrationBuilder.CreateIndex( name: "IX_budgets_service_saisie_par_id", schema: "achats", table: "budgets_service", column: "saisie_par_id"); migrationBuilder.CreateIndex( name: "IX_budgets_service_unique", schema: "achats", table: "budgets_service", columns: new[] { "service_id", "exercice_annee" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "budgets_service", schema: "achats"); } } }