This commit is contained in:
shafi54 2026-03-26 13:45:24 +05:30
parent 89de986764
commit 5e9bc3e38e
175 changed files with 469 additions and 197246 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,11 +0,0 @@
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
out: './drizzle',
schema: './src/db/schema.ts',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
});

View file

@ -1,124 +0,0 @@
CREATE TYPE "public"."order_status" AS ENUM('pending', 'delivered', 'cancelled');--> statement-breakpoint
CREATE TABLE "mf"."addresses" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."addresses_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"address" varchar(500) NOT NULL,
"is_default" boolean DEFAULT false NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."cart_items" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."cart_items_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"product_id" integer NOT NULL,
"quantity" numeric(10, 2) NOT NULL,
"added_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "unique_user_product" UNIQUE("user_id","product_id")
);
--> statement-breakpoint
CREATE TABLE "mf"."delivery_slot_info" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."delivery_slot_info_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"deliveryTime" timestamp NOT NULL,
"freezeTime" timestamp NOT NULL,
"is_active" boolean DEFAULT true NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."notifications" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."notifications_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"title" varchar(255) NOT NULL,
"body" varchar(512) NOT NULL,
"type" varchar(50),
"is_read" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."order_items" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."order_items_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"order_id" integer NOT NULL,
"product_id" integer NOT NULL,
"quantity" numeric(10, 2) NOT NULL,
"price" numeric(10, 2) NOT NULL,
"amount" numeric(10, 2) NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."orders" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."orders_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"address_id" integer NOT NULL,
"slot_id" integer NOT NULL,
"total_amount" numeric(10, 2) NOT NULL,
"status" "order_status" DEFAULT 'pending' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."payments" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."payments_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"order_id" integer NOT NULL,
"status" varchar(50) NOT NULL,
"gateway" varchar(50) NOT NULL,
"gateway_order_id" varchar(255),
"amount" numeric(10, 2) NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."product_categories" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."product_categories_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" varchar(255) NOT NULL,
"description" varchar(500)
);
--> statement-breakpoint
CREATE TABLE "mf"."product_info" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."product_info_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" varchar(255) NOT NULL,
"short_description" varchar(500),
"long_description" varchar(1000),
"unit_id" integer NOT NULL,
"price" numeric(10, 2) NOT NULL,
"images" jsonb,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."product_slots" (
"product_id" integer NOT NULL,
"slot_id" integer NOT NULL,
CONSTRAINT "product_slot_pk" UNIQUE("product_id","slot_id")
);
--> statement-breakpoint
CREATE TABLE "mf"."special_deals" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."special_deals_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"product_id" integer NOT NULL,
"quantity" numeric(10, 2) NOT NULL,
"price" numeric(10, 2) NOT NULL,
"valid_till" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."units" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."units_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"short_notation" varchar(50) NOT NULL,
"full_name" varchar(100) NOT NULL,
CONSTRAINT "unique_short_notation" UNIQUE("short_notation")
);
--> statement-breakpoint
CREATE TABLE "mf"."users" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" varchar(255) NOT NULL,
"email" varchar(255),
"mobile" varchar(255),
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "unique_email" UNIQUE("email")
);
--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD CONSTRAINT "addresses_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."cart_items" ADD CONSTRAINT "cart_items_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."cart_items" ADD CONSTRAINT "cart_items_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."notifications" ADD CONSTRAINT "notifications_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."order_items" ADD CONSTRAINT "order_items_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."order_items" ADD CONSTRAINT "order_items_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD CONSTRAINT "orders_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD CONSTRAINT "orders_address_id_addresses_id_fk" FOREIGN KEY ("address_id") REFERENCES "mf"."addresses"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD CONSTRAINT "orders_slot_id_delivery_slot_info_id_fk" FOREIGN KEY ("slot_id") REFERENCES "mf"."delivery_slot_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."payments" ADD CONSTRAINT "payments_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."product_info" ADD CONSTRAINT "product_info_unit_id_units_id_fk" FOREIGN KEY ("unit_id") REFERENCES "mf"."units"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."product_slots" ADD CONSTRAINT "product_slots_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."product_slots" ADD CONSTRAINT "product_slots_slot_id_delivery_slot_info_id_fk" FOREIGN KEY ("slot_id") REFERENCES "mf"."delivery_slot_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."special_deals" ADD CONSTRAINT "special_deals_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."delivery_slot_info" RENAME COLUMN "deliveryTime" TO "delivery_time";--> statement-breakpoint
ALTER TABLE "mf"."delivery_slot_info" RENAME COLUMN "freezeTime" TO "freeze_time";

View file

