using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace vendorApproverBackend.Migrations
{
///
public partial class AddAttributesToUser : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "city",
table: "users_table",
type: "text",
nullable: true);
migrationBuilder.AddColumn(
name: "country",
table: "users_table",
type: "text",
nullable: true);
migrationBuilder.CreateTable(
name: "Vendors",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
manifactory_name = table.Column(type: "text", nullable: true),
Local_agent_name = table.Column(type: "text", nullable: true),
Local_agent_phone = table.Column(type: "text", nullable: true),
Commercial_registratio_no = table.Column(type: "text", nullable: true),
representative_name = table.Column(type: "text", nullable: true),
representative_email = table.Column(type: "text", nullable: true),
position = table.Column(type: "text", nullable: true),
partner_company = table.Column(type: "text", nullable: true),
timestmp = table.Column(type: "timestamp with time zone", nullable: false),
UserId = table.Column(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Vendors", x => x.id);
table.ForeignKey(
name: "FK_Vendors_users_table_UserId",
column: x => x.UserId,
principalTable: "users_table",
principalColumn: "user_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Vendors_UserId",
table: "Vendors",
column: "UserId",
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Vendors");
migrationBuilder.DropColumn(
name: "city",
table: "users_table");
migrationBuilder.DropColumn(
name: "country",
table: "users_table");
}
}
}