CREATE TABLE "core_formatted_messages" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"raingull_id" char(32) NOT NULL,
"status" varchar(20) NOT NULL,
"formatted_payload" text NOT NULL CHECK ((JSON_VALID("formatted_payload") OR "formatted_payload" IS NULL)),
"subject" varchar(255) NULL,
"sender" varchar(255) NULL,
"recipient" varchar(255) NULL,
"error_message" text NULL,
"created_at" datetime NOT NULL,
"updated_at" datetime NOT NULL,
"sent_at" datetime NULL,
"message_id" bigint NOT NULL REFERENCES "core_messages" ("id") DEFERRABLE INITIALLY DEFERRED,
"service_id" bigint NOT NULL REFERENCES "core_services" ("id") DEFERRABLE INITIALLY DEFERRED
)