@ -1,9 +0,0 @@
CREATE TABLE "mf"."user_creds" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."user_creds_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"user_password" varchar(255) NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "unique_user_cred" UNIQUE("user_id")
);
--> statement-breakpoint
ALTER TABLE "mf"."user_creds" ADD CONSTRAINT "user_creds_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,41 +0,0 @@
CREATE TABLE "mf"."order_status" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."order_status_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"order_time" timestamp DEFAULT now() NOT NULL,
"user_id" integer NOT NULL,
"order_id" integer NOT NULL,
"is_packaged" boolean DEFAULT false NOT NULL,
"is_delivered" boolean DEFAULT false NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."payment_info" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."payment_info_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"status" varchar(50) NOT NULL,
"gateway" varchar(50) NOT NULL,
"order_id" varchar(500),
"token" varchar(500),
"merchant_order_id" varchar(255) NOT NULL,
"payload" jsonb,
CONSTRAINT "payment_info_merchant_order_id_unique" UNIQUE("merchant_order_id")
);
--> statement-breakpoint
ALTER TABLE "mf"."order_items" ALTER COLUMN "quantity" SET DATA TYPE varchar(50);--> statement-breakpoint
ALTER TABLE "mf"."orders" ALTER COLUMN "slot_id" DROP NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "name" varchar(255) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "phone" varchar(15) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "address_line1" varchar(255) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "address_line2" varchar(255);--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "city" varchar(100) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "state" varchar(100) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "pincode" varchar(10) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "latitude" real;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "longitude" real;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD COLUMN "is_cod" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD COLUMN "is_online_payment" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD COLUMN "payment_info_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD CONSTRAINT "order_status_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD CONSTRAINT "order_status_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD CONSTRAINT "orders_payment_info_id_payment_info_id_fk" FOREIGN KEY ("payment_info_id") REFERENCES "mf"."payment_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."addresses" DROP COLUMN "address";--> statement-breakpoint
ALTER TABLE "mf"."order_items" DROP COLUMN "amount";--> statement-breakpoint
ALTER TABLE "mf"."orders" DROP COLUMN "status";--> statement-breakpoint
DROP TYPE "public"."order_status";

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."order_status" ADD COLUMN "is_cancelled" boolean DEFAULT false NOT NULL;

View file

@ -1,13 +0,0 @@
CREATE TABLE "mf"."key_val_store" (
"key" varchar(255) PRIMARY KEY NOT NULL,
"value" jsonb
);
--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD COLUMN "readable_id" integer NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."payments" ADD COLUMN "token" varchar(500);--> statement-breakpoint
ALTER TABLE "mf"."payments" ADD COLUMN "merchant_order_id" varchar(255) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."payments" ADD COLUMN "payload" jsonb;--> statement-breakpoint
ALTER TABLE "mf"."payments" DROP COLUMN "gateway_order_id";--> statement-breakpoint
ALTER TABLE "mf"."payments" DROP COLUMN "amount";--> statement-breakpoint
ALTER TABLE "mf"."payments" DROP COLUMN "created_at";--> statement-breakpoint
ALTER TABLE "mf"."payments" ADD CONSTRAINT "payments_merchant_order_id_unique" UNIQUE("merchant_order_id");

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."order_status" ADD COLUMN "cancel_reason" varchar(255);--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD COLUMN "is_refund_done" boolean DEFAULT false NOT NULL;

View file

@ -1,11 +0,0 @@
CREATE TABLE "mf"."complaints" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."complaints_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"order_id" integer,
"complaint_body" varchar(1000) NOT NULL,
"is_resolved" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."complaints" ADD CONSTRAINT "complaints_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."complaints" ADD CONSTRAINT "complaints_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."product_info" ADD COLUMN "is_out_of_stock" boolean DEFAULT false NOT NULL;

View file

@ -1,9 +0,0 @@
CREATE TABLE "mf"."staff_users" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."staff_users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" varchar(255) NOT NULL,
"password" varchar(255) NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."user_creds" DROP CONSTRAINT "unique_user_cred";--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "created_at" timestamp DEFAULT now() NOT NULL;

View file

@ -1,15 +0,0 @@
CREATE TABLE "mf"."coupons" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."coupons_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"is_user_based" boolean DEFAULT false NOT NULL,
"discount_percent" numeric(5, 2),
"flat_discount" numeric(10, 2),
"min_order" numeric(10, 2),
"target_user" integer,
"created_by" integer NOT NULL,
"max_value" numeric(10, 2),
"is_invalidated" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."coupons" ADD CONSTRAINT "coupons_target_user_users_id_fk" FOREIGN KEY ("target_user") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."coupons" ADD CONSTRAINT "coupons_created_by_staff_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "mf"."staff_users"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,3 +0,0 @@
ALTER TABLE "mf"."coupons" ADD COLUMN "is_apply_for_all" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."coupons" ADD COLUMN "valid_till" timestamp;--> statement-breakpoint
ALTER TABLE "mf"."coupons" ADD COLUMN "max_limit_for_user" integer;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."coupons" ADD COLUMN "coupon_code" varchar(50) NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."coupons" ADD CONSTRAINT "unique_coupon_code" UNIQUE("coupon_code");

View file

@ -1,9 +0,0 @@
CREATE TABLE "mf"."coupon_usage" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."coupon_usage_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"coupon_id" integer NOT NULL,
"used_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."coupon_usage" ADD CONSTRAINT "coupon_usage_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."coupon_usage" ADD CONSTRAINT "coupon_usage_coupon_id_coupons_id_fk" FOREIGN KEY ("coupon_id") REFERENCES "mf"."coupons"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."delivery_slot_info" ADD COLUMN "delivery_sequence" jsonb;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."complaints" ADD COLUMN "response" varchar(1000);

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."coupons" ADD COLUMN "product_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."coupons" ADD CONSTRAINT "coupons_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."coupons" RENAME COLUMN "product_id" TO "product_ids";--> statement-breakpoint
ALTER TABLE "mf"."coupons" DROP CONSTRAINT "coupons_product_id_product_info_id_fk";

