feat: integrate analytics and fragment receipt improvements
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
CREATE TABLE "DrainageDetectionRule" (
|
||||
"id" TEXT NOT NULL,
|
||||
"code" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"category" TEXT NOT NULL,
|
||||
"pattern" TEXT NOT NULL,
|
||||
"flags" TEXT NOT NULL DEFAULT 'giu',
|
||||
"priority" INTEGER NOT NULL DEFAULT 100,
|
||||
"status" TEXT NOT NULL DEFAULT 'active',
|
||||
"description" TEXT,
|
||||
"version" INTEGER NOT NULL DEFAULT 1,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
CONSTRAINT "DrainageDetectionRule_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "DrainageDetectionRule_code_key" ON "DrainageDetectionRule"("code");
|
||||
CREATE INDEX "DrainageDetectionRule_status_priority_idx" ON "DrainageDetectionRule"("status", "priority");
|
||||
|
||||
ALTER TABLE "SmsMessageRecord"
|
||||
ADD COLUMN "hasDrainageContent" BOOLEAN,
|
||||
ADD COLUMN "drainageDetection" JSONB,
|
||||
ADD COLUMN "drainageDetectionVersion" TEXT,
|
||||
ADD COLUMN "drainageEvaluatedAt" TIMESTAMP(3);
|
||||
|
||||
CREATE INDEX "SmsMessageRecord_hasDrainageContent_queuedAt_idx"
|
||||
ON "SmsMessageRecord"("hasDrainageContent", "queuedAt");
|
||||
|
||||
INSERT INTO "DrainageDetectionRule"
|
||||
("id", "code", "name", "category", "pattern", "flags", "priority", "status", "description", "version", "updatedAt")
|
||||
VALUES
|
||||
('drainage-rule-url', 'URL', 'URL及裸域名', 'url', $regex$(?:https?:\/\/)?(?:www\.)?(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,24}|(?:\d{1,3}\.){3}\d{1,3})(?::\d{1,5})?(?:\/[^\s,,;;!!??<>《》]*)?$regex$, 'giu', 10, 'active', '识别协议链接、裸域名、短链接及IP地址链接;邮箱区间由检测器排除', 1, CURRENT_TIMESTAMP),
|
||||
('drainage-rule-mobile', 'MOBILE', '手机号码', 'mobile', $regex$(?:^|[^0-9])((?:\+?86)?1[3-9][0-9]{9})(?:$|[^0-9])$regex$, 'giu', 20, 'active', '规范化后识别+86、空格、短横线及中文标点拆分手机号', 1, CURRENT_TIMESTAMP),
|
||||
('drainage-rule-landline', 'LANDLINE', '固定电话号码', 'landline', $regex$(?:^|[^0-9])((?:\+?86)?(?:\(0[0-9]{2,3}\)|0[0-9]{2,3})-?[0-9]{7,8}(?:(?:转|分机|ext)[0-9]{1,6})?)(?:$|[^0-9])$regex$, 'giu', 30, 'active', '识别区号括号、分隔符和分机号', 1, CURRENT_TIMESTAMP);
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
-- PostgreSQL standard-conforming strings preserve backslashes literally. The initial
|
||||
-- seed used JavaScript-style escaping, so already-migrated databases need their three
|
||||
-- built-in patterns normalized to the single backslashes expected by RegExp.
|
||||
UPDATE "DrainageDetectionRule"
|
||||
SET
|
||||
"pattern" = $regex$(?:https?:\/\/)?(?:www\.)?(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,24}|(?:\d{1,3}\.){3}\d{1,3})(?::\d{1,5})?(?:\/[^\s,,;;!!??<>《》]*)?$regex$,
|
||||
"version" = "version" + 1,
|
||||
"updatedAt" = CURRENT_TIMESTAMP
|
||||
WHERE "code" = 'URL';
|
||||
|
||||
UPDATE "DrainageDetectionRule"
|
||||
SET
|
||||
"pattern" = $regex$(?:^|[^0-9])((?:\+?86)?1[3-9][0-9]{9})(?:$|[^0-9])$regex$,
|
||||
"version" = "version" + 1,
|
||||
"updatedAt" = CURRENT_TIMESTAMP
|
||||
WHERE "code" = 'MOBILE';
|
||||
|
||||
UPDATE "DrainageDetectionRule"
|
||||
SET
|
||||
"pattern" = $regex$(?:^|[^0-9])((?:\+?86)?(?:\(0[0-9]{2,3}\)|0[0-9]{2,3})-?[0-9]{7,8}(?:(?:转|分机|ext)[0-9]{1,6})?)(?:$|[^0-9])$regex$,
|
||||
"version" = "version" + 1,
|
||||
"updatedAt" = CURRENT_TIMESTAMP
|
||||
WHERE "code" = 'LANDLINE';
|
||||
@@ -0,0 +1,12 @@
|
||||
ALTER TABLE "SmsMessageRecord"
|
||||
ADD COLUMN "cmppRegisteredDelivery" BOOLEAN,
|
||||
ADD COLUMN "timeoutReceiptQueuedAt" TIMESTAMP(3);
|
||||
|
||||
ALTER TABLE "CmppInboundLongMessageSegment"
|
||||
ADD COLUMN "registeredDelivery" BOOLEAN NOT NULL DEFAULT true;
|
||||
|
||||
-- Historical CMPP submissions were accepted before Registered_Delivery was
|
||||
-- persisted. Preserve their existing receipt-enabled behavior.
|
||||
UPDATE "SmsMessageRecord"
|
||||
SET "cmppRegisteredDelivery" = true
|
||||
WHERE "cmppSubmitSequenceId" IS NOT NULL;
|
||||
Reference in New Issue
Block a user