@develemit/commerce-server 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ CREATE TYPE "public"."commerce_hold_status" AS ENUM('active', 'released', 'committed');--> statement-breakpoint
2
+ CREATE TYPE "public"."commerce_order_status" AS ENUM('pending', 'paid', 'shipped', 'cancelled', 'expired');--> statement-breakpoint
3
+ CREATE TABLE "commerce_inventory_holds" (
4
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
5
+ "product_id" uuid NOT NULL,
6
+ "quantity" integer NOT NULL,
7
+ "reference" text NOT NULL,
8
+ "expires_at" timestamp with time zone NOT NULL,
9
+ "status" "commerce_hold_status" DEFAULT 'active' NOT NULL,
10
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
11
+ CONSTRAINT "commerce_inventory_holds_quantity_check" CHECK ("commerce_inventory_holds"."quantity" > 0)
12
+ );
13
+ --> statement-breakpoint
14
+ CREATE TABLE "commerce_order_items" (
15
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
16
+ "order_id" uuid NOT NULL,
17
+ "product_id" uuid NOT NULL,
18
+ "name" text NOT NULL,
19
+ "price_cents" integer NOT NULL,
20
+ "quantity" integer NOT NULL
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE TABLE "commerce_orders" (
24
+ "id" uuid PRIMARY KEY NOT NULL,
25
+ "status" "commerce_order_status" DEFAULT 'pending' NOT NULL,
26
+ "email" text,
27
+ "subtotal_cents" integer NOT NULL,
28
+ "currency" text NOT NULL,
29
+ "checkout_session_id" text,
30
+ "shipping_address" jsonb,
31
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
32
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
33
+ CONSTRAINT "commerce_orders_checkout_session_id_unique" UNIQUE("checkout_session_id")
34
+ );
35
+ --> statement-breakpoint
36
+ CREATE TABLE "commerce_stripe_events" (
37
+ "id" text PRIMARY KEY NOT NULL,
38
+ "type" text NOT NULL,
39
+ "processed_at" timestamp with time zone DEFAULT now() NOT NULL
40
+ );
41
+ --> statement-breakpoint
42
+ ALTER TABLE "commerce_inventory_holds" ADD CONSTRAINT "commerce_inventory_holds_product_id_commerce_products_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."commerce_products"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
43
+ ALTER TABLE "commerce_order_items" ADD CONSTRAINT "commerce_order_items_order_id_commerce_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "public"."commerce_orders"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
44
+ CREATE INDEX "commerce_inventory_holds_reference_idx" ON "commerce_inventory_holds" USING btree ("reference");--> statement-breakpoint
45
+ CREATE INDEX "commerce_inventory_holds_product_status_idx" ON "commerce_inventory_holds" USING btree ("product_id","status");
@@ -0,0 +1,15 @@
1
+ CREATE TABLE "commerce_shipping_rates" (
2
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3
+ "label" text NOT NULL,
4
+ "amount_cents" integer NOT NULL,
5
+ "currency" text NOT NULL,
6
+ "min_days" integer,
7
+ "max_days" integer,
8
+ "active" boolean DEFAULT true NOT NULL,
9
+ "sort" integer DEFAULT 0 NOT NULL,
10
+ CONSTRAINT "commerce_shipping_rates_label_unique" UNIQUE("label"),
11
+ CONSTRAINT "commerce_shipping_rates_amount_check" CHECK ("commerce_shipping_rates"."amount_cents" >= 0)
12
+ );
13
+ --> statement-breakpoint
14
+ ALTER TABLE "commerce_orders" ADD COLUMN "shipping_cents" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
15
+ ALTER TABLE "commerce_orders" ADD COLUMN "shipping_label" text;
@@ -0,0 +1 @@
1
+ ALTER TABLE "commerce_product_images" ADD COLUMN "storage_key" text;
@@ -0,0 +1 @@
1
+ ALTER TYPE "public"."commerce_order_status" ADD VALUE 'needs_attention';
@@ -0,0 +1,21 @@
1
+ ALTER TYPE "public"."commerce_order_status" ADD VALUE 'refunded';--> statement-breakpoint
2
+ CREATE TABLE "commerce_order_refunds" (
3
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
4
+ "order_id" uuid NOT NULL,
5
+ "amount_cents" integer NOT NULL,
6
+ "currency" text NOT NULL,
7
+ "reason" text,
8
+ "restocked" boolean DEFAULT false NOT NULL,
9
+ "source" text NOT NULL,
10
+ "gateway_refund_id" text,
11
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
12
+ CONSTRAINT "commerce_order_refunds_gateway_refund_id_unique" UNIQUE("gateway_refund_id"),
13
+ CONSTRAINT "commerce_order_refunds_amount_check" CHECK ("commerce_order_refunds"."amount_cents" > 0)
14
+ );
15
+ --> statement-breakpoint
16
+ ALTER TABLE "commerce_orders" ADD COLUMN "fulfillment_carrier" text;--> statement-breakpoint
17
+ ALTER TABLE "commerce_orders" ADD COLUMN "fulfillment_tracking_number" text;--> statement-breakpoint
18
+ ALTER TABLE "commerce_orders" ADD COLUMN "fulfillment_tracking_url" text;--> statement-breakpoint
19
+ ALTER TABLE "commerce_orders" ADD COLUMN "shipped_at" timestamp with time zone;--> statement-breakpoint
20
+ ALTER TABLE "commerce_order_refunds" ADD CONSTRAINT "commerce_order_refunds_order_id_commerce_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "public"."commerce_orders"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
21
+ CREATE INDEX "commerce_order_refunds_order_idx" ON "commerce_order_refunds" USING btree ("order_id");
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "commerce_order_refunds" ADD COLUMN "idempotency_key" text;--> statement-breakpoint
2
+ ALTER TABLE "commerce_order_refunds" ADD CONSTRAINT "commerce_order_refunds_idempotency_unique" UNIQUE("order_id","idempotency_key");
@@ -0,0 +1,207 @@
1
+ {
2
+ "id": "4b9673e8-fcd7-4bab-81bd-6e72d70c16b7",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.commerce_product_images": {
8
+ "name": "commerce_product_images",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "gen_random_uuid()"
17
+ },
18
+ "product_id": {
19
+ "name": "product_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": true
23
+ },
24
+ "url": {
25
+ "name": "url",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true
29
+ },
30
+ "alt": {
31
+ "name": "alt",
32
+ "type": "text",
33
+ "primaryKey": false,
34
+ "notNull": true,
35
+ "default": "''"
36
+ },
37
+ "position": {
38
+ "name": "position",
39
+ "type": "integer",
40
+ "primaryKey": false,
41
+ "notNull": true,
42
+ "default": 0
43
+ }
44
+ },
45
+ "indexes": {},
46
+ "foreignKeys": {
47
+ "commerce_product_images_product_id_commerce_products_id_fk": {
48
+ "name": "commerce_product_images_product_id_commerce_products_id_fk",
49
+ "tableFrom": "commerce_product_images",
50
+ "tableTo": "commerce_products",
51
+ "columnsFrom": [
52
+ "product_id"
53
+ ],
54
+ "columnsTo": [
55
+ "id"
56
+ ],
57
+ "onDelete": "cascade",
58
+ "onUpdate": "no action"
59
+ }
60
+ },
61
+ "compositePrimaryKeys": {},
62
+ "uniqueConstraints": {},
63
+ "policies": {},
64
+ "checkConstraints": {},
65
+ "isRLSEnabled": false
66
+ },
67
+ "public.commerce_products": {
68
+ "name": "commerce_products",
69
+ "schema": "",
70
+ "columns": {
71
+ "id": {
72
+ "name": "id",
73
+ "type": "uuid",
74
+ "primaryKey": true,
75
+ "notNull": true,
76
+ "default": "gen_random_uuid()"
77
+ },
78
+ "slug": {
79
+ "name": "slug",
80
+ "type": "text",
81
+ "primaryKey": false,
82
+ "notNull": true
83
+ },
84
+ "name": {
85
+ "name": "name",
86
+ "type": "text",
87
+ "primaryKey": false,
88
+ "notNull": true
89
+ },
90
+ "description": {
91
+ "name": "description",
92
+ "type": "text",
93
+ "primaryKey": false,
94
+ "notNull": true,
95
+ "default": "''"
96
+ },
97
+ "materials": {
98
+ "name": "materials",
99
+ "type": "text",
100
+ "primaryKey": false,
101
+ "notNull": false
102
+ },
103
+ "dimensions": {
104
+ "name": "dimensions",
105
+ "type": "text",
106
+ "primaryKey": false,
107
+ "notNull": false
108
+ },
109
+ "price_cents": {
110
+ "name": "price_cents",
111
+ "type": "integer",
112
+ "primaryKey": false,
113
+ "notNull": true
114
+ },
115
+ "currency": {
116
+ "name": "currency",
117
+ "type": "text",
118
+ "primaryKey": false,
119
+ "notNull": true
120
+ },
121
+ "category": {
122
+ "name": "category",
123
+ "type": "text",
124
+ "primaryKey": false,
125
+ "notNull": true
126
+ },
127
+ "quantity": {
128
+ "name": "quantity",
129
+ "type": "integer",
130
+ "primaryKey": false,
131
+ "notNull": true,
132
+ "default": 1
133
+ },
134
+ "status": {
135
+ "name": "status",
136
+ "type": "commerce_product_status",
137
+ "typeSchema": "public",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "default": "'draft'"
141
+ },
142
+ "featured": {
143
+ "name": "featured",
144
+ "type": "boolean",
145
+ "primaryKey": false,
146
+ "notNull": true,
147
+ "default": false
148
+ },
149
+ "created_at": {
150
+ "name": "created_at",
151
+ "type": "timestamp with time zone",
152
+ "primaryKey": false,
153
+ "notNull": true,
154
+ "default": "now()"
155
+ },
156
+ "updated_at": {
157
+ "name": "updated_at",
158
+ "type": "timestamp with time zone",
159
+ "primaryKey": false,
160
+ "notNull": true,
161
+ "default": "now()"
162
+ }
163
+ },
164
+ "indexes": {},
165
+ "foreignKeys": {},
166
+ "compositePrimaryKeys": {},
167
+ "uniqueConstraints": {
168
+ "commerce_products_slug_unique": {
169
+ "name": "commerce_products_slug_unique",
170
+ "nullsNotDistinct": false,
171
+ "columns": [
172
+ "slug"
173
+ ]
174
+ }
175
+ },
176
+ "policies": {},
177
+ "checkConstraints": {
178
+ "commerce_products_quantity_check": {
179
+ "name": "commerce_products_quantity_check",
180
+ "value": "\"commerce_products\".\"quantity\" >= 0"
181
+ }
182
+ },
183
+ "isRLSEnabled": false
184
+ }
185
+ },
186
+ "enums": {
187
+ "public.commerce_product_status": {
188
+ "name": "commerce_product_status",
189
+ "schema": "public",
190
+ "values": [
191
+ "draft",
192
+ "active",
193
+ "archived"
194
+ ]
195
+ }
196
+ },
197
+ "schemas": {},
198
+ "sequences": {},
199
+ "roles": {},
200
+ "policies": {},
201
+ "views": {},
202
+ "_meta": {
203
+ "columns": {},
204
+ "schemas": {},
205
+ "tables": {}
206
+ }
207
+ }