View file

@ -1,13 +0,0 @@
CREATE TABLE "mf"."user_details" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."user_details_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"bio" varchar(500),
"date_of_birth" date,
"gender" varchar(20),
"occupation" varchar(100),
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "user_details_user_id_unique" UNIQUE("user_id")
);
--> statement-breakpoint
ALTER TABLE "mf"."user_details" ADD CONSTRAINT "user_details_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."user_details" ADD COLUMN "profile_image" varchar(500);

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."product_info" ADD COLUMN "market_price" numeric(10, 2);

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."orders" ADD COLUMN "cancellation_reviewed" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD COLUMN "admin_notes" text;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."orders" ADD COLUMN "is_refund_done" boolean DEFAULT false NOT NULL;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."orders" ADD COLUMN "user_notes" text;

View file

@ -1,11 +0,0 @@
CREATE TABLE "mf"."vendor_snippets" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."vendor_snippets_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"snippet_code" varchar(255) NOT NULL,
"slot_id" integer NOT NULL,
"product_ids" integer[] NOT NULL,
"valid_till" timestamp,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "vendor_snippets_snippet_code_unique" UNIQUE("snippet_code")
);
--> statement-breakpoint
ALTER TABLE "mf"."vendor_snippets" ADD CONSTRAINT "vendor_snippets_slot_id_delivery_slot_info_id_fk" FOREIGN KEY ("slot_id") REFERENCES "mf"."delivery_slot_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."order_status" ADD COLUMN "is_payment_processed" boolean DEFAULT false NOT NULL;

View file

@ -1,2 +0,0 @@
CREATE TYPE "public"."payment_status" AS ENUM('pending', 'success', 'cod', 'failed');--> statement-breakpoint
ALTER TABLE "mf"."order_status" RENAME COLUMN "is_payment_processed" TO "payment_status";

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."order_status" ADD COLUMN "payment_state" "payment_status" DEFAULT 'pending' NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."order_status" DROP COLUMN "payment_status";

View file

@ -1,10 +0,0 @@
CREATE TABLE "mf"."notif_creds" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."notif_creds_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"token" varchar(500) NOT NULL,
"added_at" timestamp DEFAULT now() NOT NULL,
"user_id" integer NOT NULL,
"last_verified" timestamp,
CONSTRAINT "notif_creds_token_unique" UNIQUE("token")
);
--> statement-breakpoint
ALTER TABLE "mf"."notif_creds" ADD CONSTRAINT "notif_creds_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."users" ALTER COLUMN "name" DROP NOT NULL;

View file

@ -1,11 +0,0 @@
CREATE TABLE "mf"."store_info" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."store_info_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" varchar(255) NOT NULL,
"description" varchar(500),
"created_at" timestamp DEFAULT now() NOT NULL,
"owner" integer NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."product_info" ADD COLUMN "store_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."store_info" ADD CONSTRAINT "store_info_owner_staff_users_id_fk" FOREIGN KEY ("owner") REFERENCES "mf"."staff_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."product_info" ADD CONSTRAINT "product_info_store_id_store_info_id_fk" FOREIGN KEY ("store_id") REFERENCES "mf"."store_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."product_info" ALTER COLUMN "store_id" SET NOT NULL;

View file

@ -1,22 +0,0 @@
CREATE TABLE "mf"."order_cancellations" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."order_cancellations_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"order_id" integer NOT NULL,
"user_id" integer NOT NULL,
"reason" varchar(500),
"cancellation_user_notes" text,
"cancellation_admin_notes" text,
"cancellation_reviewed" boolean DEFAULT false NOT NULL,
"refund_amount" numeric(10, 2),
"refund_status" varchar(50) DEFAULT 'none',
"razorpay_refund_id" varchar(255),
"created_at" timestamp DEFAULT now() NOT NULL,
"reviewed_at" timestamp,
"refund_processed_at" timestamp,
CONSTRAINT "order_cancellations_order_id_unique" UNIQUE("order_id")
);
--> statement-breakpoint
ALTER TABLE "mf"."order_cancellations" ADD CONSTRAINT "order_cancellations_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."order_cancellations" ADD CONSTRAINT "order_cancellations_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."order_status" DROP COLUMN "is_refund_done";--> statement-breakpoint
ALTER TABLE "mf"."orders" DROP COLUMN "cancellation_reviewed";--> statement-breakpoint
ALTER TABLE "mf"."orders" DROP COLUMN "is_refund_done";

View file

