Check keywords on transaction, update shop gold
Shops now have a "type" and keywords of items they only deal with. Also add vendors table in preparation for implementing the endpoint.
This commit is contained in:
@@ -13,6 +13,11 @@ CREATE TABLE "shops" (
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"owner_id" INTEGER REFERENCES "owners"(id) NOT NULL,
|
||||
"description" TEXT,
|
||||
"gold" INTEGER NOT NULL DEFAULT 0
|
||||
CONSTRAINT "shop_gold_gt_zero" CHECK (gold >= 0),
|
||||
"shop_type" VARCHAR(255) NOT NULL DEFAULT 'general_store',
|
||||
"vendor_keywords" TEXT[] NOT NULL DEFAULT '{"VendorItemKey", "VendorNoSale"}',
|
||||
"vendor_keywords_exclude" BOOLEAN NOT NULL DEFAULT true,
|
||||
"created_at" timestamp(3) NOT NULL,
|
||||
"updated_at" timestamp(3) NOT NULL
|
||||
);
|
||||
@@ -36,6 +41,14 @@ CREATE TABLE "merchandise_lists" (
|
||||
"updated_at" timestamp(3) NOT NULL
|
||||
);
|
||||
CREATE INDEX "merchandise_lists_mod_name_and_local_form_id" ON "merchandise_lists" USING GIN (form_list jsonb_path_ops);
|
||||
CREATE TABLE "vendors" (
|
||||
"id" SERIAL PRIMARY KEY NOT NULL,
|
||||
"shop_id" INTEGER REFERENCES "shops"(id) NOT NULL UNIQUE,
|
||||
"owner_id" INTEGER REFERENCES "owners"(id) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"body_preset" INTEGER NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX "vendors_unique_name_and_owner_id" ON "vendors" ("name", "owner_id", "shop_id");
|
||||
CREATE TABLE "transactions" (
|
||||
"id" SERIAL PRIMARY KEY NOT NULL,
|
||||
"shop_id" INTEGER REFERENCES "shops"(id) NOT NULL,
|
||||
|
||||
@@ -3,4 +3,5 @@ DROP TABLE shops CASCADE;
|
||||
DROP TABLE interior_ref_lists CASCADE;
|
||||
DROP TABLE merchandise_lists CASCADE;
|
||||
DROP TABLE transactions CASCADE;
|
||||
DROP TABLE vendors CASCADE;
|
||||
DROP TABLE _sqlx_migrations CASCADE;
|
||||
|
||||
Reference in New Issue
Block a user