summaryrefslogtreecommitdiffstats
path: root/upgrades/dbpatches/1.4/postgresql/patch/profiles.sql
blob: 470d34158593d67585dbdff41a2f92fa6119e75f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CREATE TABLE profiles_tmp (
	profileid	bigint DEFAULT '0'	NOT NULL,
	userid		bigint DEFAULT '0'	NOT NULL,
	idx		varchar(64)		DEFAULT ''	NOT NULL,
	value		varchar(255)		DEFAULT ''	NOT NULL,
	valuetype	integer		DEFAULT 0	NOT NULL,
	PRIMARY KEY (profileid)
) with OIDS;
CREATE UNIQUE INDEX profiles_tmp_1 on profiles_tmp (userid,idx);

insert into profiles_tmp select NULL,userid,idx,value,valuetype from profiles;
drop table profiles;
alter table profiles_tmp rename to profiles;

CREATE TABLE profiles_tmp (
	profileid	bigint DEFAULT '0'	NOT NULL,
	userid		bigint DEFAULT '0'	NOT NULL,
	idx		varchar(64)		DEFAULT ''	NOT NULL,
	value		varchar(255)		DEFAULT ''	NOT NULL,
	valuetype	integer		DEFAULT 0	NOT NULL,
	PRIMARY KEY (profileid)
) with OIDS;
CREATE UNIQUE INDEX profiles_1 on profiles_tmp (userid,idx);

insert into profiles_tmp select * from profiles;
drop table profiles;
alter table profiles_tmp rename to profiles;