@ -1,20 +0,0 @@
CREATE TABLE "mf"."product_tag_info" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."product_tag_info_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"tag_name" varchar(100) NOT NULL,
"tag_description" varchar(500),
"image_url" varchar(500),
"is_dashboard_tag" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "product_tag_info_tag_name_unique" UNIQUE("tag_name")
);
--> statement-breakpoint
CREATE TABLE "mf"."product_tags" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."product_tags_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"product_id" integer NOT NULL,
"tag_id" integer NOT NULL,
"assigned_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "unique_product_tag" UNIQUE("product_id","tag_id")
);
--> statement-breakpoint
ALTER TABLE "mf"."product_tags" ADD CONSTRAINT "product_tags_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."product_tags" ADD CONSTRAINT "product_tags_tag_id_product_tag_info_id_fk" FOREIGN KEY ("tag_id") REFERENCES "mf"."product_tag_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."coupon_usage" ADD COLUMN "order_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."coupon_usage" ADD CONSTRAINT "coupon_usage_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."coupons" ADD COLUMN "exclusive_apply" boolean DEFAULT false NOT NULL;

View file

@ -1,21 +0,0 @@
CREATE TABLE "mf"."coupon_applicable_products" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."coupon_applicable_products_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"coupon_id" integer NOT NULL,
"product_id" integer NOT NULL,
CONSTRAINT "unique_coupon_product" UNIQUE("coupon_id","product_id")
);
--> statement-breakpoint
CREATE TABLE "mf"."coupon_applicable_users" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."coupon_applicable_users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"coupon_id" integer NOT NULL,
"user_id" integer NOT NULL,
CONSTRAINT "unique_coupon_user" UNIQUE("coupon_id","user_id")
);
--> statement-breakpoint
ALTER TABLE "mf"."coupon_usage" ADD COLUMN "order_item_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."order_items" ADD COLUMN "discounted_price" numeric(10, 2);--> statement-breakpoint
ALTER TABLE "mf"."coupon_applicable_products" ADD CONSTRAINT "coupon_applicable_products_coupon_id_coupons_id_fk" FOREIGN KEY ("coupon_id") REFERENCES "mf"."coupons"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."coupon_applicable_products" ADD CONSTRAINT "coupon_applicable_products_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."coupon_applicable_users" ADD CONSTRAINT "coupon_applicable_users_coupon_id_coupons_id_fk" FOREIGN KEY ("coupon_id") REFERENCES "mf"."coupons"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."coupon_applicable_users" ADD CONSTRAINT "coupon_applicable_users_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."coupon_usage" ADD CONSTRAINT "coupon_usage_order_item_id_order_items_id_fk" FOREIGN KEY ("order_item_id") REFERENCES "mf"."order_items"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."order_cancellations" RENAME COLUMN "razorpay_refund_id" TO "merchant_refund_id";

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."product_info" ADD COLUMN "is_suspended" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."user_details" ADD COLUMN "is_suspended" boolean DEFAULT false NOT NULL;

View file

@ -1,15 +0,0 @@
CREATE TABLE "mf"."refunds" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."refunds_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"order_id" integer NOT NULL,
"refund_amount" numeric(10, 2),
"refund_status" varchar(50) DEFAULT 'none',
"merchant_refund_id" varchar(255),
"refund_processed_at" timestamp,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD COLUMN "cancellation_user_notes" text;--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD COLUMN "cancellation_admin_notes" text;--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD COLUMN "cancellation_reviewed" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD COLUMN "cancellation_reviewed_at" timestamp;--> statement-breakpoint
ALTER TABLE "mf"."refunds" ADD CONSTRAINT "refunds_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
DROP TABLE "mf"."order_cancellations" CASCADE;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."order_status" ADD COLUMN "refund_coupon_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."order_status" ADD CONSTRAINT "order_status_refund_coupon_id_coupons_id_fk" FOREIGN KEY ("refund_coupon_id") REFERENCES "mf"."coupons"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."complaints" ADD COLUMN "images" jsonb;

View file

@ -1,23 +0,0 @@
CREATE TYPE "public"."upload_status" AS ENUM('pending', 'claimed');--> statement-breakpoint
CREATE TABLE "mf"."product_reviews" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."product_reviews_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"product_id" integer NOT NULL,
"review_body" text NOT NULL,
"image_urls" jsonb,
"review_time" timestamp DEFAULT now() NOT NULL,
"ratings" real NOT NULL,
"admin_response" text,
"admin_response_images" jsonb,
CONSTRAINT "rating_check" CHECK ("mf"."product_reviews"."ratings" >= 1 AND "mf"."product_reviews"."ratings" <= 5)
);
--> statement-breakpoint
CREATE TABLE "mf"."upload_url_status" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."upload_url_status_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"created_at" timestamp DEFAULT now() NOT NULL,
"key" varchar(500) NOT NULL,
"status" "upload_status" DEFAULT 'pending' NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."product_reviews" ADD CONSTRAINT "product_reviews_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."product_reviews" ADD CONSTRAINT "product_reviews_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."store_info" ADD COLUMN "image_url" varchar(500);

View file

@ -1,16 +0,0 @@
CREATE TABLE "mf"."address_areas" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."address_areas_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"place_name" varchar(255) NOT NULL,
"zone_id" integer,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."address_zones" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."address_zones_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"zone_name" varchar(255) NOT NULL,
"added_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "zone_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."address_areas" ADD CONSTRAINT "address_areas_zone_id_address_zones_id_fk" FOREIGN KEY ("zone_id") REFERENCES "mf"."address_zones"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD CONSTRAINT "addresses_zone_id_address_zones_id_fk" FOREIGN KEY ("zone_id") REFERENCES "mf"."address_zones"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."orders" ADD COLUMN "delivery_charge" numeric(10, 2) DEFAULT '0' NOT NULL;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."product_info" ADD COLUMN "increment_step" real DEFAULT 1 NOT NULL;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."product_info" ALTER COLUMN "store_id" DROP NOT NULL;

