Files
tryton/trytond/backend/postgresql/init.sql
T

211 lines
4.9 KiB
SQL
Raw Normal View History

2007-12-10 01:04:13 +01:00
-------------------------------------------------------------------------
-- Modules Description
-------------------------------------------------------------------------
CREATE TABLE ir_model (
id serial,
2008-07-29 11:01:20 +02:00
model varchar NOT NULL,
name varchar,
2007-12-10 01:04:13 +01:00
info text,
2008-07-30 18:26:51 +02:00
module varchar,
2007-12-10 01:04:13 +01:00
primary key(id)
);
2008-02-17 14:52:56 +01:00
CREATE TABLE ir_model_field (
2007-12-10 01:04:13 +01:00
id serial,
2008-02-17 14:52:56 +01:00
model int references ir_model on delete cascade,
2008-07-29 11:01:20 +02:00
name varchar NOT NULL,
relation varchar,
field_description varchar,
ttype varchar,
2008-02-11 14:01:47 +01:00
help text,
module varchar,
2007-12-10 01:04:13 +01:00
primary key(id)
);
-------------------------------------------------------------------------
-- Actions
-------------------------------------------------------------------------
CREATE TABLE ir_ui_view (
id serial NOT NULL,
2008-07-29 11:01:20 +02:00
model varchar NOT NULL,
"type" varchar,
2007-12-10 01:04:13 +01:00
arch text NOT NULL,
field_childs varchar,
2008-07-30 12:26:32 +02:00
priority integer NOT NULL default 0,
2007-12-10 01:04:13 +01:00
primary key(id)
);
CREATE TABLE ir_ui_menu (
id serial NOT NULL,
parent_id int references ir_ui_menu on delete set null,
2008-07-29 11:01:20 +02:00
name varchar NOT NULL,
icon varchar,
2007-12-10 01:04:13 +01:00
primary key (id)
);
2008-02-11 14:01:47 +01:00
--------------------------------
-- Translation
--------------------------------
CREATE TABLE ir_translation (
id serial NOT NULL,
lang varchar,
2008-02-11 14:01:47 +01:00
src text,
name varchar NOT NULL,
2008-07-30 12:26:32 +02:00
res_id integer not null default 0,
2008-02-11 14:01:47 +01:00
value text,
"type" varchar,
module varchar,
2008-07-29 11:01:20 +02:00
fuzzy boolean,
2008-02-11 14:01:47 +01:00
primary key(id)
);
2007-12-10 01:04:13 +01:00
CREATE TABLE ir_lang (
id serial NOT NULL,
name varchar NOT NULL,
code varchar NOT NULL,
2008-07-29 11:01:20 +02:00
translatable boolean,
active boolean,
direction varchar NOT NULL,
primary key(id)
);
2007-12-10 01:04:13 +01:00
---------------------------------
2007-12-16 00:54:08 +01:00
-- Res user
2007-12-10 01:04:13 +01:00
---------------------------------
-- level:
-- 0 RESTRICT TO USER
-- 1 RESTRICT TO GROUP
-- 2 PUBLIC
2007-12-16 00:54:08 +01:00
CREATE TABLE res_user (
2007-12-10 01:04:13 +01:00
id serial NOT NULL,
2008-07-29 11:01:20 +02:00
name varchar not null,
active boolean,
login varchar NOT NULL UNIQUE,
password varchar(40),
2007-12-10 01:04:13 +01:00
-- action_id int references ir_act_window on delete set null,
2008-02-17 16:18:27 +01:00
action int,
2007-12-10 01:04:13 +01:00
primary key(id)
);
2007-12-16 00:54:08 +01:00
alter table res_user add constraint res_user_login_uniq unique (login);
2007-12-10 01:04:13 +01:00
2008-02-17 16:18:27 +01:00
insert into res_user (id,login,password,name,action,active) values (0,'root',NULL,'Root',NULL,False);
2007-12-10 01:04:13 +01:00
2007-12-16 00:54:08 +01:00
CREATE TABLE res_group (
2007-12-10 01:04:13 +01:00
id serial NOT NULL,
name varchar NOT NULL,
2007-12-10 01:04:13 +01:00
primary key(id)
);
2009-03-17 18:55:16 +01:00
CREATE TABLE "res_user-res_group" (
2007-12-16 00:54:08 +01:00
uid integer NOT NULL references res_user on delete cascade,
gid integer NOT NULL references res_group on delete cascade
2007-12-10 01:04:13 +01:00
);
---------------------------------
-- Workflows
---------------------------------
create table wkf
(
id serial,
2008-07-29 11:01:20 +02:00
name varchar,
osv varchar,
on_create bool,
2007-12-10 01:04:13 +01:00
primary key(id)
);
create table wkf_activity
(
id serial,
2008-02-17 16:57:34 +01:00
workflow int references wkf on delete cascade,
subflow int references wkf on delete set null,
2009-07-05 17:17:12 +02:00
split_mode varchar,
join_mode varchar,
2008-07-29 11:01:20 +02:00
kind varchar not null,
name varchar,
signal_send varchar,
flow_start boolean,
flow_stop boolean,
2008-10-24 21:48:42 +02:00
action text,
2007-12-10 01:04:13 +01:00
primary key(id)
);
create table wkf_transition
(
id serial,
act_from int references wkf_activity on delete cascade,
act_to int references wkf_activity on delete cascade,
2008-07-29 11:01:20 +02:00
condition varchar,
trigger_expr_id varchar,
signal varchar,
"group" int references res_group on delete set null,
2007-12-10 01:04:13 +01:00
primary key(id)
);
create table wkf_instance
(
id serial,
2008-02-17 16:57:34 +01:00
workflow int references wkf on delete restrict,
2008-07-29 11:01:20 +02:00
uid int,
2007-12-10 01:04:13 +01:00
res_id int not null,
2008-07-29 11:01:20 +02:00
res_type varchar not null,
state varchar not null,
2007-12-10 01:04:13 +01:00
primary key(id)
);
create table wkf_workitem
(
id serial,
2008-02-17 16:57:34 +01:00
activity int not null references wkf_activity on delete cascade,
instance int not null references wkf_instance on delete cascade,
subflow int references wkf_instance on delete cascade,
2008-07-29 11:01:20 +02:00
state varchar,
2007-12-10 01:04:13 +01:00
primary key(id)
);
create table wkf_witm_trans
(
trans_id int not null references wkf_transition on delete cascade,
inst_id int not null references wkf_instance on delete cascade
);
---------------------------------
-- Modules
---------------------------------
CREATE TABLE ir_module_module (
id serial NOT NULL,
2009-07-08 14:10:07 +02:00
create_uid integer NOT NULL references res_user on delete set null,
create_date timestamp without time zone NOT NULL,
2007-12-10 01:04:13 +01:00
write_date timestamp without time zone,
2007-12-16 00:54:08 +01:00
write_uid integer references res_user on delete set null,
2008-07-29 11:01:20 +02:00
website varchar,
name varchar NOT NULL,
author varchar,
url varchar,
state varchar,
2008-07-29 11:01:20 +02:00
shortdesc varchar,
2007-12-10 01:04:13 +01:00
description text,
primary key(id)
);
ALTER TABLE ir_module_module add constraint name_uniq unique (name);
CREATE TABLE ir_module_module_dependency (
id serial NOT NULL,
2009-07-08 14:10:07 +02:00
create_uid integer NOT NULL references res_user on delete set null,
create_date timestamp without time zone NOT NULL,
2007-12-10 01:04:13 +01:00
write_date timestamp without time zone,
2007-12-16 00:54:08 +01:00
write_uid integer references res_user on delete set null,
2008-07-29 11:01:20 +02:00
name varchar,
module integer REFERENCES ir_module_module ON DELETE cascade,
2007-12-10 01:04:13 +01:00
primary key(id)
);