1 -------------------------------------------------------------------------
3 -------------------------------------------------------------------------
5 -------------------------------------------------------------------------
7 -------------------------------------------------------------------------
12 name varchar(128) not null,
13 key varchar(128) not null,
14 key2 varchar(256) not null,
15 model varchar(128) not null,
17 meta text default NULL,
18 res_id integer default null,
22 -------------------------------------------------------------------------
23 -- Modules Description
24 -------------------------------------------------------------------------
26 CREATE TABLE ir_model (
28 model varchar(64) DEFAULT ''::varchar NOT NULL,
35 CREATE TABLE ir_model_fields (
37 model varchar(64) DEFAULT ''::varchar NOT NULL,
38 model_id int references ir_model on delete cascade,
39 name varchar(64) DEFAULT ''::varchar NOT NULL,
41 select_level varchar(4),
42 field_description varchar(256),
44 state varchar(64) default 'base',
46 relate boolean default False,
47 relation_field varchar(128),
48 translate boolean default False,
52 ALTER TABLE ir_model_fields ADD column serialization_field_id int references ir_model_fields on delete cascade;
55 -------------------------------------------------------------------------
57 -------------------------------------------------------------------------
59 CREATE TABLE ir_actions (
61 name varchar(64) DEFAULT ''::varchar NOT NULL,
62 "type" varchar(32) NOT NULL,
63 usage varchar(32) DEFAULT null,
67 CREATE TABLE ir_act_window (
69 res_model varchar(64),
70 view_type varchar(16),
71 "domain" varchar(250),
74 INHERITS (ir_actions);
76 CREATE TABLE ir_act_report_xml (
77 model varchar(64) NOT NULL,
78 report_name varchar(64) NOT NULL,
79 report_xsl varchar(256),
80 report_xml varchar(256),
81 auto boolean default true,
84 INHERITS (ir_actions);
86 create table ir_act_report_custom (
88 -- report_id int references ir_report_custom
91 INHERITS (ir_actions);
93 CREATE TABLE ir_act_wizard (
94 wiz_name varchar(64) NOT NULL,
97 INHERITS (ir_actions);
99 CREATE TABLE ir_act_url (
101 target varchar(64) NOT NULL,
104 INHERITS (ir_actions);
106 CREATE TABLE ir_act_server (
109 INHERITS (ir_actions);
111 CREATE TABLE ir_act_client (
114 INHERITS (ir_actions);
117 CREATE TABLE ir_ui_view (
119 name varchar(64) DEFAULT ''::varchar NOT NULL,
120 model varchar(64) DEFAULT ''::varchar NOT NULL,
121 "type" varchar(64) DEFAULT 'form'::varchar NOT NULL,
123 field_parent varchar(64),
124 priority integer DEFAULT 5 NOT NULL,
128 CREATE TABLE ir_ui_menu (
130 parent_id int references ir_ui_menu on delete set null,
131 name varchar(64) DEFAULT ''::varchar NOT NULL,
132 icon varchar(64) DEFAULT ''::varchar,
136 select setval('ir_ui_menu_id_seq', 2);
138 ---------------------------------
140 ---------------------------------
143 -- 0 RESTRICT TO USER
144 -- 1 RESTRICT TO GROUP
147 CREATE TABLE res_users (
149 active boolean default True,
150 login varchar(64) NOT NULL UNIQUE,
151 password varchar(64) default null,
152 tz varchar(64) default null,
153 lang varchar(64) default '',
154 -- No FK references below, will be added later by ORM
155 -- (when the destination rows exist)
160 alter table res_users add constraint res_users_login_uniq unique (login);
162 CREATE TABLE res_groups (
164 name varchar(64) NOT NULL,
168 CREATE TABLE res_groups_users_rel (
169 uid integer NOT NULL references res_users on delete cascade,
170 gid integer NOT NULL references res_groups on delete cascade,
174 create index res_groups_users_rel_uid_idx on res_groups_users_rel (uid);
175 create index res_groups_users_rel_gid_idx on res_groups_users_rel (gid);
178 ---------------------------------
180 ---------------------------------
187 on_create bool default False,
191 create table wkf_activity
194 wkf_id int references wkf on delete cascade,
195 subflow_id int references wkf on delete set null,
196 split_mode varchar(3) default 'XOR',
197 join_mode varchar(3) default 'XOR',
198 kind varchar(16) not null default 'dummy',
200 signal_send varchar(32) default null,
201 flow_start boolean default False,
202 flow_stop boolean default False,
203 action text default null,
207 create table wkf_transition
210 act_from int references wkf_activity on delete cascade,
211 act_to int references wkf_activity on delete cascade,
212 condition varchar(128) default NULL,
214 trigger_type varchar(128) default NULL,
215 trigger_expr_id varchar(128) default NULL,
217 signal varchar(64) default null,
218 group_id int references res_groups on delete set null,
223 create table wkf_instance
226 wkf_id int references wkf on delete restrict,
227 uid int default null,
229 res_type varchar(64) not null,
230 state varchar(32) not null default 'active',
234 create table wkf_workitem
237 act_id int not null references wkf_activity on delete cascade,
238 inst_id int not null references wkf_instance on delete cascade,
239 subflow_id int references wkf_instance on delete cascade,
240 state varchar(64) default 'blocked',
244 create table wkf_witm_trans
246 trans_id int not null references wkf_transition on delete cascade,
247 inst_id int not null references wkf_instance on delete cascade
250 create index wkf_witm_trans_inst_idx on wkf_witm_trans (inst_id);
252 create table wkf_logs
255 res_type varchar(128) not null,
257 uid int references res_users on delete set null,
258 act_id int references wkf_activity on delete set null,
260 info varchar(128) default NULL,
264 ---------------------------------
266 ---------------------------------
268 CREATE TABLE ir_module_category (
270 create_uid integer references res_users on delete set null,
271 create_date timestamp without time zone,
272 write_date timestamp without time zone,
273 write_uid integer references res_users on delete set null,
274 parent_id integer REFERENCES ir_module_category ON DELETE SET NULL,
275 name character varying(128) NOT NULL,
280 CREATE TABLE ir_module_module (
282 create_uid integer references res_users on delete set null,
283 create_date timestamp without time zone,
284 write_date timestamp without time zone,
285 write_uid integer references res_users on delete set null,
286 website character varying(256),
287 summary character varying(256),
288 name character varying(128) NOT NULL,
289 author character varying(128),
290 url character varying(128),
291 icon character varying(64),
292 state character varying(16),
293 latest_version character varying(64),
294 shortdesc character varying(256),
295 complexity character varying(32),
296 category_id integer REFERENCES ir_module_category ON DELETE SET NULL,
297 certificate character varying(64),
299 application boolean default False,
300 demo boolean default False,
301 web boolean DEFAULT FALSE,
302 license character varying(32),
303 sequence integer DEFAULT 100,
304 auto_install boolean default False,
307 ALTER TABLE ir_module_module add constraint name_uniq unique (name);
309 CREATE TABLE ir_module_module_dependency (
311 create_uid integer references res_users on delete set null,
312 create_date timestamp without time zone,
313 write_date timestamp without time zone,
314 write_uid integer references res_users on delete set null,
315 name character varying(128),
316 version_pattern character varying(128) default NULL,
317 module_id integer REFERENCES ir_module_module ON DELETE cascade,
321 CREATE TABLE res_company (
323 name character varying(64) not null,
324 parent_id integer references res_company on delete set null,
328 CREATE TABLE res_lang (
329 id serial PRIMARY KEY,
330 name VARCHAR(64) NOT NULL UNIQUE,
331 code VARCHAR(16) NOT NULL UNIQUE
334 CREATE TABLE ir_model_data (
337 create_date timestamp without time zone,
338 write_date timestamp without time zone,
341 name character varying(128) NOT NULL,
342 date_init timestamp without time zone,
343 date_update timestamp without time zone,
344 module character varying(64) NOT NULL,
345 model character varying(64) NOT NULL,
346 res_id integer, primary key(id)
349 -- Records foreign keys and constraints installed by a module (so they can be
350 -- removed when the module is uninstalled):
351 -- - for a foreign key: type is 'f',
352 -- - for a constraint: type is 'u' (this is the convention PostgreSQL uses).
353 CREATE TABLE ir_model_constraint (
356 create_date timestamp without time zone,
357 write_date timestamp without time zone,
359 date_init timestamp without time zone,
360 date_update timestamp without time zone,
361 module integer NOT NULL references ir_module_module on delete restrict,
362 model integer NOT NULL references ir_model on delete restrict,
363 type character varying(1) NOT NULL,
364 name character varying(128) NOT NULL
367 -- Records relation tables (i.e. implementing many2many) installed by a module
368 -- (so they can be removed when the module is uninstalled).
369 CREATE TABLE ir_model_relation (
372 create_date timestamp without time zone,
373 write_date timestamp without time zone,
375 date_init timestamp without time zone,
376 date_update timestamp without time zone,
377 module integer NOT NULL references ir_module_module on delete restrict,
378 model integer NOT NULL references ir_model on delete restrict,
379 name character varying(128) NOT NULL
382 ---------------------------------
384 ---------------------------------
386 insert into res_users (id,login,password,active,company_id,partner_id,lang) values (1,'admin','admin',True,1,1,'en_US');
387 insert into ir_model_data (name,module,model,noupdate,res_id) values ('user_root','base','res.users',True,1);
389 -- Compatibility purpose, to remove V6.0
390 insert into ir_model_data (name,module,model,noupdate,res_id) values ('user_admin','base','res.users',True,1);
392 select setval('res_users_id_seq', 2);