View file

@ -1,16 +0,0 @@
CREATE TABLE "mf"."product_group_info" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."product_group_info_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"group_name" varchar(255) NOT NULL,
"description" varchar(500),
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "mf"."product_group_membership" (
"product_id" integer NOT NULL,
"group_id" integer NOT NULL,
"added_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "product_group_membership_pk" UNIQUE("product_id","group_id")
);
--> statement-breakpoint
ALTER TABLE "mf"."product_group_membership" ADD CONSTRAINT "product_group_membership_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."product_group_membership" ADD CONSTRAINT "product_group_membership_group_id_product_group_info_id_fk" FOREIGN KEY ("group_id") REFERENCES "mf"."product_group_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."order_items" ADD COLUMN "is_packaged" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."order_items" ADD COLUMN "is_package_verified" boolean DEFAULT false NOT NULL;

View file

@ -1,15 +0,0 @@
CREATE TABLE "mf"."home_banners" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."home_banners_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"name" varchar(255) NOT NULL,
"image_url" varchar(500) NOT NULL,
"description" varchar(500),
"product_id" integer,
"redirect_url" varchar(500),
"serial_num" integer NOT NULL,
"is_active" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"last_updated" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "home_banners_serial_num_unique" UNIQUE("serial_num")
);
--> statement-breakpoint
ALTER TABLE "mf"."home_banners" ADD CONSTRAINT "home_banners_product_id_product_info_id_fk" FOREIGN KEY ("product_id") REFERENCES "mf"."product_info"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."home_banners" ALTER COLUMN "serial_num" DROP NOT NULL;

View file

@ -1,3 +0,0 @@
ALTER TABLE "mf"."home_banners" RENAME COLUMN "product_id" TO "product_ids";--> statement-breakpoint
ALTER TABLE "mf"."home_banners" DROP CONSTRAINT "home_banners_serial_num_unique";--> statement-breakpoint
ALTER TABLE "mf"."home_banners" DROP CONSTRAINT "home_banners_product_id_product_info_id_fk";

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."home_banners" DROP COLUMN "product_ids";

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."home_banners" ADD COLUMN "product_ids" integer[];

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."coupons" ADD COLUMN "applicable_users" jsonb;

View file

@ -1,3 +0,0 @@
ALTER TABLE "mf"."coupons" DROP CONSTRAINT "coupons_target_user_users_id_fk";
--> statement-breakpoint
ALTER TABLE "mf"."coupons" DROP COLUMN "target_user";

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."orders" ADD COLUMN "order_group_id" varchar(255);--> statement-breakpoint
ALTER TABLE "mf"."orders" ADD COLUMN "order_group_proportion" numeric(10, 4);

View file

@ -1,24 +0,0 @@
CREATE TABLE "mf"."reserved_coupons" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."reserved_coupons_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"secret_code" varchar(50) NOT NULL,
"coupon_code" varchar(50) NOT NULL,
"discount_percent" numeric(5, 2),
"flat_discount" numeric(10, 2),
"min_order" numeric(10, 2),
"product_ids" jsonb,
"max_value" numeric(10, 2),
"valid_till" timestamp,
"max_limit_for_user" integer,
"exclusive_apply" boolean DEFAULT false NOT NULL,
"is_redeemed" boolean DEFAULT false NOT NULL,
"redeemed_by" integer,
"redeemed_at" timestamp,
"created_by" integer NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "reserved_coupons_secret_code_unique" UNIQUE("secret_code"),
CONSTRAINT "unique_secret_code" UNIQUE("secret_code")
);
--> statement-breakpoint
ALTER TABLE "mf"."reserved_coupons" ADD CONSTRAINT "reserved_coupons_redeemed_by_users_id_fk" FOREIGN KEY ("redeemed_by") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."reserved_coupons" ADD CONSTRAINT "reserved_coupons_created_by_staff_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "mf"."staff_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."coupons" DROP COLUMN "applicable_users";

View file

