-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define initial data schemas; fix linting errors
- Loading branch information
1 parent
5d879fc
commit 86caf3b
Showing
13 changed files
with
595 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ALTER TABLE "items" ADD COLUMN "category" varchar(63) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "brand" varchar(63) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "barcode" varchar(63) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "description" text;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "selling_price" numeric(10, 2) DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "purchase_price" numeric(10, 2) DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "images" json DEFAULT 'null'::json;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "created_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "updated_at" timestamp DEFAULT now(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
CREATE TABLE IF NOT EXISTS "brands" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"name" varchar(32) NOT NULL, | ||
CONSTRAINT "brands_name_unique" UNIQUE("name") | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "categories" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"name" varchar(32) NOT NULL, | ||
"description" text, | ||
CONSTRAINT "categories_name_unique" UNIQUE("name") | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "units" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"name" varchar(24) NOT NULL, | ||
"abbreviation" varchar(8) NOT NULL, | ||
CONSTRAINT "units_name_unique" UNIQUE("name"), | ||
CONSTRAINT "units_abbreviation_unique" UNIQUE("abbreviation") | ||
); | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "warehouses" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"name" varchar(32) NOT NULL, | ||
"type" varchar(32) NOT NULL, | ||
"description" text, | ||
"location" varchar(32) NOT NULL | ||
); | ||
--> statement-breakpoint | ||
ALTER TABLE "items" ALTER COLUMN "name" SET DATA TYPE varchar(128);--> statement-breakpoint | ||
ALTER TABLE "items" ALTER COLUMN "category" SET DATA TYPE varchar(64);--> statement-breakpoint | ||
ALTER TABLE "items" ALTER COLUMN "brand" SET DATA TYPE varchar(64);--> statement-breakpoint | ||
ALTER TABLE "items" ALTER COLUMN "barcode" SET DATA TYPE varchar(64);--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "tax_rate" numeric(3, 1) DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "width" numeric(10, 2) DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "height" numeric(10, 2) DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "depth" numeric(10, 2) DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "dimensions_unit" varchar(8) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "weight" numeric(10, 2) DEFAULT '0' NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "warehouse" varchar NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "sku" varchar(128) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "quantity" integer NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "unit" varchar(8) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "reorder_point" integer NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "supplier" varchar(64) NOT NULL;--> statement-breakpoint | ||
ALTER TABLE "items" ADD COLUMN "notes" text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"id": "c94e65e8-8faf-4c7e-90ea-9b7040f619f1", | ||
"prevId": "354d536f-c455-42b5-be06-72c96dbab27f", | ||
"version": "5", | ||
"dialect": "pg", | ||
"tables": { | ||
"items": { | ||
"name": "items", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "serial", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"name": { | ||
"name": "name", | ||
"type": "varchar(127)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"category": { | ||
"name": "category", | ||
"type": "varchar(63)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"brand": { | ||
"name": "brand", | ||
"type": "varchar(63)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"barcode": { | ||
"name": "barcode", | ||
"type": "varchar(63)", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"description": { | ||
"name": "description", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"selling_price": { | ||
"name": "selling_price", | ||
"type": "numeric(10, 2)", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "'0'" | ||
}, | ||
"purchase_price": { | ||
"name": "purchase_price", | ||
"type": "numeric(10, 2)", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "'0'" | ||
}, | ||
"images": { | ||
"name": "images", | ||
"type": "json", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "'null'::json" | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "timestamp", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "now()" | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "timestamp", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "now()" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": {} | ||
} | ||
}, | ||
"enums": {}, | ||
"schemas": {}, | ||
"_meta": { | ||
"columns": {}, | ||
"schemas": {}, | ||
"tables": {} | ||
} | ||
} |
Oops, something went wrong.