CREATE TABLE IF NOT EXISTS "chunk_sections" (
	"server_id" uuid NOT NULL REFERENCES "servers"("id") ON DELETE CASCADE,
	"dimension" integer NOT NULL,
	"x" integer NOT NULL,
	"z" integer NOT NULL,
	"section_y" integer NOT NULL,
	"blocks" text NOT NULL,
	"updated_at" timestamptz NOT NULL DEFAULT now(),
	PRIMARY KEY ("server_id", "dimension", "x", "z", "section_y")
);

CREATE TABLE IF NOT EXISTS "mesh_pointers" (
	"server_id" uuid NOT NULL REFERENCES "servers"("id") ON DELETE CASCADE,
	"dimension" integer NOT NULL,
	"x" integer NOT NULL,
	"z" integer NOT NULL,
	"section_y" integer NOT NULL,
	"storage_key" text NOT NULL,
	"content_hash" text NOT NULL,
	"rendered_at" timestamptz NOT NULL DEFAULT now(),
	PRIMARY KEY ("server_id", "dimension", "x", "z", "section_y")
);
