mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
merge db table doc_callbacks into task_result
This commit is contained in:
@ -28,24 +28,6 @@ DROP TABLE IF EXISTS `doc_callbacks`;
|
||||
DROP TABLE IF EXISTS `doc_changes`;
|
||||
DROP TABLE IF EXISTS `task_result`;
|
||||
|
||||
--
|
||||
-- Definition of table `doc_callbacks`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `doc_callbacks` (
|
||||
`id` varchar(255) NOT NULL,
|
||||
`callback` text NOT NULL,
|
||||
`baseurl` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `doc_callbacks`
|
||||
--
|
||||
|
||||
/*!40000 ALTER TABLE `doc_callbacks` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `doc_callbacks` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Definition of table `doc_changes`
|
||||
--
|
||||
@ -79,6 +61,8 @@ CREATE TABLE IF NOT EXISTS `task_result` (
|
||||
`last_open_date` datetime NOT NULL,
|
||||
`user_index` int(10) unsigned NOT NULL DEFAULT 1,
|
||||
`change_id` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`callback` text NOT NULL,
|
||||
`baseurl` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
@ -4,17 +4,6 @@
|
||||
|
||||
-- CREATE DATABASE onlyoffice ENCODING = 'UTF8' CONNECTION LIMIT = -1;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for doc_callbacks
|
||||
-- ----------------------------
|
||||
CREATE TABLE IF NOT EXISTS "public"."doc_callbacks" (
|
||||
"id" varchar(255) COLLATE "default" NOT NULL,
|
||||
"callback" text COLLATE "default" NOT NULL,
|
||||
"baseurl" text COLLATE "default" NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
WITH (OIDS=FALSE);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for doc_changes
|
||||
-- ----------------------------
|
||||
@ -40,11 +29,13 @@ CREATE TABLE IF NOT EXISTS "public"."task_result" (
|
||||
"last_open_date" timestamp without time zone NOT NULL,
|
||||
"user_index" int4 NOT NULL DEFAULT 1,
|
||||
"change_id" int4 NOT NULL DEFAULT 0,
|
||||
"callback" text COLLATE "default" NOT NULL,
|
||||
"baseurl" text COLLATE "default" NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
)
|
||||
WITH (OIDS=FALSE);
|
||||
|
||||
CREATE OR REPLACE FUNCTION merge_db(_id varchar(255), _status int2, _status_info int4, _last_open_date timestamp without time zone, _user_index int4, _change_id int4, OUT isupdate char(5), OUT userindex int4) AS
|
||||
CREATE OR REPLACE FUNCTION merge_db(_id varchar(255), _status int2, _status_info int4, _last_open_date timestamp without time zone, _user_index int4, _change_id int4, _callback text, _baseurl text, OUT isupdate char(5), OUT userindex int4) AS
|
||||
$$
|
||||
DECLARE
|
||||
t_var "public"."task_result"."user_index"%TYPE;
|
||||
@ -61,7 +52,7 @@ BEGIN
|
||||
-- if someone else inserts the same key concurrently,
|
||||
-- we could get a unique-key failure
|
||||
BEGIN
|
||||
INSERT INTO "public"."task_result"(id, status, status_info, last_open_date, user_index, change_id) VALUES(_id, _status, _status_info, _last_open_date, _user_index, _change_id) RETURNING user_index into userindex;
|
||||
INSERT INTO "public"."task_result"(id, status, status_info, last_open_date, user_index, change_id, callback, baseurl) VALUES(_id, _status, _status_info, _last_open_date, _user_index, _change_id, _callback, _baseurl) RETURNING user_index into userindex;
|
||||
isupdate := 'false';
|
||||
RETURN;
|
||||
EXCEPTION WHEN unique_violation THEN
|
||||
|
||||
Reference in New Issue
Block a user