using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace vendorApproverBackend.Migrations
{
///
public partial class InitialCreate : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "File_model",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
file_name = table.Column(type: "text", nullable: false),
description = table.Column(type: "text", nullable: false),
file_url = table.Column(type: "text", nullable: false),
file_type = table.Column(type: "text", nullable: false),
range = table.Column(type: "integer", nullable: true),
share = table.Column(type: "boolean", nullable: false),
file_size = table.Column(type: "bigint", nullable: false),
timestmp = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_File_model", x => x.id);
});
migrationBuilder.CreateTable(
name: "UserDevice",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
deviceType = table.Column(type: "text", nullable: false),
device_Id = table.Column(type: "text", nullable: false),
ip = table.Column(type: "text", nullable: false),
token = table.Column(type: "text", nullable: false),
tokendevice = table.Column(type: "text", nullable: false),
timestmp = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserDevice", x => x.id);
});
migrationBuilder.CreateTable(
name: "users_table",
columns: table => new
{
user_id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_name = table.Column(type: "text", nullable: false),
email = table.Column(type: "text", nullable: false),
password = table.Column(type: "text", nullable: false),
name = table.Column(type: "text", nullable: false),
phone_number = table.Column(type: "text", nullable: false),
active = table.Column(type: "boolean", nullable: false),
blocked = table.Column(type: "boolean", nullable: false),
deleted = table.Column(type: "boolean", nullable: false),
role = table.Column(type: "integer", nullable: false),
users_profile_media = table.Column(type: "bigint", nullable: false),
user_device = table.Column(type: "bigint", nullable: false),
otp = table.Column(type: "text", nullable: false),
timestmp = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_users_table", x => x.user_id);
table.ForeignKey(
name: "FK_users_table_File_model_users_profile_media",
column: x => x.users_profile_media,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_users_table_UserDevice_user_device",
column: x => x.user_device,
principalTable: "UserDevice",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_users_table_email",
table: "users_table",
column: "email",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_users_table_phone_number",
table: "users_table",
column: "phone_number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_users_table_user_device",
table: "users_table",
column: "user_device",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_users_table_user_name",
table: "users_table",
column: "user_name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_users_table_users_profile_media",
table: "users_table",
column: "users_profile_media",
unique: true);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "users_table");
migrationBuilder.DropTable(
name: "File_model");
migrationBuilder.DropTable(
name: "UserDevice");
}
}
}