using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using eprintServer.Entities;
#nullable disable
namespace eprintServer.Migrations
{
///
public partial class InitialDatabaseSetup : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "contact_settings",
columns: table => new
{
id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
email = table.Column(type: "text", nullable: false),
phone = table.Column(type: "text", nullable: false),
address = table.Column(type: "text", nullable: false),
map_url = table.Column(type: "text", nullable: false),
working_hours = table.Column(type: "text", nullable: false),
email_recipients = table.Column>(type: "text[]", nullable: false),
updated_at = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_contact_settings", x => x.id);
});
migrationBuilder.CreateTable(
name: "Currencies",
columns: table => new
{
Code = table.Column(type: "text", nullable: false),
EnglishName = table.Column(type: "text", nullable: false),
ArabicName = table.Column(type: "text", nullable: false),
Symbol = table.Column(type: "text", nullable: false),
IsDefault = table.Column(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Currencies", x => x.Code);
});
migrationBuilder.CreateTable(
name: "faqs",
columns: table => new
{
id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
question_en = table.Column(type: "text", nullable: false),
question_ar = table.Column(type: "text", nullable: false),
answer_en = table.Column(type: "text", nullable: false),
answer_ar = table.Column(type: "text", nullable: false),
is_active = table.Column(type: "boolean", nullable: false),
created_at = table.Column(type: "timestamp without time zone", nullable: false),
updated_at = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_faqs", x => x.id);
});
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: true),
description = table.Column(type: "text", nullable: true),
file_url = table.Column(type: "text", nullable: false),
file_type = table.Column(type: "text", nullable: true),
range = table.Column(type: "integer", nullable: true),
share = table.Column(type: "boolean", nullable: false),
file_size = table.Column(type: "bigint", nullable: true),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_File_model", x => x.id);
});
migrationBuilder.CreateTable(
name: "languages",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
tag = table.Column(type: "character varying(10)", maxLength: 10, nullable: false),
direction = table.Column(type: "character varying(3)", maxLength: 3, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_languages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "oauth_settings",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
google_client_id = table.Column(type: "text", nullable: false),
google_client_secret = table.Column(type: "text", nullable: false),
facebook_app_id = table.Column(type: "text", nullable: false),
facebook_app_secret = table.Column(type: "text", nullable: false),
instagram_app_id = table.Column(type: "text", nullable: false),
instagram_app_secret = table.Column(type: "text", nullable: false),
linkedin_client_id = table.Column(type: "text", nullable: false),
linkedin_client_secret = table.Column(type: "text", nullable: false),
ai_api_key = table.Column(type: "text", nullable: false),
canva_key = table.Column(type: "text", nullable: false),
thawani_root = table.Column(type: "text", nullable: false),
thawani_checkout_model_url = table.Column(type: "text", nullable: false),
thawani_api_key = table.Column(type: "text", nullable: false),
thawani_public_key = table.Column(type: "text", nullable: false),
assiyad_express_user_name = table.Column(type: "text", nullable: false),
assiyad_express_password = table.Column(type: "text", nullable: false),
twilio_account_sid = table.Column(type: "text", nullable: false),
twilio_auth_token = table.Column(type: "text", nullable: false),
twilio_phone_number = table.Column(type: "text", nullable: false),
twilio_shippment_template = table.Column(type: "text", nullable: false),
updated_at = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_oauth_settings", x => x.id);
});
migrationBuilder.CreateTable(
name: "ReportSettings",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DailyReports = table.Column(type: "boolean", nullable: false),
WeeklyReports = table.Column(type: "boolean", nullable: false),
MonthlyReports = table.Column(type: "boolean", nullable: false),
YearlyReports = table.Column(type: "boolean", nullable: false),
AdminEmailList = table.Column>(type: "text[]", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ReportSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "revoked_tokens",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Token = table.Column(type: "character varying(500)", maxLength: 500, nullable: false),
RevokedAt = table.Column(type: "timestamp without time zone", nullable: false),
ExpiresAt = table.Column(type: "timestamp without time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_revoked_tokens", x => x.Id);
});
migrationBuilder.CreateTable(
name: "step_templates",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
step_type = table.Column(type: "integer", nullable: false),
archive = table.Column(type: "boolean", nullable: false),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_step_templates", x => x.id);
});
migrationBuilder.CreateTable(
name: "translation_settings_table",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false),
active_language_tags = table.Column(type: "varchar(500)", maxLength: 500, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_translation_settings_table", x => x.Id);
});
migrationBuilder.CreateTable(
name: "user_addresses",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
address_line1 = table.Column(type: "text", nullable: true),
city = table.Column(type: "text", nullable: true),
area = table.Column(type: "text", nullable: true),
region = table.Column(type: "text", nullable: true),
country = table.Column(type: "text", nullable: true),
zip_code = table.Column(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_user_addresses", 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: true),
device_Id = table.Column(type: "text", nullable: true),
ip = table.Column(type: "text", nullable: true),
token = table.Column(type: "text", nullable: true),
tokendevice = table.Column(type: "text", nullable: true),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserDevice", x => x.id);
});
migrationBuilder.CreateTable(
name: "blog_posts",
columns: table => new
{
id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
author = table.Column(type: "text", nullable: false),
published = table.Column(type: "boolean", nullable: false),
image_id = table.Column(type: "bigint", nullable: true),
created_at = table.Column(type: "timestamp without time zone", nullable: false),
updated_at = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_blog_posts", x => x.id);
table.ForeignKey(
name: "FK_blog_posts_File_model_image_id",
column: x => x.image_id,
principalTable: "File_model",
principalColumn: "id");
});
migrationBuilder.CreateTable(
name: "branding_colors",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
primary_color = table.Column(type: "text", nullable: false),
secondary_color = table.Column(type: "text", nullable: false),
accent_color = table.Column(type: "text", nullable: false),
button_color = table.Column(type: "text", nullable: false),
header_color = table.Column(type: "text", nullable: false),
platform_name = table.Column(type: "text", nullable: false),
platform_email = table.Column(type: "text", nullable: false),
logo_id = table.Column(type: "bigint", nullable: true),
favicon_id = table.Column(type: "bigint", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_branding_colors", x => x.id);
table.ForeignKey(
name: "FK_branding_colors_File_model_favicon_id",
column: x => x.favicon_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_branding_colors_File_model_logo_id",
column: x => x.logo_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "carousel_items",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
redirect_url = table.Column(type: "text", nullable: false),
image_id = table.Column(type: "bigint", nullable: true),
status = table.Column(type: "boolean", nullable: false),
order_index = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_carousel_items", x => x.id);
table.ForeignKey(
name: "FK_carousel_items_File_model_image_id",
column: x => x.image_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "offers_table",
columns: table => new
{
id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Type = table.Column(type: "text", nullable: true),
Status = table.Column(type: "text", nullable: true),
OfferPrice = table.Column(type: "numeric", nullable: true),
OriginalTotal = table.Column(type: "numeric", nullable: true),
DiscountAmount = table.Column(type: "numeric", nullable: true),
DiscountType = table.Column(type: "text", nullable: true),
DiscountValue = table.Column(type: "numeric", nullable: true),
DiscountPercentage = table.Column(type: "numeric", nullable: true),
StartDate = table.Column(type: "timestamp without time zone", nullable: true),
EndDate = table.Column(type: "timestamp without time zone", nullable: true),
IsFeatured = table.Column(type: "boolean", nullable: true),
IsActive = table.Column(type: "boolean", nullable: false),
IsPublic = table.Column(type: "boolean", nullable: false),
MaxUses = table.Column(type: "integer", nullable: true),
CreatedAt = table.Column(type: "timestamp without time zone", nullable: false),
UpdatedAt = table.Column(type: "timestamp without time zone", nullable: false),
BannerImageId = table.Column(type: "bigint", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_offers_table", x => x.id);
table.ForeignKey(
name: "FK_offers_table_File_model_BannerImageId",
column: x => x.BannerImageId,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "product_categories",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
image_id = table.Column(type: "bigint", nullable: true),
product_type = table.Column(type: "integer", nullable: false),
archive = table.Column(type: "boolean", nullable: false),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_product_categories", x => x.id);
table.ForeignKey(
name: "FK_product_categories_File_model_image_id",
column: x => x.image_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
});
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),
gender = table.Column(type: "integer", nullable: true),
phone_number = table.Column(type: "text", nullable: true),
office_role = table.Column(type: "text", nullable: true),
city = table.Column(type: "text", nullable: true),
country = table.Column(type: "text", nullable: true),
active = table.Column(type: "boolean", nullable: false),
deleted = table.Column(type: "boolean", nullable: false),
role = table.Column(type: "integer", nullable: false),
user_device = table.Column(type: "bigint", nullable: true),
otp = table.Column(type: "text", nullable: true),
provider = table.Column(type: "integer", nullable: false),
timestmp = table.Column(type: "timestamp without time zone", nullable: false),
users_profile_media = table.Column(type: "bigint", nullable: true),
sub_admin_privileges = table.Column(type: "integer[]", 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.CreateTable(
name: "offer_products_table",
columns: table => new
{
Id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
OfferId = table.Column(type: "integer", nullable: false),
ProductId = table.Column(type: "text", nullable: true),
Quantity = table.Column(type: "integer", nullable: true),
UnitPrice = table.Column(type: "numeric", nullable: true),
ProductName = table.Column(type: "text", nullable: true),
IsCustomizableProduct = table.Column(type: "boolean", nullable: false),
ProductImageId = table.Column(type: "bigint", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_offer_products_table", x => x.Id);
table.ForeignKey(
name: "FK_offer_products_table_File_model_ProductImageId",
column: x => x.ProductImageId,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_offer_products_table_offers_table_OfferId",
column: x => x.OfferId,
principalTable: "offers_table",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "customizable_products",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
base_price = table.Column(type: "numeric", nullable: false),
is_canvas_enabled = table.Column(type: "boolean", nullable: false),
minimum_order_quantity = table.Column(type: "integer", nullable: false),
base_delivery_days = table.Column(type: "integer", nullable: false),
allowed_quantities = table.Column>(type: "jsonb", nullable: true),
category_id = table.Column(type: "bigint", nullable: false),
quantity_pricing_config = table.Column(type: "jsonb", nullable: true),
archive = table.Column(type: "boolean", nullable: false),
unit_weight = table.Column(type: "numeric", nullable: true),
image_id = table.Column(type: "bigint", nullable: true),
timestmp = table.Column(type: "timestamp without time zone", nullable: false),
has_3d_preview = table.Column(type: "boolean", nullable: true),
three_d_config = table.Column(type: "jsonb", nullable: true),
uv_map_image_id = table.Column(type: "bigint", nullable: true),
three_d_model_file_id = table.Column(type: "bigint", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_customizable_products", x => x.id);
table.ForeignKey(
name: "FK_customizable_products_File_model_image_id",
column: x => x.image_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_customizable_products_File_model_three_d_model_file_id",
column: x => x.three_d_model_file_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_customizable_products_File_model_uv_map_image_id",
column: x => x.uv_map_image_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_customizable_products_product_categories_category_id",
column: x => x.category_id,
principalTable: "product_categories",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "sellable_products",
columns: table => new
{
id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
product_name_en = table.Column(type: "text", nullable: true),
product_name_ar = table.Column(type: "text", nullable: true),
price = table.Column(type: "double precision", nullable: false),
stock_quantity = table.Column(type: "double precision", nullable: false),
description_ar = table.Column(type: "text", maxLength: 3000, nullable: true),
description_en = table.Column(type: "text", maxLength: 3000, nullable: true),
status = table.Column(type: "integer", nullable: false),
image_id = table.Column(type: "bigint", nullable: true),
created_at = table.Column(type: "timestamp without time zone", nullable: false),
updated_at = table.Column(type: "timestamp without time zone", nullable: false),
category_id = table.Column(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_sellable_products", x => x.id);
table.ForeignKey(
name: "FK_sellable_products_File_model_image_id",
column: x => x.image_id,
principalTable: "File_model",
principalColumn: "id");
table.ForeignKey(
name: "FK_sellable_products_product_categories_category_id",
column: x => x.category_id,
principalTable: "product_categories",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "notificationmodel",
columns: table => new
{
notificatoin_id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SenderId = table.Column(type: "bigint", nullable: true),
ReciverId = table.Column(type: "bigint", nullable: true),
action = table.Column(type: "integer", nullable: false),
action_id = table.Column(type: "bigint", nullable: true),
subject = table.Column(type: "text", nullable: false),
content = table.Column(type: "text", nullable: false),
logUrl = table.Column(type: "text", nullable: false),
status = table.Column(type: "integer", nullable: false),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_notificationmodel", x => x.notificatoin_id);
table.ForeignKey(
name: "FK_notificationmodel_users_table_ReciverId",
column: x => x.ReciverId,
principalTable: "users_table",
principalColumn: "user_id");
table.ForeignKey(
name: "FK_notificationmodel_users_table_SenderId",
column: x => x.SenderId,
principalTable: "users_table",
principalColumn: "user_id");
});
migrationBuilder.CreateTable(
name: "Order",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column(type: "bigint", nullable: false),
order_date = table.Column(type: "timestamp without time zone", nullable: false),
total_amount = table.Column(type: "numeric", nullable: false),
discount = table.Column(type: "numeric", nullable: false),
status = table.Column(type: "integer", nullable: false),
invoice_id = table.Column(type: "bigint", nullable: true),
thawani_session_id = table.Column(type: "text", nullable: true),
shipping_ref = table.Column(type: "text", nullable: true),
batch_id = table.Column(type: "text", nullable: true),
tracking_number = table.Column(type: "text", nullable: true),
address_id = table.Column(type: "bigint", nullable: true),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Order", x => x.id);
table.ForeignKey(
name: "FK_Order_user_addresses_address_id",
column: x => x.address_id,
principalTable: "user_addresses",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Order_users_table_user_id",
column: x => x.user_id,
principalTable: "users_table",
principalColumn: "user_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "product_mockups",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column(type: "text", nullable: true),
design_width = table.Column(type: "double precision", nullable: false),
design_height = table.Column(type: "double precision", nullable: false),
print_width = table.Column(type: "double precision", nullable: false),
print_height = table.Column(type: "double precision", nullable: false),
customizable_product_id = table.Column(type: "bigint", nullable: false),
file_id = table.Column(type: "bigint", nullable: true),
thumbnail_file_id = table.Column(type: "bigint", nullable: true),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_product_mockups", x => x.id);
table.ForeignKey(
name: "FK_product_mockups_File_model_file_id",
column: x => x.file_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_product_mockups_File_model_thumbnail_file_id",
column: x => x.thumbnail_file_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_product_mockups_customizable_products_customizable_product_~",
column: x => x.customizable_product_id,
principalTable: "customizable_products",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "steps",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
product_id = table.Column(type: "bigint", nullable: false),
step_order = table.Column(type: "integer", nullable: false),
step_type = table.Column(type: "integer", nullable: false),
is_template = table.Column(type: "boolean", nullable: false),
archive = table.Column(type: "boolean", nullable: false),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_steps", x => x.id);
table.ForeignKey(
name: "FK_steps_customizable_products_product_id",
column: x => x.product_id,
principalTable: "customizable_products",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "texture_slots",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column(type: "text", nullable: false),
texture_type = table.Column(type: "integer", nullable: false),
uv_coordinates = table.Column(type: "jsonb", nullable: false),
file_id = table.Column(type: "bigint", nullable: true),
customizable_product_id = table.Column(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_texture_slots", x => x.id);
table.ForeignKey(
name: "FK_texture_slots_File_model_file_id",
column: x => x.file_id,
principalTable: "File_model",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_texture_slots_customizable_products_customizable_product_id",
column: x => x.customizable_product_id,
principalTable: "customizable_products",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "user_customizations",
columns: table => new
{
id = table.Column(type: "uuid", nullable: false),
user_id = table.Column(type: "bigint", nullable: false),
product_id = table.Column(type: "bigint", nullable: false),
progress_id = table.Column(type: "uuid", nullable: false),
status = table.Column(type: "integer", nullable: false),
started_at = table.Column(type: "timestamp without time zone", nullable: false),
completed_at = table.Column(type: "timestamp without time zone", nullable: true),
total_price = table.Column(type: "numeric", nullable: false),
order_id = table.Column(type: "bigint", nullable: true),
created_at = table.Column(type: "timestamp without time zone", nullable: false),
updated_at = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_user_customizations", x => x.id);
table.ForeignKey(
name: "FK_user_customizations_customizable_products_product_id",
column: x => x.product_id,
principalTable: "customizable_products",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "invoices",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column(type: "bigint", nullable: false),
order_id = table.Column(type: "bigint", nullable: false),
invoice_date = table.Column(type: "timestamp without time zone", nullable: false),
total_amount = table.Column(type: "numeric", nullable: false),
discount_percentage = table.Column(type: "double precision", nullable: false),
discount_amount = table.Column(type: "numeric", nullable: false),
tax_amount = table.Column(type: "numeric", nullable: false),
status = table.Column(type: "integer", nullable: false),
refund_date = table.Column(type: "timestamp without time zone", nullable: true),
timestmp = table.Column(type: "timestamp without time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_invoices", x => x.id);
table.ForeignKey(
name: "FK_invoices_Order_order_id",
column: x => x.order_id,
principalTable: "Order",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_invoices_users_table_user_id",
column: x => x.user_id,
principalTable: "users_table",
principalColumn: "user_id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Payments",
columns: table => new
{
id = table.Column(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
order_id = table.Column