You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
942 B
SQL

-- Town objects for editor-placed props (barrel, stump, etc.)
CREATE TABLE IF NOT EXISTS public.town_objects (
id bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
town_id bigint NOT NULL REFERENCES public.towns(id) ON DELETE CASCADE,
object_type text NOT NULL,
variant int NOT NULL DEFAULT 0,
offset_x double precision NOT NULL DEFAULT 0,
offset_y double precision NOT NULL DEFAULT 0,
created_at timestamp with time zone NOT NULL DEFAULT now(),
CONSTRAINT town_objects_object_type_check CHECK (object_type = ANY (ARRAY[
'tree'::text,
'rock'::text,
'cart'::text,
'barrel'::text,
'bush'::text,
'mushroom'::text,
'leaves'::text,
'stump'::text,
'bones'::text,
'ruin'::text
])),
CONSTRAINT town_objects_variant_check CHECK (variant IN (0, 1))
);
CREATE INDEX IF NOT EXISTS idx_town_objects_town ON public.town_objects USING btree (town_id);