summaryrefslogtreecommitdiffstats
path: root/upgrades/dbpatches/1.4/postgresql/patch/applications.sql
blob: 9d0a6f57aae0ff91b12e7ef971dc4d59959d68d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE TABLE applications_tmp (
        applicationid	bigint	DEFAULT '0'     NOT NULL,
        hostid          bigint	DEFAULT '0'     NOT NULL,
        name            varchar(255)            DEFAULT ''      NOT NULL,
        templateid	bigint	DEFAULT '0'     NOT NULL,
        PRIMARY KEY (applicationid)
) with OIDS;

CREATE INDEX applications_1 on applications_tmp (templateid);
CREATE UNIQUE INDEX applications_2 on applications_tmp (hostid,name);

insert into applications_tmp select * from applications;
drop table applications;
alter table applications_tmp rename to applications;