@ -1,28 +0,0 @@
CREATE TYPE "public"."staff_permission" AS ENUM('crud_product', 'make_coupon');--> statement-breakpoint
CREATE TYPE "public"."staff_role" AS ENUM('admin', 'marketer', 'delivery_staff');--> statement-breakpoint
CREATE TABLE "mf"."staff_permissions" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."staff_permissions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"permission_name" "staff_permission" NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "unique_permission_name" UNIQUE("permission_name")
);
--> statement-breakpoint
CREATE TABLE "mf"."staff_role_permissions" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."staff_role_permissions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"staff_role_id" integer NOT NULL,
"staff_permission_id" integer NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "unique_role_permission" UNIQUE("staff_role_id","staff_permission_id")
);
--> statement-breakpoint
CREATE TABLE "mf"."staff_roles" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."staff_roles_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"role_name" "staff_role" NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "unique_role_name" UNIQUE("role_name")
);
--> statement-breakpoint
ALTER TABLE "mf"."staff_users" ADD COLUMN "staff_role_id" integer;--> statement-breakpoint
ALTER TABLE "mf"."staff_role_permissions" ADD CONSTRAINT "staff_role_permissions_staff_role_id_staff_roles_id_fk" FOREIGN KEY ("staff_role_id") REFERENCES "mf"."staff_roles"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."staff_role_permissions" ADD CONSTRAINT "staff_role_permissions_staff_permission_id_staff_permissions_id_fk" FOREIGN KEY ("staff_permission_id") REFERENCES "mf"."staff_permissions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."staff_users" ADD CONSTRAINT "staff_users_staff_role_id_staff_roles_id_fk" FOREIGN KEY ("staff_role_id") REFERENCES "mf"."staff_roles"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,2 +0,0 @@
ALTER TYPE "public"."staff_permission" ADD VALUE 'crud_staff_users';--> statement-breakpoint
ALTER TYPE "public"."staff_role" ADD VALUE 'super_admin' BEFORE 'admin';

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."coupons" ALTER COLUMN "created_by" DROP NOT NULL;

View file

@ -1,3 +0,0 @@
ALTER TABLE "mf"."delivery_slot_info" ADD COLUMN "is_flash" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."product_info" ADD COLUMN "is_flash_available" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."product_info" ADD COLUMN "flash_price" numeric(10, 2);

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."orders" ADD COLUMN "is_flash_delivery" boolean DEFAULT false NOT NULL;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."product_info" ADD COLUMN "product_quantity" real DEFAULT 1 NOT NULL;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."order_status" ADD COLUMN "is_cancelled_by_admin" boolean;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."vendor_snippets" ALTER COLUMN "slot_id" DROP NOT NULL;--> statement-breakpoint
ALTER TABLE "mf"."vendor_snippets" ADD COLUMN "is_permanent" boolean DEFAULT false NOT NULL;

View file

@ -1,2 +0,0 @@
ALTER TABLE "mf"."addresses" ADD COLUMN "admin_latitude" real;--> statement-breakpoint
ALTER TABLE "mf"."addresses" ADD COLUMN "admin_longitude" real;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."addresses" ADD COLUMN "google_maps_url" varchar(500);

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."delivery_slot_info" ADD COLUMN "group_ids" jsonb;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."product_tag_info" ADD COLUMN "related_stores" jsonb;

View file

@ -1,7 +0,0 @@
CREATE TABLE "mf"."user_notifications" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."user_notifications_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"image_url" varchar(500),
"created_at" timestamp DEFAULT now() NOT NULL,
"body" text NOT NULL,
"applicable_users" jsonb
);

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."user_notifications" ADD COLUMN "title" varchar(255) NOT NULL;

View file

@ -1 +0,0 @@
ALTER TABLE "mf"."delivery_slot_info" ADD COLUMN "is_capacity_full" boolean DEFAULT false NOT NULL;

View file

@ -1,7 +0,0 @@
CREATE TABLE "mf"."unlogged_user_tokens" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."unlogged_user_tokens_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"token" varchar(500) NOT NULL,
"added_at" timestamp DEFAULT now() NOT NULL,
"last_verified" timestamp,
CONSTRAINT "unlogged_user_tokens_token_unique" UNIQUE("token")
);

View file

@ -1,13 +0,0 @@
CREATE TABLE "mf"."user_incidents" (
"id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "mf"."user_incidents_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
"user_id" integer NOT NULL,
"order_id" integer,
"date_added" timestamp DEFAULT now() NOT NULL,
"admin_comment" text,
"added_by" integer,
"negativity_score" integer
);
--> statement-breakpoint
ALTER TABLE "mf"."user_incidents" ADD CONSTRAINT "user_incidents_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "mf"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."user_incidents" ADD CONSTRAINT "user_incidents_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "mf"."orders"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mf"."user_incidents" ADD CONSTRAINT "user_incidents_added_by_staff_users_id_fk" FOREIGN KEY ("added_by") REFERENCES "mf"."staff_users"("id") ON DELETE no action ON UPDATE no action;

View file

