Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Implement view Configuration functionality on Postgres #443

Merged
merged 5 commits into from
May 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions assets/migrations/generator/generatorConfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<javaClientGenerator targetPackage="org.opensrp.repository.postgres.mapper"
targetProject="opensrp-core" type="XMLMAPPER" />

<table schema="core" tableName="client">
<!-- <table schema="core" tableName="client">
<columnOverride column="json"
typeHandler="org.opensrp.repository.postgres.handler.ClientTypeHandler" />
</table>
Expand All @@ -23,7 +23,7 @@
typeHandler="org.opensrp.repository.postgres.handler.EventTypeHandler" />
</table>

<!--<table schema="core" tableName="action">
<table schema="core" tableName="action">
<columnOverride column="json"
typeHandler="org.opensrp.repository.postgres.handler.ActionTypeHandler" />
</table>
Expand Down Expand Up @@ -54,5 +54,10 @@
<table schema="core" tableName="multi_media" />
<table schema="error" tableName="error_trace" /> -->

<table schema="core" tableName="view_configuration">
<columnOverride column="json"
typeHandler="org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler" />
</table>
<table schema="core" tableName="view_configuration_metadata" />
</context>
</generatorConfiguration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--
-- Copyright 2010-2016 the original author or authors.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

-- // create view configurations table
-- Migration SQL that makes the change goes here.
CREATE TABLE core.view_configuration
(
id bigserial NOT NULL,
json jsonb NOT NULL,
PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
)


-- //@UNDO
-- SQL to undo the change goes here.
DROP TABLE core.view_configuration

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--
-- Copyright 2010-2016 the original author or authors.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

-- // create view configurations metadata table
-- Migration SQL that makes the change goes here.

CREATE TABLE core.view_configuration_metadata
(
id bigserial NOT NULL,
view_configuration_id bigint REFERENCES core.view_configuration (id),
document_id character varying UNIQUE NOT NULL,
identifier varchar UNIQUE,
server_version bigint,
PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
);

-- //@UNDO
-- SQL to undo the change goes here.
DROP TABLE core.view_configuration_metadata;

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.opensrp.domain.postgres;

public class ViewConfiguration {

/**
* This field was generated by MyBatis Generator. This field corresponds to the database column core.view_configuration.id
* @mbg.generated Mon Apr 23 10:29:52 EAT 2018
*/
private Long id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column core.view_configuration.json
* @mbg.generated Mon Apr 23 10:29:52 EAT 2018
*/
private Object json;

/**
* This method was generated by MyBatis Generator. This method returns the value of the database column core.view_configuration.id
* @return the value of core.view_configuration.id
* @mbg.generated Mon Apr 23 10:29:52 EAT 2018
*/
public Long getId() {
return id;
}

/**
* This method was generated by MyBatis Generator. This method sets the value of the database column core.view_configuration.id
* @param id the value for core.view_configuration.id
* @mbg.generated Mon Apr 23 10:29:52 EAT 2018
*/
public void setId(Long id) {
this.id = id;
}

/**
* This method was generated by MyBatis Generator. This method returns the value of the database column core.view_configuration.json
* @return the value of core.view_configuration.json
* @mbg.generated Mon Apr 23 10:29:52 EAT 2018
*/
public Object getJson() {
return json;
}

/**
* This method was generated by MyBatis Generator. This method sets the value of the database column core.view_configuration.json
* @param json the value for core.view_configuration.json
* @mbg.generated Mon Apr 23 10:29:52 EAT 2018
*/
public void setJson(Object json) {
this.json = json;
}
}
Loading