Premier commit
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SIFinance.Shared.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddSousTraitantsOrganismesContrats : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "st");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "organismes",
|
||||
schema: "st",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
raison_sociale = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
|
||||
siret = table.Column<string>(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true),
|
||||
email = table.Column<string>(type: "varchar(255)", unicode: false, maxLength: 255, nullable: true),
|
||||
telephone = table.Column<string>(type: "varchar(30)", unicode: false, maxLength: 30, nullable: true),
|
||||
adresse = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: true),
|
||||
statut = table.Column<string>(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false, defaultValue: "ACTIF"),
|
||||
date_creation = table.Column<DateTime>(type: "datetime", nullable: true, defaultValueSql: "(getdate())")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__organismes", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "contrats_prestataires",
|
||||
schema: "st",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
organisme_id = table.Column<int>(type: "int", nullable: false),
|
||||
reference = table.Column<string>(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false),
|
||||
objet = table.Column<string>(type: "nvarchar(255)", maxLength: 255, nullable: false),
|
||||
date_signature = table.Column<DateOnly>(type: "date", nullable: true),
|
||||
date_debut = table.Column<DateOnly>(type: "date", nullable: false),
|
||||
date_fin = table.Column<DateOnly>(type: "date", nullable: false),
|
||||
montant_total = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||
statut = table.Column<string>(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false, defaultValue: "ACTIF"),
|
||||
saisie_par_id = table.Column<int>(type: "int", nullable: false),
|
||||
date_creation = table.Column<DateTime>(type: "datetime", nullable: true, defaultValueSql: "(getdate())")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK__contrats_prestataires", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK__contrats_prestataires__organisme",
|
||||
column: x => x.organisme_id,
|
||||
principalSchema: "st",
|
||||
principalTable: "organismes",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "FK__contrats_prestataires__saisie_par",
|
||||
column: x => x.saisie_par_id,
|
||||
principalSchema: "core",
|
||||
principalTable: "utilisateurs",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ctp_organisme",
|
||||
schema: "st",
|
||||
table: "contrats_prestataires",
|
||||
column: "organisme_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ctp_saisie_par",
|
||||
schema: "st",
|
||||
table: "contrats_prestataires",
|
||||
column: "saisie_par_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UQ_ctp_reference",
|
||||
schema: "st",
|
||||
table: "contrats_prestataires",
|
||||
column: "reference",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "contrats_prestataires",
|
||||
schema: "st");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "organismes",
|
||||
schema: "st");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user