mirror of
https://github.com/ForFarmTeam/ForFarm.git
synced 2025-12-19 14:04:08 +01:00
feat: add user to inventory_items table in migration file
This commit is contained in:
parent
fd00ec02de
commit
b39ddfba6f
@ -1,6 +1,7 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE inventory_items (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id UUID NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
category TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
@ -9,8 +10,11 @@ CREATE TABLE inventory_items (
|
||||
date_added TIMESTAMPTZ NOT NULL,
|
||||
status TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
CONSTRAINT fk_inventory_items_user FOREIGN KEY (user_id) REFERENCES users(uuid) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX idx_inventory_items_category ON inventory_items(category);
|
||||
CREATE INDEX idx_inventory_items_status ON inventory_items(status);
|
||||
-- Create indexes
|
||||
CREATE INDEX idx_inventory_items_user_id ON inventory_items(user_id);
|
||||
CREATE INDEX idx_inventory_items_user_category ON inventory_items(user_id, category);
|
||||
CREATE INDEX idx_inventory_items_user_status ON inventory_items(user_id, status);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user