fix : db cook [no ci]
This commit is contained in:
@@ -1,11 +1,17 @@
|
|||||||
CREATE TABLE "audit_log" (
|
CREATE TABLE "audit_log" (
|
||||||
"id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "audit_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1),
|
"id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "audit_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1),
|
||||||
"author_id" text,
|
"actor_id" text NOT NULL,
|
||||||
"author" text,
|
"actor_label" text NOT NULL,
|
||||||
"text" text NOT NULL,
|
"action" varchar(64) NOT NULL,
|
||||||
"details" jsonb DEFAULT '{}'::jsonb,
|
"target_type" varchar(32) NOT NULL,
|
||||||
"time" timestamp with time zone DEFAULT now() NOT NULL
|
"target_id" text NOT NULL,
|
||||||
|
"scope" varchar(64),
|
||||||
|
"resulting_version" integer,
|
||||||
|
"metadata" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
||||||
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||||
);
|
);
|
||||||
--> statement-breakpoint
|
--> statement-breakpoint
|
||||||
CREATE INDEX "audit_log_time_idx" ON "audit_log" USING btree ("time","id");--> statement-breakpoint
|
CREATE INDEX "audit_log_created_idx" ON "audit_log" USING btree ("created_at","id");--> statement-breakpoint
|
||||||
CREATE INDEX "audit_log_author_time_idx" ON "audit_log" USING btree ("author_id","time");
|
CREATE INDEX "audit_log_actor_created_idx" ON "audit_log" USING btree ("actor_id","created_at");--> statement-breakpoint
|
||||||
|
CREATE INDEX "audit_log_target_created_idx" ON "audit_log" USING btree ("target_type","target_id","created_at");--> statement-breakpoint
|
||||||
|
CREATE INDEX "audit_log_action_created_idx" ON "audit_log" USING btree ("action","created_at");
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
ALTER TABLE "audit_log" RENAME COLUMN "actor_id" TO "author_id";--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" RENAME COLUMN "actor_label" TO "author";--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" RENAME COLUMN "action" TO "text";--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" RENAME COLUMN "metadata" TO "details";--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" RENAME COLUMN "created_at" TO "time";--> statement-breakpoint
|
||||||
|
UPDATE "audit_log"
|
||||||
|
SET "details" = coalesce("details", '{}'::jsonb) || jsonb_strip_nulls(jsonb_build_object(
|
||||||
|
'target', jsonb_build_object('type', "target_type", 'id', "target_id"),
|
||||||
|
'scope', "scope",
|
||||||
|
'version', "resulting_version"
|
||||||
|
));--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" ALTER COLUMN "author_id" DROP NOT NULL;--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" ALTER COLUMN "author" DROP NOT NULL;--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" ALTER COLUMN "text" TYPE text;--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" ALTER COLUMN "details" DROP NOT NULL;--> statement-breakpoint
|
||||||
|
DROP INDEX "audit_log_created_idx";--> statement-breakpoint
|
||||||
|
DROP INDEX "audit_log_actor_created_idx";--> statement-breakpoint
|
||||||
|
DROP INDEX "audit_log_target_created_idx";--> statement-breakpoint
|
||||||
|
DROP INDEX "audit_log_action_created_idx";--> statement-breakpoint
|
||||||
|
CREATE INDEX "audit_log_time_idx" ON "audit_log" USING btree ("time","id");--> statement-breakpoint
|
||||||
|
CREATE INDEX "audit_log_author_time_idx" ON "audit_log" USING btree ("author_id","time");--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" DROP COLUMN "target_type";--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" DROP COLUMN "target_id";--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" DROP COLUMN "scope";--> statement-breakpoint
|
||||||
|
ALTER TABLE "audit_log" DROP COLUMN "resulting_version";
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"id": "74274cf2-88e8-40cf-84db-3333cecc34cf",
|
"id": "cdfff9d0-72b6-44bc-9af7-79b7995f9d49",
|
||||||
"prevId": "06235585-b969-474c-8f40-ba3a55869d1d",
|
"prevId": "06235585-b969-474c-8f40-ba3a55869d1d",
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"dialect": "postgresql",
|
"dialect": "postgresql",
|
||||||
@@ -538,33 +538,57 @@
|
|||||||
"cycle": false
|
"cycle": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"author_id": {
|
"actor_id": {
|
||||||
"name": "author_id",
|
"name": "actor_id",
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"author": {
|
|
||||||
"name": "author",
|
|
||||||
"type": "text",
|
|
||||||
"primaryKey": false,
|
|
||||||
"notNull": false
|
|
||||||
},
|
|
||||||
"text": {
|
|
||||||
"name": "text",
|
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true
|
"notNull": true
|
||||||
},
|
},
|
||||||
"details": {
|
"actor_label": {
|
||||||
"name": "details",
|
"name": "actor_label",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"name": "action",
|
||||||
|
"type": "varchar(64)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"target_type": {
|
||||||
|
"name": "target_type",
|
||||||
|
"type": "varchar(32)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"target_id": {
|
||||||
|
"name": "target_id",
|
||||||
|
"type": "text",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"name": "scope",
|
||||||
|
"type": "varchar(64)",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"resulting_version": {
|
||||||
|
"name": "resulting_version",
|
||||||
|
"type": "integer",
|
||||||
|
"primaryKey": false,
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"name": "metadata",
|
||||||
"type": "jsonb",
|
"type": "jsonb",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": false,
|
"notNull": true,
|
||||||
"default": "'{}'::jsonb"
|
"default": "'{}'::jsonb"
|
||||||
},
|
},
|
||||||
"time": {
|
"created_at": {
|
||||||
"name": "time",
|
"name": "created_at",
|
||||||
"type": "timestamp with time zone",
|
"type": "timestamp with time zone",
|
||||||
"primaryKey": false,
|
"primaryKey": false,
|
||||||
"notNull": true,
|
"notNull": true,
|
||||||
@@ -572,11 +596,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"indexes": {
|
"indexes": {
|
||||||
"audit_log_time_idx": {
|
"audit_log_created_idx": {
|
||||||
"name": "audit_log_time_idx",
|
"name": "audit_log_created_idx",
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"expression": "time",
|
"expression": "created_at",
|
||||||
"isExpression": false,
|
"isExpression": false,
|
||||||
"asc": true,
|
"asc": true,
|
||||||
"nulls": "last"
|
"nulls": "last"
|
||||||
@@ -593,17 +617,65 @@
|
|||||||
"method": "btree",
|
"method": "btree",
|
||||||
"with": {}
|
"with": {}
|
||||||
},
|
},
|
||||||
"audit_log_author_time_idx": {
|
"audit_log_actor_created_idx": {
|
||||||
"name": "audit_log_author_time_idx",
|
"name": "audit_log_actor_created_idx",
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"expression": "author_id",
|
"expression": "actor_id",
|
||||||
"isExpression": false,
|
"isExpression": false,
|
||||||
"asc": true,
|
"asc": true,
|
||||||
"nulls": "last"
|
"nulls": "last"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"expression": "time",
|
"expression": "created_at",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"audit_log_target_created_idx": {
|
||||||
|
"name": "audit_log_target_created_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "target_type",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "target_id",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "created_at",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isUnique": false,
|
||||||
|
"concurrently": false,
|
||||||
|
"method": "btree",
|
||||||
|
"with": {}
|
||||||
|
},
|
||||||
|
"audit_log_action_created_idx": {
|
||||||
|
"name": "audit_log_action_created_idx",
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"expression": "action",
|
||||||
|
"isExpression": false,
|
||||||
|
"asc": true,
|
||||||
|
"nulls": "last"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"expression": "created_at",
|
||||||
"isExpression": false,
|
"isExpression": false,
|
||||||
"asc": true,
|
"asc": true,
|
||||||
"nulls": "last"
|
"nulls": "last"
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -376,9 +376,16 @@
|
|||||||
{
|
{
|
||||||
"idx": 53,
|
"idx": 53,
|
||||||
"version": "7",
|
"version": "7",
|
||||||
"when": 1790503002505,
|
"when": 1790499026606,
|
||||||
"tag": "0053_woozy_callisto",
|
"tag": "0053_woozy_callisto",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 54,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1790503406247,
|
||||||
|
"tag": "0054_open_changeling",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user