+数据字典初始化SQL
This commit is contained in:
parent
1a62fb2b81
commit
422aa47954
|
@ -1,17 +1,19 @@
|
|||
-- 数据字典表
|
||||
-- 建表
|
||||
CREATE TABLE `dictionary` (
|
||||
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`parent_id` int unsigned NOT NULL COMMENT '父ID',
|
||||
`type` varchar(50) NOT NULL COMMENT '字典类型',
|
||||
`item_name` varchar(100) NOT NULL COMMENT '字典项显示名',
|
||||
`item_value` varchar(100) DEFAULT NULL COMMENT '字典项存储值',
|
||||
`item_name` varchar(100) NOT NULL COMMENT '显示名',
|
||||
`item_value` varchar(100) DEFAULT NULL COMMENT '存储值',
|
||||
`comment` varchar(100) DEFAULT NULL COMMENT '备注',
|
||||
`extdata` varchar(200) DEFAULT NULL COMMENT '扩展属性',
|
||||
`extdata` varchar(200) DEFAULT NULL COMMENT '扩展JSON',
|
||||
`sort_id` smallint NOT NULL DEFAULT '99' COMMENT '排序号',
|
||||
`system` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否系统预置',
|
||||
`system` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否系统预置',
|
||||
`editable` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否可编辑',
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否有效',
|
||||
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除标记',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_dict` (`type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- 创建索引
|
||||
create index idx_directory on dictionary(type, item_value);
|
|
@ -0,0 +1,31 @@
|
|||
-- 建表
|
||||
create table "dictionary" (
|
||||
"id" INTEGER generated as identity ( start with 10000 nocycle noorder) not null,
|
||||
"parent_id" INTEGER not null,
|
||||
"type" VARCHAR2(50) not null,
|
||||
"item_name" VARCHAR2(100) not null,
|
||||
"item_value" VARCHAR2(100),
|
||||
"comment" VARCHAR2(200),
|
||||
"extdata" VARCHAR2(200),
|
||||
"sort_id" SMALLINT default 99 not null,
|
||||
"system" SMALLINT default 0 not null,
|
||||
"editable" SMALLINT default 1 not null,
|
||||
"deleted" SMALLINT default 0 not null,
|
||||
"create_time" TIMESTAMP default 'CURRENT_TIMESTAMP' not null,
|
||||
constraint "PK_dictionary" primary key ("id")
|
||||
);
|
||||
-- 添加备注
|
||||
comment on column "dictionary"."id" is 'ID';
|
||||
comment on column "dictionary"."parent_id" is '父ID';
|
||||
comment on column "dictionary"."type" is '字典类型';
|
||||
comment on column "dictionary"."item_name" is '显示名';
|
||||
comment on column "dictionary"."item_value" is '存储值';
|
||||
comment on column "dictionary"."comment" is '备注';
|
||||
comment on column "dictionary"."extdata" is '扩展JSON';
|
||||
comment on column "dictionary"."sort_id" is '排序号';
|
||||
comment on column "dictionary"."system" is '是否系统预置';
|
||||
comment on column "dictionary"."editable" is '是否可编辑';
|
||||
comment on column "dictionary"."deleted" is '删除标记';
|
||||
comment on column "dictionary"."create_time" is '创建时间';
|
||||
-- 创建索引
|
||||
create index "idx_directory" on "dictionary" ("type", "item_value");
|
|
@ -0,0 +1,31 @@
|
|||
-- 建表
|
||||
create table dictionary (
|
||||
id SERIAL not null,
|
||||
parent_id INT4 not null,
|
||||
type VARCHAR(50) not null,
|
||||
item_name VARCHAR(100) not null,
|
||||
item_value VARCHAR(100) null,
|
||||
comment VARCHAR(200) null,
|
||||
extdata VARCHAR(200) null,
|
||||
sort_id INT2 not null default 99,
|
||||
system INT2 not null default 0,
|
||||
editable INT2 not null default 1,
|
||||
deleted INT2 not null default 0,
|
||||
create_time DATE not null default CURRENT_TIMESTAMP,
|
||||
constraint PK_dictionary primary key (id)
|
||||
);
|
||||
-- 添加备注
|
||||
comment on column dictionary.id is 'ID';
|
||||
comment on column dictionary.parent_id is '父ID';
|
||||
comment on column dictionary.type is '字典类型';
|
||||
comment on column dictionary.item_name is '显示名';
|
||||
comment on column dictionary.item_value is '存储值';
|
||||
comment on column dictionary.comment is '备注';
|
||||
comment on column dictionary.extdata is '扩展JSON';
|
||||
comment on column dictionary.sort_id is '排序号';
|
||||
comment on column dictionary.system is '是否系统预置';
|
||||
comment on column dictionary.editable is '是否可编辑';
|
||||
comment on column dictionary.deleted is '删除标记';
|
||||
comment on column dictionary.create_time is '创建时间';
|
||||
-- 创建索引
|
||||
create index idx_directory on dictionary(type, item_value);
|
|
@ -0,0 +1,31 @@
|
|||
-- 建表
|
||||
create table dictionary (
|
||||
id int identity,
|
||||
parent_id int not null,
|
||||
type varchar(50) not null,
|
||||
item_name varchar(100) not null,
|
||||
item_value varchar(100) null,
|
||||
comment varchar(200) null,
|
||||
extdata varchar(200) null,
|
||||
sort_id smallint not null default 99,
|
||||
system smallint not null default 0,
|
||||
editable smallint not null default 1,
|
||||
deleted smallint not null default 0,
|
||||
create_time datetime not null default CURRENT_TIMESTAMP,
|
||||
constraint PK_dictionary primary key (id)
|
||||
);
|
||||
-- 添加备注
|
||||
execute sp_addextendedproperty 'MS_Description', 'ID', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'id';
|
||||
execute sp_addextendedproperty 'MS_Description', '父ID', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'parent_id';
|
||||
execute sp_addextendedproperty 'MS_Description', '字典类型', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'type';
|
||||
execute sp_addextendedproperty 'MS_Description', '显示名', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'item_name';
|
||||
execute sp_addextendedproperty 'MS_Description', '存储值', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'item_value';
|
||||
execute sp_addextendedproperty 'MS_Description', '备注', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'comment';
|
||||
execute sp_addextendedproperty 'MS_Description', '扩展JSON', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'extdata';
|
||||
execute sp_addextendedproperty 'MS_Description', '排序号', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'sort_id';
|
||||
execute sp_addextendedproperty 'MS_Description', '是否系统预置', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'system';
|
||||
execute sp_addextendedproperty 'MS_Description', '是否可编辑', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'editable';
|
||||
execute sp_addextendedproperty 'MS_Description', '删除标记', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'deleted';
|
||||
execute sp_addextendedproperty 'MS_Description', '创建时间', 'user', '${SCHEMA}', 'table', 'dictionary', 'column', 'create_time';
|
||||
-- 创建索引
|
||||
create nonclustered index idx_directory on dictionary(type, item_value);
|
Loading…
Reference in New Issue