@ -1,976 +0,0 @@
{
"id": "fad820d3-856d-4d25-8a79-841c6c0a5eb5",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"mf.addresses": {
"name": "addresses",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "addresses_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"address": {
"name": "address",
"type": "varchar(500)",
"primaryKey": false,
"notNull": true
},
"is_default": {
"name": "is_default",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {},
"foreignKeys": {
"addresses_user_id_users_id_fk": {
"name": "addresses_user_id_users_id_fk",
"tableFrom": "addresses",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.cart_items": {
"name": "cart_items",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "cart_items_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"added_at": {
"name": "added_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"cart_items_user_id_users_id_fk": {
"name": "cart_items_user_id_users_id_fk",
"tableFrom": "cart_items",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"cart_items_product_id_product_info_id_fk": {
"name": "cart_items_product_id_product_info_id_fk",
"tableFrom": "cart_items",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_user_product": {
"name": "unique_user_product",
"nullsNotDistinct": false,
"columns": [
"user_id",
"product_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.delivery_slot_info": {
"name": "delivery_slot_info",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "delivery_slot_info_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"deliveryTime": {
"name": "deliveryTime",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"freezeTime": {
"name": "freezeTime",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.notifications": {
"name": "notifications",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "notifications_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"body": {
"name": "body",
"type": "varchar(512)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"is_read": {
"name": "is_read",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"notifications_user_id_users_id_fk": {
"name": "notifications_user_id_users_id_fk",
"tableFrom": "notifications",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.order_items": {
"name": "order_items",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "order_items_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"order_id": {
"name": "order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"amount": {
"name": "amount",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"order_items_order_id_orders_id_fk": {
"name": "order_items_order_id_orders_id_fk",
"tableFrom": "order_items",
"tableTo": "orders",
"schemaTo": "mf",
"columnsFrom": [
"order_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"order_items_product_id_product_info_id_fk": {
"name": "order_items_product_id_product_info_id_fk",
"tableFrom": "order_items",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.orders": {
"name": "orders",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "orders_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"address_id": {
"name": "address_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"slot_id": {
"name": "slot_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"total_amount": {
"name": "total_amount",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "order_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"orders_user_id_users_id_fk": {
"name": "orders_user_id_users_id_fk",
"tableFrom": "orders",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"orders_address_id_addresses_id_fk": {
"name": "orders_address_id_addresses_id_fk",
"tableFrom": "orders",
"tableTo": "addresses",
"schemaTo": "mf",
"columnsFrom": [
"address_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"orders_slot_id_delivery_slot_info_id_fk": {
"name": "orders_slot_id_delivery_slot_info_id_fk",
"tableFrom": "orders",
"tableTo": "delivery_slot_info",
"schemaTo": "mf",
"columnsFrom": [
"slot_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.payments": {
"name": "payments",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "payments_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"order_id": {
"name": "order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"gateway": {
"name": "gateway",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"gateway_order_id": {
"name": "gateway_order_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"amount": {
"name": "amount",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"payments_order_id_orders_id_fk": {
"name": "payments_order_id_orders_id_fk",
"tableFrom": "payments",
"tableTo": "orders",
"schemaTo": "mf",
"columnsFrom": [
"order_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.product_categories": {
"name": "product_categories",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "product_categories_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "varchar(500)",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.product_info": {
"name": "product_info",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "product_info_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"short_description": {
"name": "short_description",
"type": "varchar(500)",
"primaryKey": false,
"notNull": false
},
"long_description": {
"name": "long_description",
"type": "varchar(1000)",
"primaryKey": false,
"notNull": false
},
"unit_id": {
"name": "unit_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"images": {
"name": "images",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"product_info_unit_id_units_id_fk": {
"name": "product_info_unit_id_units_id_fk",
"tableFrom": "product_info",
"tableTo": "units",
"schemaTo": "mf",
"columnsFrom": [
"unit_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.product_slots": {
"name": "product_slots",
"schema": "mf",
"columns": {
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"slot_id": {
"name": "slot_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"product_slots_product_id_product_info_id_fk": {
"name": "product_slots_product_id_product_info_id_fk",
"tableFrom": "product_slots",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"product_slots_slot_id_delivery_slot_info_id_fk": {
"name": "product_slots_slot_id_delivery_slot_info_id_fk",
"tableFrom": "product_slots",
"tableTo": "delivery_slot_info",
"schemaTo": "mf",
"columnsFrom": [
"slot_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"product_slot_pk": {
"name": "product_slot_pk",
"nullsNotDistinct": false,
"columns": [
"product_id",
"slot_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.special_deals": {
"name": "special_deals",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "special_deals_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"valid_till": {
"name": "valid_till",
"type": "timestamp",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"special_deals_product_id_product_info_id_fk": {
"name": "special_deals_product_id_product_info_id_fk",
"tableFrom": "special_deals",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.units": {
"name": "units",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "units_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"short_notation": {
"name": "short_notation",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"full_name": {
"name": "full_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_short_notation": {
"name": "unique_short_notation",
"nullsNotDistinct": false,
"columns": [
"short_notation"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.users": {
"name": "users",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "users_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"mobile": {
"name": "mobile",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_email": {
"name": "unique_email",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.order_status": {
"name": "order_status",
"schema": "public",
"values": [
"pending",
"delivered",
"cancelled"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View file

@ -1,976 +0,0 @@
{
"id": "f702bb39-6b79-4352-979d-537ecbaafd02",
"prevId": "fad820d3-856d-4d25-8a79-841c6c0a5eb5",
"version": "7",
"dialect": "postgresql",
"tables": {
"mf.addresses": {
"name": "addresses",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "addresses_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"address": {
"name": "address",
"type": "varchar(500)",
"primaryKey": false,
"notNull": true
},
"is_default": {
"name": "is_default",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {},
"foreignKeys": {
"addresses_user_id_users_id_fk": {
"name": "addresses_user_id_users_id_fk",
"tableFrom": "addresses",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.cart_items": {
"name": "cart_items",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "cart_items_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"added_at": {
"name": "added_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"cart_items_user_id_users_id_fk": {
"name": "cart_items_user_id_users_id_fk",
"tableFrom": "cart_items",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"cart_items_product_id_product_info_id_fk": {
"name": "cart_items_product_id_product_info_id_fk",
"tableFrom": "cart_items",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_user_product": {
"name": "unique_user_product",
"nullsNotDistinct": false,
"columns": [
"user_id",
"product_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.delivery_slot_info": {
"name": "delivery_slot_info",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "delivery_slot_info_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"delivery_time": {
"name": "delivery_time",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"freeze_time": {
"name": "freeze_time",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.notifications": {
"name": "notifications",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "notifications_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"title": {
"name": "title",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"body": {
"name": "body",
"type": "varchar(512)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(50)",
"primaryKey": false,
"notNull": false
},
"is_read": {
"name": "is_read",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"notifications_user_id_users_id_fk": {
"name": "notifications_user_id_users_id_fk",
"tableFrom": "notifications",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.order_items": {
"name": "order_items",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "order_items_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"order_id": {
"name": "order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"amount": {
"name": "amount",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"order_items_order_id_orders_id_fk": {
"name": "order_items_order_id_orders_id_fk",
"tableFrom": "order_items",
"tableTo": "orders",
"schemaTo": "mf",
"columnsFrom": [
"order_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"order_items_product_id_product_info_id_fk": {
"name": "order_items_product_id_product_info_id_fk",
"tableFrom": "order_items",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.orders": {
"name": "orders",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "orders_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"user_id": {
"name": "user_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"address_id": {
"name": "address_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"slot_id": {
"name": "slot_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"total_amount": {
"name": "total_amount",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "order_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"orders_user_id_users_id_fk": {
"name": "orders_user_id_users_id_fk",
"tableFrom": "orders",
"tableTo": "users",
"schemaTo": "mf",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"orders_address_id_addresses_id_fk": {
"name": "orders_address_id_addresses_id_fk",
"tableFrom": "orders",
"tableTo": "addresses",
"schemaTo": "mf",
"columnsFrom": [
"address_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"orders_slot_id_delivery_slot_info_id_fk": {
"name": "orders_slot_id_delivery_slot_info_id_fk",
"tableFrom": "orders",
"tableTo": "delivery_slot_info",
"schemaTo": "mf",
"columnsFrom": [
"slot_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.payments": {
"name": "payments",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "payments_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"order_id": {
"name": "order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"gateway": {
"name": "gateway",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"gateway_order_id": {
"name": "gateway_order_id",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"amount": {
"name": "amount",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"payments_order_id_orders_id_fk": {
"name": "payments_order_id_orders_id_fk",
"tableFrom": "payments",
"tableTo": "orders",
"schemaTo": "mf",
"columnsFrom": [
"order_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.product_categories": {
"name": "product_categories",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "product_categories_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "varchar(500)",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.product_info": {
"name": "product_info",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "product_info_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"short_description": {
"name": "short_description",
"type": "varchar(500)",
"primaryKey": false,
"notNull": false
},
"long_description": {
"name": "long_description",
"type": "varchar(1000)",
"primaryKey": false,
"notNull": false
},
"unit_id": {
"name": "unit_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"images": {
"name": "images",
"type": "jsonb",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"product_info_unit_id_units_id_fk": {
"name": "product_info_unit_id_units_id_fk",
"tableFrom": "product_info",
"tableTo": "units",
"schemaTo": "mf",
"columnsFrom": [
"unit_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.product_slots": {
"name": "product_slots",
"schema": "mf",
"columns": {
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"slot_id": {
"name": "slot_id",
"type": "integer",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"product_slots_product_id_product_info_id_fk": {
"name": "product_slots_product_id_product_info_id_fk",
"tableFrom": "product_slots",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"product_slots_slot_id_delivery_slot_info_id_fk": {
"name": "product_slots_slot_id_delivery_slot_info_id_fk",
"tableFrom": "product_slots",
"tableTo": "delivery_slot_info",
"schemaTo": "mf",
"columnsFrom": [
"slot_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"product_slot_pk": {
"name": "product_slot_pk",
"nullsNotDistinct": false,
"columns": [
"product_id",
"slot_id"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.special_deals": {
"name": "special_deals",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "special_deals_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"valid_till": {
"name": "valid_till",
"type": "timestamp",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"special_deals_product_id_product_info_id_fk": {
"name": "special_deals_product_id_product_info_id_fk",
"tableFrom": "special_deals",
"tableTo": "product_info",
"schemaTo": "mf",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.units": {
"name": "units",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "units_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"short_notation": {
"name": "short_notation",
"type": "varchar(50)",
"primaryKey": false,
"notNull": true
},
"full_name": {
"name": "full_name",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_short_notation": {
"name": "unique_short_notation",
"nullsNotDistinct": false,
"columns": [
"short_notation"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"mf.users": {
"name": "users",
"schema": "mf",
"columns": {
"id": {
"name": "id",
"type": "integer",
"primaryKey": true,
"notNull": true,
"identity": {
"type": "always",
"name": "users_id_seq",
"schema": "mf",
"increment": "1",
"startWith": "1",
"minValue": "1",
"maxValue": "2147483647",
"cache": "1",
"cycle": false
}
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"mobile": {
"name": "mobile",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"unique_email": {
"name": "unique_email",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.order_status": {
"name": "order_status",
"schema": "public",
"values": [
"pending",
"delivered",
"cancelled"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more