Add primary key on table inherits ir_actions

bzr revid: ced-fafa824a7b9df0dac499814aaf2b77a606700de5
This commit is contained in:
ced 2007-10-10 13:32:26 +00:00
parent a6b8fe83b7
commit cf35e2b136
2 changed files with 30 additions and 5 deletions

View File

@ -92,18 +92,21 @@ CREATE TABLE ir_act_report_xml (
report_name varchar(64) NOT NULL,
report_xsl varchar(64),
report_xml varchar(64),
auto boolean default true
auto boolean default true,
primary key(id)
)
INHERITS (ir_actions);
create table ir_act_report_custom (
report_id int
report_id int,
-- report_id int references ir_report_custom
primary key(id)
)
INHERITS (ir_actions);
CREATE TABLE ir_act_group (
exec_type varchar(64) DEFAULT 'serial'::varchar NOT NULL
exec_type varchar(64) DEFAULT 'serial'::varchar NOT NULL,
primary key(id)
)
INHERITS (ir_actions);
@ -114,12 +117,14 @@ CREATE TABLE ir_act_group_link (
CREATE TABLE ir_act_execute (
func_name varchar(64) NOT NULL,
func_arg varchar(64)
func_arg varchar(64),
primary key(id)
)
INHERITS (ir_actions);
CREATE TABLE ir_act_wizard (
wiz_name varchar(64) NOT NULL
wiz_name varchar(64) NOT NULL,
primary key(id)
)
INHERITS (ir_actions);

View File

@ -227,5 +227,25 @@ cr.execute('UPDATE res_country SET code = UPPER(code)')
cr.execute('UPDATE res_country_state SET code = UPPER(code)')
cr.commit()
# --------------------------------------------- #
# Add primary key on tables inherits ir_actions #
# --------------------------------------------- #
cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_report_xml_pkey\' and tablename = \'ir_act_report_xml\'')
if not cr.fetchall():
cr.execute('ALTER TABLE ir_act_report_xml ADD PRIMARY KEY (id)')
cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_report_custom_pkey\' and tablename = \'ir_act_report_custom\'')
if not cr.fetchall():
cr.execute('ALTER TABLE ir_act_report_custom ADD PRIMARY KEY (id)')
cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_group_pkey\' and tablename = \'ir_act_group\'')
if not cr.fetchall():
cr.execute('ALTER TABLE ir_act_group ADD PRIMARY KEY (id)')
cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_execute_pkey\' and tablename = \'ir_act_execute\'')
if not cr.fetchall():
cr.execute('ALTER TABLE ir_act_execute ADD PRIMARY KEY (id)')
cr.execute('SELECT indexname FROm pg_indexes WHERE indexname = \'ir_act_wizard_pkey\' and tablename = \'ir_act_wizard\'')
if not cr.fetchall():
cr.execute('ALTER TABLE ir_act_wizard ADD PRIMARY KEY (id)')
cr.commit()
cr.close