国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

javer的表結構設計

mgckid / 1712人閱讀

摘要:序設計了幾張表,這里簡單介紹下主要用來存儲對象的每次變更操作以及變更的屬性值。存儲了每次變更的存儲了每次變更的時間變更人支持自動從獲取也可以自定義,比如用來存儲額外的信息,比如存儲了用戶,順帶存一下用戶名等。

javers設計了幾張表,這里簡單介紹下

jv_snapshot

主要用來存儲對象的每次變更操作以及變更的屬性值。

-- ----------------------------
--  Table structure for jv_snapshot
-- ----------------------------
DROP TABLE IF EXISTS "public"."jv_snapshot";
CREATE TABLE "public"."jv_snapshot" (
    "snapshot_pk" int8 NOT NULL,
    "type" varchar(200) COLLATE "default",
    "version" int8,
    "state" text COLLATE "default",
    "changed_properties" text COLLATE "default",
    "managed_type" varchar(200) COLLATE "default",
    "global_id_fk" int8,
    "commit_fk" int8
)
WITH (OIDS=FALSE);
ALTER TABLE "public"."jv_snapshot" OWNER TO "postgres";

-- ----------------------------
--  Primary key structure for table jv_snapshot
-- ----------------------------
ALTER TABLE "public"."jv_snapshot" ADD PRIMARY KEY ("snapshot_pk") NOT DEFERRABLE INITIALLY IMMEDIATE;

-- ----------------------------
--  Indexes structure for table jv_snapshot
-- ----------------------------
CREATE INDEX  "jv_snapshot_commit_fk_idx" ON "public"."jv_snapshot" USING btree(commit_fk "pg_catalog"."int8_ops" ASC NULLS LAST);
CREATE INDEX  "jv_snapshot_global_id_fk_idx" ON "public"."jv_snapshot" USING btree(global_id_fk "pg_catalog"."int8_ops" ASC NULLS LAST);

-- ----------------------------
--  Foreign keys structure for table jv_snapshot
-- ----------------------------
ALTER TABLE "public"."jv_snapshot" ADD CONSTRAINT "jv_snapshot_commit_fk" FOREIGN KEY ("commit_fk") REFERENCES "public"."jv_commit" ("commit_pk") ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE;
ALTER TABLE "public"."jv_snapshot" ADD CONSTRAINT "jv_snapshot_global_id_fk" FOREIGN KEY ("global_id_fk") REFERENCES "public"."jv_global_id" ("global_id_pk") ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE;
jv_global_id

存儲了每次變更的id

-- ----------------------------
--  Table structure for jv_global_id
-- ----------------------------
DROP TABLE IF EXISTS "public"."jv_global_id";
CREATE TABLE "public"."jv_global_id" (
    "global_id_pk" int8 NOT NULL,
    "local_id" varchar(200) COLLATE "default",
    "fragment" varchar(200) COLLATE "default",
    "type_name" varchar(200) COLLATE "default",
    "owner_id_fk" int8
)
WITH (OIDS=FALSE);
ALTER TABLE "public"."jv_global_id" OWNER TO "postgres";

-- ----------------------------
--  Primary key structure for table jv_global_id
-- ----------------------------
ALTER TABLE "public"."jv_global_id" ADD PRIMARY KEY ("global_id_pk") NOT DEFERRABLE INITIALLY IMMEDIATE;

-- ----------------------------
--  Indexes structure for table jv_global_id
-- ----------------------------
CREATE INDEX  "jv_global_id_local_id_idx" ON "public"."jv_global_id" USING btree(local_id COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST);

-- ----------------------------
--  Foreign keys structure for table jv_global_id
-- ----------------------------
ALTER TABLE "public"."jv_global_id" ADD CONSTRAINT "jv_global_id_owner_id_fk" FOREIGN KEY ("owner_id_fk") REFERENCES "public"."jv_global_id" ("global_id_pk") ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE;
jv_commit

存儲了每次變更的時間、變更人

-- ----------------------------
--  Table structure for jv_commit
-- ----------------------------
DROP TABLE IF EXISTS "public"."jv_commit";
CREATE TABLE "public"."jv_commit" (
    "commit_pk" int8 NOT NULL,
    "author" varchar(200) COLLATE "default",
    "commit_date" timestamp(6) NULL,
    "commit_id" numeric(22,2)
)
WITH (OIDS=FALSE);
ALTER TABLE "public"."jv_commit" OWNER TO "postgres";

