mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-19 04:00:38 +09:00
Fix PR verify failures after merge
This commit is contained in:
parent
5140d7b0c4
commit
1830216078
9 changed files with 10550 additions and 419 deletions
|
|
@ -1,43 +0,0 @@
|
|||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = 'public' AND table_name = 'company_skills'
|
||||
) THEN
|
||||
CREATE TABLE "company_skills" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"company_id" uuid NOT NULL,
|
||||
"slug" text NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"description" text,
|
||||
"markdown" text NOT NULL,
|
||||
"source_type" text DEFAULT 'local_path' NOT NULL,
|
||||
"source_locator" text,
|
||||
"source_ref" text,
|
||||
"trust_level" text DEFAULT 'markdown_only' NOT NULL,
|
||||
"compatibility" text DEFAULT 'compatible' NOT NULL,
|
||||
"file_inventory" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
||||
"metadata" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
END IF;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_constraint
|
||||
WHERE conname = 'company_skills_company_id_companies_id_fk'
|
||||
) THEN
|
||||
ALTER TABLE "company_skills"
|
||||
ADD CONSTRAINT "company_skills_company_id_companies_id_fk"
|
||||
FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id")
|
||||
ON DELETE no action ON UPDATE no action;
|
||||
END IF;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "company_skills_company_slug_idx" ON "company_skills" USING btree ("company_id","slug");--> statement-breakpoint
|
||||
CREATE INDEX IF NOT EXISTS "company_skills_company_name_idx" ON "company_skills" USING btree ("company_id","name");
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
ALTER TABLE "company_skills" ADD COLUMN "key" text;--> statement-breakpoint
|
||||
UPDATE "company_skills"
|
||||
SET "key" = CASE
|
||||
WHEN COALESCE("metadata"->>'sourceKind', '') = 'paperclip_bundled' THEN 'paperclipai/paperclip/' || "slug"
|
||||
WHEN (COALESCE("metadata"->>'sourceKind', '') = 'github' OR "source_type" = 'github')
|
||||
AND COALESCE("metadata"->>'owner', '') <> ''
|
||||
AND COALESCE("metadata"->>'repo', '') <> ''
|
||||
THEN lower("metadata"->>'owner') || '/' || lower("metadata"->>'repo') || '/' || "slug"
|
||||
WHEN COALESCE("metadata"->>'sourceKind', '') = 'managed_local' THEN 'company/' || "company_id"::text || '/' || "slug"
|
||||
WHEN (COALESCE("metadata"->>'sourceKind', '') = 'url' OR "source_type" = 'url')
|
||||
THEN 'url/'
|
||||
|| COALESCE(
|
||||
NULLIF(regexp_replace(lower(regexp_replace(COALESCE("source_locator", ''), '^https?://([^/]+).*$','\1')), '[^a-z0-9._-]+', '-', 'g'), ''),
|
||||
'unknown'
|
||||
)
|
||||
|| '/'
|
||||
|| substr(md5(COALESCE("source_locator", "slug")), 1, 10)
|
||||
|| '/'
|
||||
|| "slug"
|
||||
WHEN "source_type" = 'local_path' AND COALESCE("source_locator", '') <> ''
|
||||
THEN 'local/' || substr(md5("source_locator"), 1, 10) || '/' || "slug"
|
||||
ELSE 'company/' || "company_id"::text || '/' || "slug"
|
||||
END
|
||||
WHERE "key" IS NULL;--> statement-breakpoint
|
||||
ALTER TABLE "company_skills" ALTER COLUMN "key" SET NOT NULL;--> statement-breakpoint
|
||||
DROP INDEX IF EXISTS "company_skills_company_slug_idx";--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "company_skills_company_key_idx" ON "company_skills" USING btree ("company_id","key");
|
||||
22
packages/db/src/migrations/0040_spotty_the_renegades.sql
Normal file
22
packages/db/src/migrations/0040_spotty_the_renegades.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
CREATE TABLE "company_skills" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"company_id" uuid NOT NULL,
|
||||
"key" text NOT NULL,
|
||||
"slug" text NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"description" text,
|
||||
"markdown" text NOT NULL,
|
||||
"source_type" text DEFAULT 'local_path' NOT NULL,
|
||||
"source_locator" text,
|
||||
"source_ref" text,
|
||||
"trust_level" text DEFAULT 'markdown_only' NOT NULL,
|
||||
"compatibility" text DEFAULT 'compatible' NOT NULL,
|
||||
"file_inventory" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
||||
"metadata" jsonb,
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "company_skills" ADD CONSTRAINT "company_skills_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "company_skills_company_key_idx" ON "company_skills" USING btree ("company_id","key");--> statement-breakpoint
|
||||
CREATE INDEX "company_skills_company_name_idx" ON "company_skills" USING btree ("company_id","name");
|
||||
10481
packages/db/src/migrations/meta/0040_snapshot.json
Normal file
10481
packages/db/src/migrations/meta/0040_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -281,6 +281,13 @@
|
|||
"when": 1774011294562,
|
||||
"tag": "0039_curly_maria_hill",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 40,
|
||||
"version": "7",
|
||||
"when": 1774031825634,
|
||||
"tag": "0040_spotty_the_renegades",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue