zoukankan      html  css  js  c++  java
  • Postgres数据库补丁脚本示例

    SET client_encoding = 'UTF8';
    -- 新建序列和表
    DROP TABLE IF EXISTS cms_user_unit;
    DROP SEQUENCE IF EXISTS cms_user_unit_seq CASCADE ;
    CREATE SEQUENCE cms_user_unit_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


    ALTER TABLE public.cms_user_unit_seq OWNER TO postgres;

    SELECT pg_catalog.setval('cms_user_unit_seq', 1, false);

    CREATE TABLE cms_user_unit (
    user_unit_id integer DEFAULT nextval('cms_user_unit_seq'::regclass) NOT NULL,
    user_id integer NOT NULL,
    unit_id integer NOT NULL,
    unit_type smallint NOT NULL,
    cre_id integer,
    cre_time timestamp,
    upd_id integer,
    upd_time timestamp,
    is_delete smallint
    );

    ALTER TABLE public.cms_user_unit OWNER TO postgres;
    ALTER TABLE public.cms_user_unit ADD PRIMARY KEY ("user_unit_id");


    COMMENT ON TABLE public.cms_user_unit IS '我是关联表';
    COMMENT ON COLUMN public.cms_user_unit.unit_id IS '我是列的中文名';

    --增加初始化数据
    insert into cms_user_unit(user_unit_id,user_id, unit_id,unit_type,cre_id,cre_time,upd_id,upd_time,is_delete)
    select nextval('cms_user_unit_seq'),1, control_unit_id,1,4,null,4,null,0 from s_control_unit tt
    where parent_id = 0
    and not exists (select unit_id from cms_user_unit tt1 where tt.control_unit_id = tt1.unit_id and tt1.unit_type=1);

  • 相关阅读:
    Qt 信号与槽
    Qt 项目中main主函数及其作用
    Windows下的GUI 库
    ABP进阶教程0
    ABP入门教程15
    ABP入门教程13
    ABP入门教程12
    ABP入门教程11
    ABP入门教程10
    ABP入门教程9
  • 原文地址:https://www.cnblogs.com/winkey4986/p/6274873.html
Copyright © 2011-2022 走看看