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 name varchar(64) not null,
150 active boolean default True,
151 login varchar(64) NOT NULL UNIQUE,
152 password varchar(64) default null,
153 tz varchar(64) default null,
154 lang varchar(64) default '',
155 -- No FK references below, will be added later by ORM
156 -- (when the destination rows exist)
161 alter table res_users add constraint res_users_login_uniq unique (login);
163 CREATE TABLE res_groups (
165 name varchar(64) NOT NULL,
169 CREATE TABLE res_groups_users_rel (
170 uid integer NOT NULL references res_users on delete cascade,
171 gid integer NOT NULL references res_groups on delete cascade,
175 create index res_groups_users_rel_uid_idx on res_groups_users_rel (uid);
176 create index res_groups_users_rel_gid_idx on res_groups_users_rel (gid);
179 ---------------------------------
181 ---------------------------------
188 on_create bool default False,
192 create table wkf_activity
195 wkf_id int references wkf on delete cascade,
196 subflow_id int references wkf on delete set null,
197 split_mode varchar(3) default 'XOR',
198 join_mode varchar(3) default 'XOR',
199 kind varchar(16) not null default 'dummy',
201 signal_send varchar(32) default null,
202 flow_start boolean default False,
203 flow_stop boolean default False,
204 action text default null,
208 create table wkf_transition
211 act_from int references wkf_activity on delete cascade,
212 act_to int references wkf_activity on delete cascade,
213 condition varchar(128) default NULL,
215 trigger_type varchar(128) default NULL,
216 trigger_expr_id varchar(128) default NULL,
218 signal varchar(64) default null,
219 group_id int references res_groups on delete set null,
224 create table wkf_instance
227 wkf_id int references wkf on delete restrict,
228 uid int default null,
230 res_type varchar(64) not null,
231 state varchar(32) not null default 'active',
235 create table wkf_workitem
238 act_id int not null references wkf_activity on delete cascade,
239 inst_id int not null references wkf_instance on delete cascade,
240 subflow_id int references wkf_instance on delete cascade,
241 state varchar(64) default 'blocked',
245 create table wkf_witm_trans
247 trans_id int not null references wkf_transition on delete cascade,
248 inst_id int not null references wkf_instance on delete cascade
251 create index wkf_witm_trans_inst_idx on wkf_witm_trans (inst_id);
253 create table wkf_logs
256 res_type varchar(128) not null,
258 uid int references res_users on delete set null,
259 act_id int references wkf_activity on delete set null,
261 info varchar(128) default NULL,
265 ---------------------------------
267 ---------------------------------
269 CREATE TABLE ir_module_category (
271 create_uid integer references res_users on delete set null,
272 create_date timestamp without time zone,
273 write_date timestamp without time zone,
274 write_uid integer references res_users on delete set null,
275 parent_id integer REFERENCES ir_module_category ON DELETE SET NULL,
276 name character varying(128) NOT NULL,
281 CREATE TABLE ir_module_module (
283 create_uid integer references res_users on delete set null,
284 create_date timestamp without time zone,
285 write_date timestamp without time zone,
286 write_uid integer references res_users on delete set null,
287 website character varying(256),
288 summary character varying(256),
289 name character varying(128) NOT NULL,
290 author character varying(128),
291 url character varying(128),
292 icon character varying(64),
293 state character varying(16),
294 latest_version character varying(64),
295 shortdesc character varying(256),
296 complexity character varying(32),
297 category_id integer REFERENCES ir_module_category ON DELETE SET NULL,
298 certificate character varying(64),
300 application boolean default False,
301 demo boolean default False,
302 web boolean DEFAULT FALSE,
303 license character varying(32),
304 sequence integer DEFAULT 100,
305 auto_install boolean default False,
308 ALTER TABLE ir_module_module add constraint name_uniq unique (name);
310 CREATE TABLE ir_module_module_dependency (
312 create_uid integer references res_users on delete set null,
313 create_date timestamp without time zone,
314 write_date timestamp without time zone,
315 write_uid integer references res_users on delete set null,
316 name character varying(128),
317 version_pattern character varying(128) default NULL,
318 module_id integer REFERENCES ir_module_module ON DELETE cascade,
322 CREATE TABLE res_company (
324 name character varying(64) not null,
325 parent_id integer references res_company on delete set null,
329 CREATE TABLE res_lang (
330 id serial PRIMARY KEY,
331 name VARCHAR(64) NOT NULL UNIQUE,
332 code VARCHAR(16) NOT NULL UNIQUE
335 CREATE TABLE ir_model_data (
338 create_date timestamp without time zone,
339 write_date timestamp without time zone,
342 name character varying(128) NOT NULL,
343 date_init timestamp without time zone,
344 date_update timestamp without time zone,
345 module character varying(64) NOT NULL,
346 model character varying(64) NOT NULL,
347 res_id integer, primary key(id)
350 -- Records foreign keys and constraints installed by a module (so they can be
351 -- removed when the module is uninstalled):
352 -- - for a foreign key: type is 'f',
353 -- - for a constraint: type is 'u' (this is the convention PostgreSQL uses).
354 CREATE TABLE ir_model_constraint (
357 create_date timestamp without time zone,
358 write_date timestamp without time zone,
360 date_init timestamp without time zone,
361 date_update timestamp without time zone,
362 module integer NOT NULL references ir_module_module on delete restrict,
363 model integer NOT NULL references ir_model on delete restrict,
364 type character varying(1) NOT NULL,
365 name character varying(128) NOT NULL
368 -- Records relation tables (i.e. implementing many2many) installed by a module
369 -- (so they can be removed when the module is uninstalled).
370 CREATE TABLE ir_model_relation (
373 create_date timestamp without time zone,
374 write_date timestamp without time zone,
376 date_init timestamp without time zone,
377 date_update timestamp without time zone,
378 module integer NOT NULL references ir_module_module on delete restrict,
379 model integer NOT NULL references ir_model on delete restrict,
380 name character varying(128) NOT NULL
383 ---------------------------------
385 ---------------------------------
387 insert into res_users (id,login,password,name,active,company_id,partner_id,lang) values (1,'admin','admin','Administrator',True,1,1,'en_US');
388 insert into ir_model_data (name,module,model,noupdate,res_id) values ('user_root','base','res.users',True,1);
390 -- Compatibility purpose, to remove V6.0
391 insert into ir_model_data (name,module,model,noupdate,res_id) values ('user_admin','base','res.users',True,1);
393 select setval('res_users_id_seq', 2);