Skip to content

Commit 3f5e1b6

Browse files
authored
Merge pull request #47 from OpenSRP/unique-id-tqble-migration-scripts
Unique id table migration scripts
2 parents 4b3f7b5 + 606f6aa commit 3f5e1b6

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

assets/migrations/generator/generatorConfig.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@
9595
<table schema="core" tableName="plan" >
9696
<columnOverride column="json" typeHandler="org.opensrp.repository.postgres.handler.PlanTypeHandler"/>
9797
</table>
98-
<table schema="core" tableName="plan_metadata" domainObjectName="PlanMetadata"/>
99-
98+
<table schema="core" tableName="plan_metadata" domainObjectName="PlanMetadata"/>
99+
100+
<table schema="core" tableName="unique_id" />
100101
101102
<table schema="team" tableName="organization" >
102103
<columnOverride column="type" typeHandler="org.opensrp.repository.postgres.handler.CodeSystemTypeHandler"/>
@@ -105,8 +106,8 @@
105106
<table schema="team" tableName="practitioner" />
106107
107108
<table schema="team" tableName="practitioner_role" />-->
108-
109-
<table schema="team" tableName="organization_location" />
110-
109+
110+
<table schema="team" tableName="organization_location" />
111+
111112
</context>
112113
</generatorConfiguration>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--
2+
-- Copyright 2010-2016 the original author or authors.
3+
--
4+
-- Licensed under the Apache License, Version 2.0 (the "License");
5+
-- you may not use this file except in compliance with the License.
6+
-- You may obtain a copy of the License at
7+
--
8+
-- http://www.apache.org/licenses/LICENSE-2.0
9+
--
10+
-- Unless required by applicable law or agreed to in writing, software
11+
-- distributed under the License is distributed on an "AS IS" BASIS,
12+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
-- See the License for the specific language governing permissions and
14+
-- limitations under the License.
15+
--
16+
17+
-- // create unique ids table
18+
-- Migration SQL that makes the change goes here.
19+
20+
CREATE TABLE core.unique_id
21+
(
22+
id bigserial NOT NULL,
23+
location varchar(255),
24+
openmrs_id varchar(255),
25+
status varchar(255),
26+
used_by varchar(255),
27+
updated_at timestamp,
28+
created_at timestamp DEFAULT CURRENT_TIMESTAMP,
29+
PRIMARY KEY (id)
30+
)
31+
WITH (
32+
OIDS = FALSE
33+
) TABLESPACE ${core_tablespace};
34+
35+
CREATE INDEX unique_id_openmrs_id_index ON core.unique_id (openmrs_id);
36+
37+
-- //@UNDO
38+
-- SQL to undo the change goes here.
39+
40+
DROP TABLE core.unique_id
41+

0 commit comments

Comments
 (0)