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
-- No FK references below, will be added later by ORM
153
-- (when the destination rows exist)
158
alter table res_users add constraint res_users_login_uniq unique (login);
160
CREATE TABLE res_groups (
162
name varchar(64) NOT NULL,
166
CREATE TABLE res_groups_users_rel (
167
uid integer NOT NULL references res_users on delete cascade,
168
gid integer NOT NULL references res_groups on delete cascade,
172
create index res_groups_users_rel_uid_idx on res_groups_users_rel (uid);
173
create index res_groups_users_rel_gid_idx on res_groups_users_rel (gid);
176
---------------------------------
178
---------------------------------
185
on_create bool default False,
189
create table wkf_activity
192
wkf_id int references wkf on delete cascade,
193
subflow_id int references wkf on delete set null,
194
split_mode varchar(3) default 'XOR',
195
join_mode varchar(3) default 'XOR',
196
kind varchar(16) not null default 'dummy',
198
signal_send varchar(32) default null,
199
flow_start boolean default False,
200
flow_stop boolean default False,
201
action text default null,
205
create table wkf_transition
208
act_from int references wkf_activity on delete cascade,
209
act_to int references wkf_activity on delete cascade,
210
condition varchar(128) default NULL,
212
trigger_type varchar(128) default NULL,
213
trigger_expr_id varchar(128) default NULL,
215
signal varchar(64) default null,
216
group_id int references res_groups on delete set null,
221
create table wkf_instance
224
wkf_id int references wkf on delete restrict,
225
uid int default null,
227
res_type varchar(64) not null,
228
state varchar(32) not null default 'active',
232
create table wkf_workitem
235
act_id int not null references wkf_activity on delete cascade,
236
inst_id int not null references wkf_instance on delete cascade,
237
subflow_id int references wkf_instance on delete cascade,
238
state varchar(64) default 'blocked',
242
create table wkf_witm_trans
244
trans_id int not null references wkf_transition on delete cascade,
245
inst_id int not null references wkf_instance on delete cascade
248
create index wkf_witm_trans_inst_idx on wkf_witm_trans (inst_id);
250
create table wkf_logs
253
res_type varchar(128) not null,
255
uid int references res_users on delete set null,
256
act_id int references wkf_activity on delete set null,
258
info varchar(128) default NULL,
262
---------------------------------
264
---------------------------------
266
CREATE TABLE ir_module_category (
268
create_uid integer references res_users on delete set null,
269
create_date timestamp without time zone,
270
write_date timestamp without time zone,
271
write_uid integer references res_users on delete set null,
272
parent_id integer REFERENCES ir_module_category ON DELETE SET NULL,
273
name character varying(128) NOT NULL,
278
CREATE TABLE ir_module_module (
280
create_uid integer references res_users on delete set null,
281
create_date timestamp without time zone,
282
write_date timestamp without time zone,
283
write_uid integer references res_users on delete set null,
284
website character varying(256),
285
summary character varying(256),
286
name character varying(128) NOT NULL,
287
author character varying(128),
288
url character varying(128),
289
icon character varying(64),
290
state character varying(16),
291
latest_version character varying(64),
292
shortdesc character varying(256),
293
complexity character varying(32),
294
category_id integer REFERENCES ir_module_category ON DELETE SET NULL,
296
application boolean default False,
297
demo boolean default False,
298
web boolean DEFAULT FALSE,
299
license character varying(32),
300
sequence integer DEFAULT 100,
301
auto_install boolean default False,
304
ALTER TABLE ir_module_module add constraint name_uniq unique (name);
306
CREATE TABLE ir_module_module_dependency (
308
create_uid integer references res_users on delete set null,
309
create_date timestamp without time zone,
310
write_date timestamp without time zone,
311
write_uid integer references res_users on delete set null,
312
name character varying(128),
313
version_pattern character varying(128) default NULL,
314
module_id integer REFERENCES ir_module_module ON DELETE cascade,
318
CREATE TABLE res_partner (
320
name character varying(128),
327
CREATE TABLE res_currency (
328
id serial PRIMARY KEY,
329
name VARCHAR(32) NOT NULL
332
CREATE TABLE res_company (
333
id serial PRIMARY KEY,
334
name character varying(128) not null,
335
parent_id integer references res_company on delete set null,
336
partner_id integer not null references res_partner,
337
currency_id integer not null references res_currency
341
CREATE TABLE res_lang (
342
id serial PRIMARY KEY,
343
name VARCHAR(64) NOT NULL UNIQUE,
344
code VARCHAR(16) NOT NULL UNIQUE
347
CREATE TABLE ir_model_data (
350
create_date timestamp without time zone,
351
write_date timestamp without time zone,
354
name character varying(128) NOT NULL,
355
date_init timestamp without time zone,
356
date_update timestamp without time zone,
357
module character varying(64) NOT NULL,
358
model character varying(64) NOT NULL,
359
res_id integer, primary key(id)
362
-- Records foreign keys and constraints installed by a module (so they can be
363
-- removed when the module is uninstalled):
364
-- - for a foreign key: type is 'f',
365
-- - for a constraint: type is 'u' (this is the convention PostgreSQL uses).
366
CREATE TABLE ir_model_constraint (
369
create_date timestamp without time zone,
370
write_date timestamp without time zone,
372
date_init timestamp without time zone,
373
date_update timestamp without time zone,
374
module integer NOT NULL references ir_module_module on delete restrict,
375
model integer NOT NULL references ir_model on delete restrict,
376
type character varying(1) NOT NULL,
377
name character varying(128) NOT NULL
380
-- Records relation tables (i.e. implementing many2many) installed by a module
381
-- (so they can be removed when the module is uninstalled).
382
CREATE TABLE ir_model_relation (
385
create_date timestamp without time zone,
386
write_date timestamp without time zone,
388
date_init timestamp without time zone,
389
date_update timestamp without time zone,
390
module integer NOT NULL references ir_module_module on delete restrict,
391
model integer NOT NULL references ir_model on delete restrict,
392
name character varying(128) NOT NULL
395
---------------------------------
397
---------------------------------
398
insert into res_users (id,login,password,active,company_id,partner_id) VALUES (1,'admin','admin',true,1,1);
399
insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('user_root','base','res.users',true,1);
401
insert into res_partner (id, name, lang, company_id) VALUES (1, 'Your Company', 'en_US', 1);
402
insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('main_partner','base','res.partner',true,1);
404
insert into res_currency (id, name) VALUES (1, 'EUR');
405
insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('EUR','base','res.currency',true,1);
407
insert into res_company (id, name, partner_id, currency_id) VALUES (1, 'Your Company', 1, 1);
408
insert into ir_model_data (name,module,model,noupdate,res_id) VALUES ('main_company','base','res.company',true,1);
410
select setval('res_company_id_seq', 2);
411
select setval('res_users_id_seq', 2);
412
select setval('res_partner_id_seq', 2);
413
select setval('res_currency_id_seq', 2);
b'\\ No newline at end of file'