-- ----------------------------
--  Primary key structure for table jv_commit
-- ----------------------------
ALTER TABLE "public"."jv_commit" ADD PRIMARY KEY ("commit_pk") NOT DEFERRABLE INITIALLY IMMEDIATE;

-- ----------------------------
--  Indexes structure for table jv_commit
-- ----------------------------
CREATE INDEX  "jv_commit_commit_id_idx" ON "public"."jv_commit" USING btree(commit_id "pg_catalog"."numeric_ops" ASC NULLS LAST);

支持自動從SpringSecurity獲取auditor

public class SpringSecurityAuthorProvider implements AuthorProvider {
    public SpringSecurityAuthorProvider() {
    }

    public String provide() {
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        return auth == null?"unauthenticated":auth.getName();
    }
}

也可以自定義,比如

@Bean
    public AuthorProvider authorProvider() {
        return new MockAuthorProvider();
    }
jv_commit_property

用來存儲額外的信息,比如存儲了用戶id,順帶存一下用戶名等。

-- ----------------------------
--  Table structure for jv_commit_property
-- ----------------------------
DROP TABLE IF EXISTS "public"."jv_commit_property";
CREATE TABLE "public"."jv_commit_property" (
    "property_name" varchar(200) NOT NULL COLLATE "default",
    "property_value" varchar(600) COLLATE "default",
    "commit_fk" int8 NOT NULL
)
WITH (OIDS=FALSE);
ALTER TABLE "public"."jv_commit_property" OWNER TO "postgres";

-- ----------------------------
--  Primary key structure for table jv_commit_property
-- ----------------------------
ALTER TABLE "public"."jv_commit_property" ADD PRIMARY KEY ("commit_fk", "property_name") NOT DEFERRABLE INITIALLY IMMEDIATE;

-- ----------------------------
--  Indexes structure for table jv_commit_property
-- ----------------------------
CREATE INDEX  "jv_commit_property_commit_fk_idx" ON "public"."jv_commit_property" USING btree(commit_fk "pg_catalog"."int8_ops" ASC NULLS LAST);
CREATE INDEX  "jv_commit_property_property_name_property_value_idx" ON "public"."jv_commit_property" USING btree(property_name COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST, property_value COLLATE "default" "pg_catalog"."text_ops" ASC NULLS LAST);

-- ----------------------------
--  Foreign keys structure for table jv_commit_property
-- ----------------------------
ALTER TABLE "public"."jv_commit_property" ADD CONSTRAINT "jv_commit_property_commit_fk" FOREIGN KEY ("commit_fk") REFERENCES "public"."jv_commit" ("commit_pk") ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE;

可以這樣自定義

@Bean
    public CommitPropertiesProvider commitPropertiesProvider() {
        return new CommitPropertiesProvider() {
            @Override
            public Map provide() {
                return ImmutableMap.of("key", "ok");
            }
        };
    }
doc

javers

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/67506.html

相關文章

  • mongodb如何設計評論表的表結構

    摘要:談談如何設計評論表的表結構前言打算使用打造一個博客的后臺,遇到了如何設計評論表的困惑,因為如果采用開放評論的模式,就會導致評論的層層嵌套,使得管理和展示都變得非常復雜。 談談mongodb如何設計評論表的表結構 前言: 打算使用node+koa+mongodb打造一個博客的后臺,遇到了如何設計評論表的困惑,因為如果采用開放評論的模式,就會導致評論的層層嵌套,使得管理和展示都變得非常復雜...

    cjie 評論0 收藏0
  • 搞定PHP面試 - MySQL基礎知識點整理 - 存儲引擎

    摘要:支持崩潰后的安全恢復。的使用場景更新密集的表存儲引擎特別適合處理多重并發的更新請求。外鍵約束支持外鍵的存儲引擎只有。引擎是及之前版本的默認存儲引擎。文件存儲表的索引。引擎存儲引擎是引擎的變種。 MySQL基礎知識點整理 - 存儲引擎 0. 查看 MySQL 支持的存儲引擎 可以在 mysql 客戶端中,使用 show engines; 命令可以查看MySQL支持的引擎: mysql> ...

    whatsns 評論0 收藏0

發表評論

0條評論

mgckid

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<