@wrenautomation/vireo 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ CREATE TABLE "vireo"."calls" (
2
+ "id" serial NOT NULL,
3
+ "sample_id" integer NOT NULL,
4
+ "by" varchar(320) NOT NULL,
5
+ "score" smallint NOT NULL,
6
+ "verdict" varchar(8) NOT NULL,
7
+ "at" timestamp with time zone DEFAULT now() NOT NULL,
8
+ CONSTRAINT "pk_calls" PRIMARY KEY("id"),
9
+ CONSTRAINT "uq_vireo_calls_sample_by" UNIQUE("sample_id","by"),
10
+ CONSTRAINT "ck_vireo_calls_verdict" CHECK (("verdict")::text = ANY ((ARRAY['amazing'::character varying, 'good'::character varying, 'okay'::character varying, 'bad'::character varying])::text[])),
11
+ CONSTRAINT "ck_vireo_calls_score" CHECK ("vireo"."calls"."score" BETWEEN 1 AND 10),
12
+ CONSTRAINT "ck_vireo_calls_zone" CHECK ("vireo"."calls"."verdict" = (CASE WHEN "vireo"."calls"."score" >= 9 THEN 'amazing' WHEN "vireo"."calls"."score" >= 7 THEN 'good' WHEN "vireo"."calls"."score" >= 4 THEN 'okay' ELSE 'bad' END))
13
+ );
14
+ --> statement-breakpoint
15
+ ALTER TABLE "vireo"."samples" DROP CONSTRAINT "ck_vireo_samples_verdict";--> statement-breakpoint
16
+ ALTER TABLE "vireo"."samples" DROP CONSTRAINT "ck_vireo_samples_score";--> statement-breakpoint
17
+ ALTER TABLE "vireo"."samples" DROP CONSTRAINT "ck_vireo_samples_call";--> statement-breakpoint
18
+ ALTER TABLE "vireo"."calls" ADD CONSTRAINT "fk_calls_sample_id_samples" FOREIGN KEY ("sample_id") REFERENCES "vireo"."samples"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
19
+ CREATE INDEX "ix_vireo_calls_by" ON "vireo"."calls" USING btree ("by");--> statement-breakpoint
20
+ -- each old call moves to calls; who made it was not kept: "person" (a host may name them after)
21
+ INSERT INTO "vireo"."calls" ("sample_id", "by", "score", "verdict")
22
+ SELECT "id", 'person', "score", "verdict" FROM "vireo"."samples" WHERE "score" IS NOT NULL;--> statement-breakpoint
23
+ ALTER TABLE "vireo"."samples" DROP COLUMN "score";--> statement-breakpoint
24
+ ALTER TABLE "vireo"."samples" DROP COLUMN "verdict";