diff --git a/.github/workflows/push_trigger.yml b/.github/workflows/push_trigger.yml
index bec5436b1ea..e77cc908bfe 100644
--- a/.github/workflows/push_trigger.yml
+++ b/.github/workflows/push_trigger.yml
@@ -126,7 +126,7 @@ jobs:
- name: Publish the maven package
run: |
- cd admin && mvn deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.OSSRH_SNAPSHOT_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml
+ cd admin && mvn deploy -DaltDeploymentRepository=ossrh::default::${{ secrets.RELEASE_URL }} -s $GITHUB_WORKSPACE/settings.xml -f pom.xml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GPG_TTY: $(tty)
diff --git a/.github/workflows/release_changes.yml b/.github/workflows/release_changes.yml
index cc9c2956d9e..5d8e1a32989 100644
--- a/.github/workflows/release_changes.yml
+++ b/.github/workflows/release_changes.yml
@@ -27,6 +27,11 @@ jobs:
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV
+ - name: update Branch name in badges
+ run: |
+ sed -i 's/branch=.*)]/branch=${{ env.BRANCH_NAME }}\)]/g' README.md
+ sed -i 's/branch=.*\&/branch=${{ env.BRANCH_NAME }}\&/g' README.md
+
- name: Mannualy changing the pom versions
run: find . -type f -name "*pom.xml" -print0 | xargs -0 sed -i "s/${{ github.event.inputs.snapshotTags }}/${{ github.event.inputs.releaseTags }}/g"
@@ -48,7 +53,7 @@ jobs:
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ACTION_PAT }}
- commit-message: Updated Pom versions for release changes
+ commit-message: Release Bot Pre-release changes
title: Release changes
body: Automated PR for ${{ github.event.inputs.releaseTags }} release.
branch: release-branch
diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml
new file mode 100644
index 00000000000..e9bba0e65a0
--- /dev/null
+++ b/.github/workflows/tag.yaml
@@ -0,0 +1,43 @@
+name: Tagging of repos
+
+env:
+ tag: v1.2.3
+
+on:
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'Tag to be published'
+ required: true
+ default: 'v1.2.3'
+ type: string
+ body:
+ description: 'Release body message'
+ required: true
+ default: 'Changes in this Release'
+ type: string
+ pre-release:
+ description: 'Pre-release? True/False'
+ required: true
+ default: False
+ type: string
+
+jobs:
+ build:
+ name: Create Release
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+ - name: Create Release
+ id: create_release
+ uses: actions/create-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
+ with:
+ tag_name: ${{ github.event.inputs.tag }}
+ release_name: ${{ github.event.inputs.tag }}
+ body: |
+ ${{ github.event.inputs.body }}
+ draft: false
+ prerelease: ${{fromJSON(github.event.inputs.pre-release)}}
diff --git a/README.md b/README.md
index 863f5707507..168f14bccf5 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Maven Package upon a push](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml/badge.svg?branch=develop)](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml)
+[![Maven Package upon a push](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml/badge.svg?branch=release-1.2.0.1)](https://github.com/mosip/admin-services/actions/workflows/push_trigger.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=mosip_admin-services&id=mosip_admin-services&metric=alert_status)](https://sonarcloud.io/dashboard?id=mosip_admin-services)
diff --git a/admin/admin-service/pom.xml b/admin/admin-service/pom.xml
index 2510e13704c..c7a8f780f06 100644
--- a/admin/admin-service/pom.xml
+++ b/admin/admin-service/pom.xml
@@ -7,18 +7,18 @@
io.mosip.admin
admin-parent
- 1.2.0.1-SNAPSHOT
+ 1.2.0.1-B1
admin-service
admin-service
- 1.2.0.1-SNAPSHOT
+ 1.2.0.1-B1
http://maven.apache.org
jar
UTF-8
2.0.4.RELEASE
1.5.10
- 1.2.0.1-SNAPSHOT
+ 1.2.0.1-B1
diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/CustomLineMapper.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/CustomLineMapper.java
index 63fbdb38e5d..a1bd8dedd7f 100644
--- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/CustomLineMapper.java
+++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/CustomLineMapper.java
@@ -7,10 +7,13 @@
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
public class CustomLineMapper implements LineMapper, InitializingBean {
@@ -41,6 +44,10 @@ public T mapLine(String line, int lineNumber) throws Exception {
throw new Exception("Invalid language code provided");
}
}
+ Set> violations = validator.validate(fieldSetMapper.mapFieldSet(tokenizer.tokenize(line)));
+ if (!violations.isEmpty()) {
+ throw new ConstraintViolationException(violations);
+ }
return fieldSetMapper.mapFieldSet(tokenizer.tokenize(line));
}
diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/JobResultListener.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/JobResultListener.java
index c38d07789d2..adb2a09ea06 100644
--- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/JobResultListener.java
+++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/batch/JobResultListener.java
@@ -17,6 +17,8 @@
import java.util.ArrayList;
import java.util.List;
+import javax.validation.ConstraintViolationException;
+
public class JobResultListener implements JobExecutionListener {
private static final Logger logger = LoggerFactory.getLogger(JobResultListener.class);
@@ -58,9 +60,13 @@ public void afterJob(JobExecution jobExecution) {
List failures = new ArrayList();
jobExecution.getStepExecutions().forEach(step -> {
step.getFailureExceptions().forEach(failure -> {
- if (failure instanceof FlatFileParseException) {
+ if (failure instanceof FlatFileParseException && failure.getCause() instanceof ConstraintViolationException) {
+ failures.add("Line --> " + ((FlatFileParseException) failure).getLineNumber() + " --> "+
+ ((FlatFileParseException) failure).getCause().getMessage());
+ }
+ else if(failure instanceof FlatFileParseException){
failures.add("Line --> " + ((FlatFileParseException) failure).getLineNumber() +
- " --> Datatype mismatch / Failed to write into object");
+ " --> Datatype mismatch/ Validation error / Failed to write into object");
} else
failures.add(failure.getCause() != null ? failure.getCause().getMessage() : failure.getMessage());
});
diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/BlocklistedWords.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/BlocklistedWords.java
index d61b7bcc94f..2095f95ab0a 100644
--- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/BlocklistedWords.java
+++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/BlocklistedWords.java
@@ -7,6 +7,7 @@
import javax.persistence.Id;
import javax.persistence.Table;
+import io.mosip.admin.validator.AlphabeticValidator;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -37,6 +38,7 @@ public class BlocklistedWords extends BaseEntity implements Serializable {
*/
@Id
@Column(name = "word", length = 128)
+ @AlphabeticValidator(message = "Blocklisted word can only contain Alphabets")
private String word;
/**
diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ModuleDetail.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ModuleDetail.java
index 08a226d0f94..15b6c69ce08 100644
--- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ModuleDetail.java
+++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/ModuleDetail.java
@@ -5,8 +5,11 @@
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
+import javax.persistence.IdClass;
import javax.persistence.Table;
+import io.mosip.admin.bulkdataupload.entity.id.CodeAndLanguageCodeID;
+import io.mosip.admin.bulkdataupload.entity.id.IdAndLanguageCodeID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -18,6 +21,7 @@
@AllArgsConstructor
@Entity
@Table(name = "module_detail", schema = "master")
+@IdClass(IdAndLanguageCodeID.class)
public class ModuleDetail extends BaseEntity implements Serializable {
/**
@@ -29,6 +33,7 @@ public class ModuleDetail extends BaseEntity implements Serializable {
@Column(name = "id", nullable = false, length = 36)
private String id;
+ @Id
@Column(name = "lang_code", nullable = false, length = 3)
private String langCode;
diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/Template.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/Template.java
index 1e63bc7b68f..06bfc02fdac 100644
--- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/Template.java
+++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/Template.java
@@ -71,7 +71,8 @@ public class Template extends BaseEntity implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
- @JoinColumn(name = "module_id", referencedColumnName = "id", insertable = false, updatable = false) })
+ @JoinColumn(name = "module_id", referencedColumnName = "id", insertable = false, updatable = false),
+ @JoinColumn(name = "lang_code", referencedColumnName = "lang_code", insertable = false, updatable = false) })
private ModuleDetail moduleDetail;
@ManyToOne(fetch = FetchType.LAZY)
diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/id/HolidayID.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/id/HolidayID.java
index d21290b1c48..8477a649eaf 100644
--- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/id/HolidayID.java
+++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/entity/id/HolidayID.java
@@ -33,7 +33,5 @@ public class HolidayID implements Serializable {
@Column(name = "lang_code", nullable = false, length = 3)
private String langCode;
- @Column(name = "holiday_name", nullable = false, length = 64)
- private String holidayName;
}
diff --git a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/service/impl/BulkDataUploadServiceImpl.java b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/service/impl/BulkDataUploadServiceImpl.java
index 0ded34be383..c882c8dbb66 100644
--- a/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/service/impl/BulkDataUploadServiceImpl.java
+++ b/admin/admin-service/src/main/java/io/mosip/admin/bulkdataupload/service/impl/BulkDataUploadServiceImpl.java
@@ -14,6 +14,7 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
+import javax.validation.Validator;
import io.mosip.admin.bulkdataupload.batch.CustomLineMapper;
import io.mosip.admin.bulkdataupload.batch.JobResultListener;
@@ -108,6 +109,9 @@ public class BulkDataUploadServiceImpl implements BulkDataService {
@Autowired
private RestTemplate restTemplate;
+
+ @Autowired
+ private Validator validator;
@Autowired
private BulkUploadTranscationRepository bulkTranscationRepo;
@@ -474,7 +478,7 @@ public void handleLine(String s) {
fieldSetMapper.setTargetType(clazz);
fieldSetMapper.setConversionService(customConversionService());
- CustomLineMapper
diff --git a/db_release_scripts/mosip_master/README.md b/db_release_scripts/mosip_master/README.md
new file mode 100644
index 00000000000..651d629648d
--- /dev/null
+++ b/db_release_scripts/mosip_master/README.md
@@ -0,0 +1,15 @@
+## ddl
+
+Directory contains DDL scripts for tables to be created under mosip_master DB.
+
+## dml
+
+Directory contains DML scripts for tables to be created under mosip_master DB.
+
+## migration_scripts
+
+Directory contains python scripts to be executed before / after DB migrations. Python scripts are stored under sub directory named after the migrated version.
+
+## sql
+
+Directory contains sql scripts to be executed after DB migrations. migration and revoke scripts are named after the migrated version.
\ No newline at end of file
diff --git a/db_release_scripts/mosip_master/master_release_deploy.properties b/db_release_scripts/mosip_master/deploy.properties
similarity index 92%
rename from db_release_scripts/mosip_master/master_release_deploy.properties
rename to db_release_scripts/mosip_master/deploy.properties
index b5ed0cb0c5e..e26a686f5e0 100644
--- a/db_release_scripts/mosip_master/master_release_deploy.properties
+++ b/db_release_scripts/mosip_master/deploy.properties
@@ -10,3 +10,4 @@ ALTER_SCRIPT_FLAG=1
ALTER_SCRIPT_FILENAME=master-scripts_release.sql
REVOKE_SCRIPT_FLAG=1
REVOKE_SCRIPT_FILENAME=master-scripts_revoke.sql
+PRIMARY_LANGUAGE_CODE='eng'
diff --git a/db_release_scripts/mosip_master/master_release_db_deploy.sh b/db_release_scripts/mosip_master/deploy.sh
similarity index 96%
rename from db_release_scripts/mosip_master/master_release_db_deploy.sh
rename to db_release_scripts/mosip_master/deploy.sh
index f117cc5124c..fe1034e8721 100644
--- a/db_release_scripts/mosip_master/master_release_db_deploy.sh
+++ b/db_release_scripts/mosip_master/deploy.sh
@@ -73,7 +73,7 @@ fi
if [ ${ALTER_SCRIPT_FLAG} == 1 ]
then
echo `date "+%m/%d/%Y %H:%M:%S"` ": Deploying Alter scripts for ${MOSIP_DB_NAME} database" | tee -a $LOG 2>&1
- PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $ALTER_SCRIPT_FILENAME_VERSION >> $LOG 2>&1
+ PGPASSWORD=$SYSADMIN_PWD psql --username=$SYSADMIN_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -v primary_language_code=$PRIMARY_LANGUAGE_CODE -a -b -f $ALTER_SCRIPT_FILENAME_VERSION >> $LOG 2>&1
else
echo `date "+%m/%d/%Y %H:%M:%S"` ": There are no alter scripts available for this deployment at ${MOSIP_DB_NAME}" | tee -a $LOG 2>&1
fi
diff --git a/db_release_scripts/mosip_master/migration_scripts/1.2.0/README.md b/db_release_scripts/mosip_master/migration_scripts/1.2.0/README.md
new file mode 100644
index 00000000000..7c3ee752591
--- /dev/null
+++ b/db_release_scripts/mosip_master/migration_scripts/1.2.0/README.md
@@ -0,0 +1,43 @@
+## migration-dynamicfield.py
+
+This script should be executed after DB upgrade.
+
+1. Provide execute permission to `migration-dynamicfield.py`
+2. Run the script with arguments as shown below:
+
+./migration-dynamicfield.py db-username db-password db-domain-name db-port
+
+ Ex: ./migration-dynamicfield.py postgres mosip1234 dev.mosip.net 30090
+
+3. On successful execution of the script delete the `dynamic_field_migr_bkp` backup table.
+
+
+### Revoke script On Failure:
+
+1. Provide execute permission to `revoke-migration-dynamicfield.py`
+2. Run the script with arguments as shown below:
+
+./revoke-migration-dynamicfield.py db-username db-password db-domain-name db-port
+
+ Ex: ./revoke-migration-dynamicfield.py postgres mosip1234 dev.mosip.net 30090
+
+
+Note: db-username, should be a user with permission to run DDL and DML statements
+
+
+## UI Spec migration
+
+In 1.1.5* both Identity schema and UI spec was stored in identity_schema table. From 1.2.0 it is split into 2 different tables, identity_schema and ui_spec.
+As part of sql migration script `1.2.0_master-scripts_release.sql` data split is taken care.
+
+1. Pre-Registration UI-spec `pre-registration-demographic.json` is part of mosip-config repo in 1.1.5.* and should be manually published using masterdata UI-spec API.
+2. For 1.2.0, Registration-Client UI spec is defined per process, Refer this documentation for more details
+https://docs.mosip.io/1.2.0/modules/registration-client/registration-client-ui-specifications
+
+
+### Refer below API documentation to define and publish UI spec
+
+https://mosip.github.io/documentation/1.2.0/kernel-masterdata-service.html#operation/defineUISpec
+https://mosip.github.io/documentation/1.2.0/kernel-masterdata-service.html#operation/publishUISpec
+
+
diff --git a/db_release_scripts/mosip_master/migration_scripts/1.2.0/migration-dynamicfield.py b/db_release_scripts/mosip_master/migration_scripts/1.2.0/migration-dynamicfield.py
new file mode 100755
index 00000000000..8ab0fa2c8d1
--- /dev/null
+++ b/db_release_scripts/mosip_master/migration_scripts/1.2.0/migration-dynamicfield.py
@@ -0,0 +1,65 @@
+#!/usr/bin/python3
+
+import psycopg2
+import json
+import sys
+
+conn = psycopg2.connect(database="mosip_master", user = sys.argv[1], password = sys.argv[2], host = sys.argv[3], port = sys.argv[4])
+
+print("Opened database successfully")
+
+cur = conn.cursor()
+
+#Backup existing dynamic_field table
+cur.execute('ALTER TABLE master.dynamic_field RENAME TO dynamic_field_migr_bkp;')
+
+print("Renamed dynamic_field table to dynamic_field_migr_bkp")
+
+#Create dynamic_field table
+cur.execute('''CREATE TABLE master.dynamic_field(
+ id character varying(36) NOT NULL,
+ name character varying(36) NOT NULL,
+ description character varying(256),
+ data_type character varying(16),
+ value_json character varying,
+ lang_code character varying(3) NOT NULL,
+ is_active boolean NOT NULL,
+ cr_by character varying(256) NOT NULL,
+ cr_dtimes timestamp NOT NULL,
+ upd_by character varying(256),
+ upd_dtimes timestamp,
+ is_deleted boolean DEFAULT FALSE,
+ del_dtimes timestamp,
+ CONSTRAINT pk_dynamic_id PRIMARY KEY (id));''')
+
+print("created table dynamic_field")
+
+#Query all the records from backup table
+cur.execute('select * from master.dynamic_field_migr_bkp')
+rows = cur.fetchall()
+
+print("Data fetched from backup table")
+
+id = 1000
+stmt = 'insert into dynamic_field values (%s,%s,%s,%s,%s,%s,True,%s,now(),NULL,NULL,False,NULL);'
+#Iterate through each row and create new insert statements
+for row in rows:
+ name = row[1]
+ desc = row[2]
+ data_type = row[3]
+ lang = row[5]
+ cr_by = row[7]
+ cr_dtimes = row[8]
+ values = json.loads(row[4])
+ for val in values:
+ id = id + 1
+ vmap = {'code' : val['code'], 'value': val['value']}
+ #Execute the insert statement
+ cur.execute(stmt, (str(id), name, desc, data_type, json.dumps(vmap), lang, cr_by))
+
+
+# Commit and close connection
+conn.commit()
+
+print("Closing the database connection")
+conn.close()
diff --git a/db_release_scripts/mosip_master/migration_scripts/1.2.0/revoke-migration-dynamicfield.py b/db_release_scripts/mosip_master/migration_scripts/1.2.0/revoke-migration-dynamicfield.py
new file mode 100755
index 00000000000..bb3ab571d94
--- /dev/null
+++ b/db_release_scripts/mosip_master/migration_scripts/1.2.0/revoke-migration-dynamicfield.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+
+import psycopg2
+import json
+import sys
+
+conn = psycopg2.connect(database="mosip_master", user = sys.argv[1], password = sys.argv[2], host = sys.argv[3], port = sys.argv[4])
+
+print("Opened database successfully")
+
+cur = conn.cursor()
+
+#Backup existing dynamic_field table
+cur.execute('ALTER TABLE master.dynamic_field_migr_bkp RENAME TO dynamic_field;')
+
+print("Renamed dynamic_field_migr_bkp to dynamic_field");
+
+# Commit and close connection
+conn.commit()
+
+print("Closing the database connection")
+conn.close()
diff --git a/db_release_scripts/mosip_master/sql/1.1.0_master-scripts_release.sql b/db_release_scripts/mosip_master/sql/1.1.0-release.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.0_master-scripts_release.sql
rename to db_release_scripts/mosip_master/sql/1.1.0-release.sql
diff --git a/db_release_scripts/mosip_master/sql/1.1.0_master-scripts_revoke.sql b/db_release_scripts/mosip_master/sql/1.1.0-revoke.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.0_master-scripts_revoke.sql
rename to db_release_scripts/mosip_master/sql/1.1.0-revoke.sql
diff --git a/db_release_scripts/mosip_master/sql/1.1.2_master-scripts_release.sql b/db_release_scripts/mosip_master/sql/1.1.2-release.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.2_master-scripts_release.sql
rename to db_release_scripts/mosip_master/sql/1.1.2-release.sql
diff --git a/db_release_scripts/mosip_master/sql/1.1.2_master-scripts_revoke.sql b/db_release_scripts/mosip_master/sql/1.1.2-revoke.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.2_master-scripts_revoke.sql
rename to db_release_scripts/mosip_master/sql/1.1.2-revoke.sql
diff --git a/db_release_scripts/mosip_master/sql/1.1.4_master-scripts_release.sql b/db_release_scripts/mosip_master/sql/1.1.4-release.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.4_master-scripts_release.sql
rename to db_release_scripts/mosip_master/sql/1.1.4-release.sql
diff --git a/db_release_scripts/mosip_master/sql/1.1.4_master-scripts_revoke.sql b/db_release_scripts/mosip_master/sql/1.1.4-revoke.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.4_master-scripts_revoke.sql
rename to db_release_scripts/mosip_master/sql/1.1.4-revoke.sql
diff --git a/db_release_scripts/mosip_master/sql/1.1.5_master-scripts_release.sql b/db_release_scripts/mosip_master/sql/1.1.5-release.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.5_master-scripts_release.sql
rename to db_release_scripts/mosip_master/sql/1.1.5-release.sql
diff --git a/db_release_scripts/mosip_master/sql/1.1.5_master-scripts_revoke.sql b/db_release_scripts/mosip_master/sql/1.1.5-revoke.sql
similarity index 100%
rename from db_release_scripts/mosip_master/sql/1.1.5_master-scripts_revoke.sql
rename to db_release_scripts/mosip_master/sql/1.1.5-revoke.sql
diff --git a/db_release_scripts/mosip_master/sql/1.2_master-scripts_release.sql b/db_release_scripts/mosip_master/sql/1.2.0-release.sql
similarity index 63%
rename from db_release_scripts/mosip_master/sql/1.2_master-scripts_release.sql
rename to db_release_scripts/mosip_master/sql/1.2.0-release.sql
index 89fc330cdfb..f56e69fe67d 100644
--- a/db_release_scripts/mosip_master/sql/1.2_master-scripts_release.sql
+++ b/db_release_scripts/mosip_master/sql/1.2.0-release.sql
@@ -1,6 +1,6 @@
-- ---------------------------------------------------------------------------------------------------------
-- Database Name: mosip_master
--- Release Version : 1.2
+-- Release Version : 1.2.0
-- Purpose : Database Alter scripts for the release for Master DB.
-- Create By : Ram Bhatt
-- Created Date : March-2021
@@ -21,257 +21,204 @@
-----------------------------------------------------------------------------------------------------------------------
ALTER TABLE master.template_type ALTER COLUMN code TYPE character varying(64) ;
-ALTER TABLE master.template ALTER COLUMN template_typ_code TYPE character varying(64) ;
-
---------------------------------------------------------------------------------------------------------------------
-ALTER TABLE master.blacklisted_words DROP CONSTRAINT IF EXISTS pk_blwrd_code CASCADE;
--------------------------------------------------------------------------------------------------------------------
-\ir ../ddl/master-ui_spec.sql
-\ir ../ddl/master-blocklisted_words.sql
-
-
------ TRUNCATE master.blocklisted_words TABLE Data and It's reference Data and COPY Data from CSV file -----
-TRUNCATE TABLE master.blocklisted_words cascade ;
-
-\COPY master.blocklisted_words (word,descr,lang_code,is_active,cr_by,cr_dtimes) FROM './dml/master-blocklisted_words.csv' delimiter ',' HEADER csv;
-
-
---------------------------------------------UI SPEC TABLE CREATION-----------------------------------------------
-TRUNCATE TABLE master.ui_spec cascade ;
-
----------------------------------------------------------------------------------------------------------------------
-\COPY master.ui_spec (id,version,domain,title,description,type,json_spec,identity_schema_id,identity_schema_version,effective_from,status_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes) FROM './dml/master-ui_spec.csv' delimiter ',' HEADER csv;
------------------------------------------------------DATA LOAD FROM IDENTITY SCHEMA TABLE-----------------------------------------------
-INSERT into master.ui_spec (id,version,domain,title,description,type,json_spec,identity_schema_id,identity_schema_version,effective_from,status_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes) SELECT id,id_version,'registration-client', title,description,'schema',id_attr_json,id,id_version,effective_from,status_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes FROM master.identity_schema;
-
------------------------------------------------------------DROP COLUMN-----------------------------------------------------------------
-ALTER TABLE master.identity_schema DROP COLUMN id_attr_json;
---------------------------------------------------------------------------------------------------------------------------------------
-
-ALTER TABLE master.bulkupload_transaction ALTER COLUMN upload_description TYPE character varying;
-
------------------------------------------------ALTER FK constraints with lang code -----------------------------------------------------------
-
-ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_dspec CASCADE;
-ALTER TABLE master.device_master ADD CONSTRAINT fk_devicem_dspec FOREIGN KEY (dspec_id)
-REFERENCES master.device_spec (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
+ALTER TABLE master.template ALTER COLUMN template_typ_code TYPE character varying(64) ;
+SELECT * INTO master.template_migr_bkp FROM master.template;
-ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_zone CASCADE;
-ALTER TABLE master.device_master ADD CONSTRAINT fk_devicem_zone FOREIGN KEY (zone_code)
-REFERENCES master.zone (code) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
+ALTER TABLE master.template DROP CONSTRAINT IF EXISTS fk_tmplt_moddtl CASCADE;
+SELECT * INTO master.module_detail_migr_bkp FROM master.module_detail;
-ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_center CASCADE;
-ALTER TABLE master.device_master ADD CONSTRAINT fk_devicem_center FOREIGN KEY (regcntr_id)
-REFERENCES master.registration_center (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
+TRUNCATE TABLE master.module_detail cascade ;
+\COPY master.module_detail (id,name,descr,lang_code,is_active,cr_by,cr_dtimes) FROM './dml/master-module_detail.csv' delimiter ',' HEADER csv;
-ALTER TABLE master.device_spec DROP CONSTRAINT IF EXISTS fk_dspec_dtyp CASCADE;
-ALTER TABLE master.device_spec ADD CONSTRAINT fk_dspec_dtyp FOREIGN KEY (dtyp_code)
-REFERENCES master.device_type (code) MATCH SIMPLE
+ALTER TABLE master.template ADD CONSTRAINT fk_tmplt_moddtl FOREIGN KEY (module_id,lang_code)
+REFERENCES master.module_detail (id,lang_code) MATCH SIMPLE
ON DELETE NO ACTION ON UPDATE NO ACTION;
+-- cleanup to map only registration-client related templates with 10002 moduleId and
+-- other reg email and sms templates mapped to 10002 is remapped to pre-reg moduleId 10001
+-- This cleanup is performed to avoid un-related templates to get synced in reg-client.
+UPDATE master.template set module_id='10001' where module_id='10002' and template_typ_code not like 'reg-%';
+UPDATE master.template set module_id='10002' where template_typ_code like 'reg-ack%';
+UPDATE master.template set module_id='10002' where template_typ_code like 'reg-preview%';
+UPDATE master.template set module_id='10002' where template_typ_code like 'reg-dashboard%';
+--------------------------------------------------------------------------------------------------------------------
+ALTER TABLE master.blacklisted_words DROP CONSTRAINT IF EXISTS pk_blwrd_code CASCADE;
+\ir ./ddl/master-blocklisted_words.sql
+ALTER TABLE master.blocklisted_words DROP CONSTRAINT IF EXISTS pk_blwrd_code CASCADE;
+ALTER TABLE master.blocklisted_words ALTER COLUMN lang_code DROP NOT NULL;
+INSERT into master.blocklisted_words (word,descr,lang_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes) SELECT distinct word,descr,lang_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes FROM master.blacklisted_words;
+DELETE FROM master.blocklisted_words where lang_code!=:'primary_language_code';
+ALTER TABLE master.blocklisted_words ADD CONSTRAINT pk_blwrd_code PRIMARY KEY (word);
-ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_mspec CASCADE;
-ALTER TABLE master.machine_master ADD CONSTRAINT fk_machm_mspec FOREIGN KEY (mspec_id)
-REFERENCES master.machine_spec (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
-
-
+-------------------------------------------UI SPEC TABLE ----------------------------------------------
-ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_zone CASCADE;
-ALTER TABLE master.machine_master ADD CONSTRAINT fk_machm_zone FOREIGN KEY (zone_code)
-REFERENCES master.zone (code) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
+SELECT * INTO master.identity_schema_migr_bkp FROM master.identity_schema;
+\ir ./ddl/master-ui_spec.sql
+TRUNCATE TABLE master.ui_spec cascade;
+INSERT into master.ui_spec (id,version,domain,title,description,type,json_spec,identity_schema_id,identity_schema_version,effective_from,status_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes) SELECT id,id_version,'registration-client', title,description,'schema',id_attr_json,id,id_version,effective_from,status_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes FROM master.identity_schema;
+ALTER TABLE master.ui_spec ALTER COLUMN version TYPE numeric(5,3);
+ALTER TABLE master.ui_spec ALTER COLUMN identity_schema_version TYPE numeric(5,3);
-ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_center CASCADE;
-ALTER TABLE master.machine_master ADD CONSTRAINT fk_machm_center FOREIGN KEY (regcntr_id)
-REFERENCES master.registration_center (id) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
+ALTER TABLE master.identity_schema DROP COLUMN id_attr_json;
+--------------------------------------------------------------------------------------------------------------------------------------
+ALTER TABLE master.bulkupload_transaction ALTER COLUMN upload_description TYPE character varying;
+-----------------------------------------------ALTER FK constraints with lang code -----------------------------------------------------------
-ALTER TABLE master.machine_spec DROP CONSTRAINT IF EXISTS fk_mspec_mtyp CASCADE;
-ALTER TABLE master.machine_spec ADD CONSTRAINT fk_mspec_mtyp FOREIGN KEY (mtyp_code)
-REFERENCES master.machine_type (code) MATCH SIMPLE
-ON DELETE NO ACTION ON UPDATE NO ACTION;
+SELECT * INTO master.biometric_type_migr_bkp FROM master.biometric_type;
+ALTER TABLE master.biometric_type DROP CONSTRAINT IF EXISTS pk_bmtyp_code CASCADE;
+ALTER TABLE master.biometric_type ALTER COLUMN lang_code DROP NOT NULL;
+DELETE FROM master.biometric_type where lang_code!=:'primary_language_code';
+ALTER TABLE master.biometric_type ADD CONSTRAINT pk_bmtyp_code PRIMARY KEY (code);
ALTER TABLE master.biometric_attribute DROP CONSTRAINT IF EXISTS fk_bmattr_bmtyp CASCADE;
ALTER TABLE master.biometric_attribute ADD CONSTRAINT fk_bmattr_bmtyp FOREIGN KEY (bmtyp_code)
REFERENCES master.biometric_type (code) MATCH SIMPLE
ON DELETE NO ACTION ON UPDATE NO ACTION;
-ALTER TABLE master.zone_user DROP CONSTRAINT IF EXISTS fk_zoneuser_zone CASCADE;
-ALTER TABLE master.zone_user ADD CONSTRAINT fk_zoneuser_zone FOREIGN KEY (zone_code)
-REFERENCES master.zone (code) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
-
-
-ALTER TABLE master.reg_working_nonworking DROP CONSTRAINT IF EXISTS fk_rwn_daycode CASCADE;
-ALTER TABLE master.reg_working_nonworking ADD CONSTRAINT fk_rwn_daycode FOREIGN KEY (day_code)
-REFERENCES master.daysofweek_list (code) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
-
-
-
-ALTER TABLE master.reg_working_nonworking DROP CONSTRAINT IF EXISTS fk_rwn_regcntr CASCADE;
-ALTER TABLE master.reg_working_nonworking ADD CONSTRAINT fk_rwn_regcntr FOREIGN KEY (regcntr_id)
-REFERENCES master.registration_center (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
-
+SELECT * INTO master.reg_exceptional_holiday_migr_bkp FROM master.reg_exceptional_holiday;
ALTER TABLE master.reg_exceptional_holiday DROP CONSTRAINT IF EXISTS fk_regeh_regcntr CASCADE;
-ALTER TABLE master.reg_exceptional_holiday ADD CONSTRAINT fk_regeh_regcntr FOREIGN KEY (regcntr_id)
-REFERENCES master.registration_center (id) MATCH FULL
-ON DELETE NO ACTION ON UPDATE NO ACTION;
-
-
-ALTER TABLE master.device_master_h DROP CONSTRAINT IF EXISTS pk_devicem_h_id CASCADE;
-ALTER TABLE master.device_master_h ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.device_master_h ADD CONSTRAINT pk_devicem_h_id PRIMARY KEY (id,eff_dtimes);
+ALTER TABLE master.reg_exceptional_holiday DROP CONSTRAINT IF EXISTS pk_exceptional_hol;
+DELETE FROM master.reg_exceptional_holiday where lang_code!=:'primary_language_code';
+ALTER TABLE master.reg_exceptional_holiday ALTER COLUMN lang_code DROP NOT NULL;
+ALTER TABLE master.reg_exceptional_holiday ADD CONSTRAINT pk_exceptional_hol PRIMARY KEY (regcntr_id,hol_date);
-ALTER TABLE master.machine_master_h DROP CONSTRAINT IF EXISTS pk_machm_h_id CASCADE;
-ALTER TABLE master.machine_master_h ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.machine_master_h ADD CONSTRAINT pk_machm_h_id PRIMARY KEY (id,eff_dtimes);
+-----------------------------------------------------------------------------------------------------------------------
-ALTER TABLE master.user_detail_h DROP CONSTRAINT IF EXISTS pk_usrdtl_h_id CASCADE;
ALTER TABLE master.user_detail_h ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.user_detail_h ADD CONSTRAINT pk_usrdtl_h_id PRIMARY KEY (id,eff_dtimes);
-
-
---------------------------------------------------------------DROP CONSTRAINTS-------------------------------------------
-
-ALTER TABLE master.dynamic_field DROP CONSTRAINT IF EXISTS uk_schfld_name;
-
+ALTER TABLE master.user_detail_h ALTER COLUMN status_code DROP NOT NULL;
ALTER TABLE master.user_detail ALTER COLUMN status_code DROP NOT NULL;
ALTER TABLE master.user_detail ALTER COLUMN name DROP NOT NULL;
ALTER TABLE master.user_detail ALTER COLUMN lang_code DROP NOT NULL;
-
ALTER TABLE master.user_detail DROP CONSTRAINT IF EXISTS fk_usrdtl_center CASCADE;
+ALTER TABLE master.zone_user ALTER COLUMN lang_code DROP NOT NULL;
ALTER TABLE master.zone_user DROP CONSTRAINT IF EXISTS fk_zoneuser_zone CASCADE;
+ALTER TABLE master.user_detail DROP COLUMN uin;
+ALTER TABLE master.user_detail DROP COLUMN email;
+ALTER TABLE master.user_detail DROP COLUMN mobile;
+ALTER TABLE master.user_detail_h DROP COLUMN uin;
+ALTER TABLE master.user_detail_h DROP COLUMN email;
+ALTER TABLE master.user_detail_h DROP COLUMN mobile;
---------------------------------------------LANG CODE NULLABLE AND CHANGE PK CONSTRAINTS ---------------------------------
-ALTER TABLE master.app_authentication_method DROP CONSTRAINT IF EXISTS pk_appauthm_id;
-ALTER TABLE master.app_authentication_method ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.app_authentication_method ADD CONSTRAINT pk_appauthm_id PRIMARY KEY (app_id,process_id,role_code,auth_method_code);
+ALTER TABLE master.dynamic_field DROP CONSTRAINT IF EXISTS uk_schfld_name;
+ALTER TABLE master.app_authentication_method ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.app_role_priority DROP CONSTRAINT IF EXISTS pk_roleprt_id;
ALTER TABLE master.app_role_priority ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.app_role_priority ADD CONSTRAINT pk_roleprt_id PRIMARY KEY (app_id,process_id,role_code);
-
-ALTER TABLE master.applicant_valid_document DROP CONSTRAINT IF EXISTS pk_avaldoc_code;
-ALTER TABLE master.applicant_valid_document ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.applicant_valid_document ADD CONSTRAINT pk_avaldoc_code PRIMARY KEY (apptyp_code,doccat_code,doctyp_code);
-
-ALTER TABLE master.authentication_method DROP CONSTRAINT IF EXISTS pk_authm_code;
-ALTER TABLE master.authentication_method ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.authentication_method ADD CONSTRAINT pk_authm_code PRIMARY KEY (code);
+--------------------------------------------------------------------------------------------------------
-ALTER TABLE master.biometric_type DROP CONSTRAINT IF EXISTS pk_bmtyp_code;
-ALTER TABLE master.biometric_type ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.biometric_type ADD CONSTRAINT pk_bmtyp_code PRIMARY KEY (code);
-
+SELECT * INTO master.device_spec_migr_bkp FROM master.device_spec;
+SELECT * INTO master.device_type_migr_bkp FROM master.device_type;
+SELECT * INTO master.device_master_migr_bkp FROM master.device_master;
+ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_zone CASCADE;
+ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_dspec CASCADE;
+ALTER TABLE master.device_spec DROP CONSTRAINT IF EXISTS fk_dspec_dtyp CASCADE;
+ALTER TABLE master.device_type DROP CONSTRAINT IF EXISTS pk_dtyp_code;
+ALTER TABLE master.device_spec DROP CONSTRAINT IF EXISTS pk_dspec_code;
ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS pk_devicem_id;
+ALTER TABLE master.device_type ALTER COLUMN lang_code DROP NOT NULL;
+ALTER TABLE master.device_spec ALTER COLUMN lang_code DROP NOT NULL;
ALTER TABLE master.device_master ALTER COLUMN lang_code DROP NOT NULL;
+DELETE FROM master.device_type where lang_code!=:'primary_language_code';
+DELETE FROM master.device_spec where lang_code!=:'primary_language_code';
+ALTER TABLE master.device_type ADD CONSTRAINT pk_dtyp_code PRIMARY KEY (code);
+ALTER TABLE master.device_spec ADD CONSTRAINT pk_dspec_code PRIMARY KEY (id);
+ALTER TABLE master.device_spec ADD CONSTRAINT fk_dspec_dtyp FOREIGN KEY (dtyp_code)
+REFERENCES master.device_type (code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+DELETE FROM master.device_master where lang_code!=:'primary_language_code';
ALTER TABLE master.device_master ADD CONSTRAINT pk_devicem_id PRIMARY KEY (id);
+ALTER TABLE master.device_master ADD CONSTRAINT fk_devicem_dspec FOREIGN KEY (dspec_id)
+REFERENCES master.device_spec (id) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
-ALTER TABLE master.device_spec DROP CONSTRAINT IF EXISTS pk_dspec_code;
-ALTER TABLE master.device_spec ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.device_spec ADD CONSTRAINT pk_dspec_code PRIMARY KEY (id);
-
+DELETE FROM master.device_master_h where lang_code!=:'primary_language_code';
+ALTER TABLE master.device_master_h DROP CONSTRAINT IF EXISTS pk_devicem_h_id CASCADE;
+ALTER TABLE master.device_master_h ALTER COLUMN lang_code DROP NOT NULL;
+ALTER TABLE master.device_master_h ADD CONSTRAINT pk_devicem_h_id PRIMARY KEY (id,eff_dtimes);
-ALTER TABLE master.device_type DROP CONSTRAINT IF EXISTS pk_dtyp_code;
-ALTER TABLE master.device_type ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.device_type ADD CONSTRAINT pk_dtyp_code PRIMARY KEY (code);
+-------------------------------------------------------------------------------------------------------
-ALTER TABLE master.device_type DROP CONSTRAINT IF EXISTS pk_dtyp_code;
-ALTER TABLE master.device_type ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.device_type ADD CONSTRAINT pk_dtyp_code PRIMARY KEY (code);
+SELECT * INTO master.machine_spec_migr_bkp FROM master.machine_spec;
+SELECT * INTO master.machine_type_migr_bkp FROM master.machine_type;
+SELECT * INTO master.machine_master_migr_bkp FROM master.machine_master;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_mspec CASCADE;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_zone CASCADE;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_center CASCADE;
+ALTER TABLE master.machine_spec DROP CONSTRAINT IF EXISTS fk_mspec_mtyp CASCADE;
+ALTER TABLE master.machine_type DROP CONSTRAINT IF EXISTS pk_mtyp_code;
+ALTER TABLE master.machine_spec DROP CONSTRAINT IF EXISTS pk_mspec_code;
ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS pk_machm_id;
+ALTER TABLE master.machine_type ALTER COLUMN lang_code DROP NOT NULL;
ALTER TABLE master.machine_master ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.machine_master ADD CONSTRAINT pk_machm_id PRIMARY KEY (id);
-
-
-ALTER TABLE master.machine_spec DROP CONSTRAINT IF EXISTS pk_mspec_code;
ALTER TABLE master.machine_spec ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.machine_spec ADD CONSTRAINT pk_mspec_code PRIMARY KEY (id);
-
-
-ALTER TABLE master.machine_type DROP CONSTRAINT IF EXISTS pk_mtyp_code;
-ALTER TABLE master.machine_type ALTER COLUMN lang_code DROP NOT NULL;
+DELETE FROM master.machine_type where lang_code!=:'primary_language_code';
+DELETE FROM master.machine_spec where lang_code!=:'primary_language_code';
+DELETE FROM master.machine_master where lang_code!=:'primary_language_code';
ALTER TABLE master.machine_type ADD CONSTRAINT pk_mtyp_code PRIMARY KEY (code);
+ALTER TABLE master.machine_spec ADD CONSTRAINT pk_mspec_code PRIMARY KEY (id);
+ALTER TABLE master.machine_master ADD CONSTRAINT pk_machm_id PRIMARY KEY (id);
+ALTER TABLE master.machine_spec ADD CONSTRAINT fk_mspec_mtyp FOREIGN KEY (mtyp_code)
+REFERENCES master.machine_type (code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+ALTER TABLE master.machine_master ADD CONSTRAINT fk_machm_mspec FOREIGN KEY (mspec_id)
+REFERENCES master.machine_spec (id) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+DELETE FROM master.machine_master_h where lang_code!=:'primary_language_code';
+ALTER TABLE master.machine_master_h DROP CONSTRAINT IF EXISTS pk_machm_h_id CASCADE;
+ALTER TABLE master.machine_master_h ALTER COLUMN lang_code DROP NOT NULL;
+ALTER TABLE master.machine_master_h ADD CONSTRAINT pk_machm_h_id PRIMARY KEY (id,eff_dtimes);
-ALTER TABLE master.reg_exceptional_holiday DROP CONSTRAINT IF EXISTS pk_exceptional_hol;
-ALTER TABLE master.reg_exceptional_holiday ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.reg_exceptional_holiday ADD CONSTRAINT pk_exceptional_hol PRIMARY KEY (regcntr_id,hol_date);
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS uq_machm_name;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS uq_machm_key_index;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS uq_machm_skey_index;
-ALTER TABLE master.reg_working_nonworking DROP CONSTRAINT IF EXISTS pk_working_nonworking;
-ALTER TABLE master.reg_working_nonworking ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.reg_working_nonworking ADD CONSTRAINT pk_working_nonworking PRIMARY KEY (regcntr_id,day_code);
+SELECT * INTO master.machine_master_migr_dupes FROM (SELECT *, count(*) OVER (PARTITION BY name) AS count FROM machine_master) machine_master_count WHERE machine_master_count.count > 1;
+DELETE FROM machine_master WHERE id IN (SELECT id FROM (SELECT id, ROW_NUMBER() OVER( PARTITION BY name ORDER BY id ) AS row_num FROM machine_master ) t WHERE t.row_num > 1 );
-ALTER TABLE master.zone_user DROP CONSTRAINT IF EXISTS pk_tmpltyp_code;
-ALTER TABLE master.zone_user ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.user_detail_h ALTER COLUMN status_code DROP NOT NULL;
-ALTER TABLE master.zone_user ADD CONSTRAINT pk_zoneuser PRIMARY KEY (usr_id);
ALTER TABLE master.machine_master ADD CONSTRAINT uq_machm_name UNIQUE (name);
ALTER TABLE master.machine_master ADD CONSTRAINT uq_machm_key_index UNIQUE (key_index);
ALTER TABLE master.machine_master ADD CONSTRAINT uq_machm_skey_index UNIQUE (sign_key_index);
-ALTER TABLE master.loc_holiday DROP CONSTRAINT IF EXISTS pk_lochol_id;
-ALTER TABLE master.loc_holiday ADD CONSTRAINT pk_lochol_id PRIMARY KEY (holiday_date, location_code, lang_code);
-ALTER TABLE master.batch_job_execution_params ALTER COLUMN string_val TYPE varchar(5000) USING string_val::varchar;
-ALTER TABLE master.blocklisted_words DROP CONSTRAINT IF EXISTS pk_blwrd_code;
-ALTER TABLE master.blocklisted_words ALTER COLUMN lang_code DROP NOT NULL;
-ALTER TABLE master.blocklisted_words ADD CONSTRAINT pk_blwrd_code PRIMARY KEY (word);
-ALTER TABLE master.batch_job_execution_params ALTER COLUMN string_val TYPE varchar(5000) USING string_val::varchar;
-
-ALTER TABLE master.user_detail DROP COLUMN uin;
-ALTER TABLE master.user_detail DROP COLUMN email;
-ALTER TABLE master.user_detail DROP COLUMN mobile;
-
-ALTER TABLE master.user_detail_h DROP COLUMN uin;
-ALTER TABLE master.user_detail_h DROP COLUMN email;
-ALTER TABLE master.user_detail_h DROP COLUMN mobile;
+----------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------template,template_type and module_detail----------------------------------------------------------
-
-TRUNCATE TABLE master.module_detail cascade ;
-
-\COPY master.module_detail (id,name,descr,lang_code,is_active,cr_by,cr_dtimes) FROM './dml/master-module_detail.csv' delimiter ',' HEADER csv;
+ALTER TABLE master.batch_job_execution_params ALTER COLUMN string_val TYPE varchar(5000) USING string_val::varchar;
----------------------------------------------CREATION OF PERMITTED LOCAL CONFIG -------------------------------------------------------------
-\ir ../ddl/master-permitted_local_config.sql
+\ir ./ddl/master-permitted_local_config.sql
---------------------------------------------------------------------------------------------------------------------------------------------
+-------------------------------------------------------------------------------------------------------------------------------------------
+SELECT * INTO master.loc_holiday_migr_bkp FROM master.loc_holiday;
------------------------------------------------ ALTER TABLE OF MASTER UI SPEC TABLE----------------------------------------------------------
+ALTER TABLE master.loc_holiday DROP CONSTRAINT IF EXISTS pk_lochol_id;
-ALTER TABLE master.ui_spec ALTER COLUMN version TYPE numeric(5,3);
-ALTER TABLE master.ui_spec ALTER COLUMN identity_schema_version TYPE numeric(5,3);
+SELECT * INTO master.loc_holiday_migr_dupes FROM (SELECT *, count(*) OVER (PARTITION BY holiday_date, location_code, lang_code) AS count FROM loc_holiday) loc_holiday_count WHERE loc_holiday_count.count > 1;
+DELETE FROM loc_holiday WHERE id IN (SELECT id FROM (SELECT id, ROW_NUMBER() OVER( PARTITION BY holiday_date, location_code, lang_code ORDER BY id ) AS row_num FROM loc_holiday ) t WHERE t.row_num > 1 );
+
+ALTER TABLE master.loc_holiday ADD CONSTRAINT pk_lochol_id PRIMARY KEY (holiday_date, location_code, lang_code);
-------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/db_release_scripts/mosip_master/sql/1.2.0-revoke.sql b/db_release_scripts/mosip_master/sql/1.2.0-revoke.sql
new file mode 100644
index 00000000000..8178423d239
--- /dev/null
+++ b/db_release_scripts/mosip_master/sql/1.2.0-revoke.sql
@@ -0,0 +1,207 @@
+TRUNCATE TABLE master.template cascade ;
+
+TRUNCATE TABLE master.module_detail cascade ;
+
+INSERT INTO master.module_detail SELECT * FROM master.module_detail_migr_bkp;
+
+INSERT INTO master.template SELECT * FROM master.template_migr_bkp;
+
+DROP TABLE IF EXISTS master.module_detail_migr_bkp;
+
+DROP TABLE IF EXISTS master.template_migr_bkp;
+
+DROP TABLE IF EXISTS master.blocklisted_words;
+
+ALTER TABLE master.blacklisted_words DROP CONSTRAINT IF EXISTS pk_blwrd_code CASCADE;
+
+ALTER TABLE master.blacklisted_words ADD CONSTRAINT pk_blwrd_code PRIMARY KEY (word, lang_code);
+
+DROP TABLE IF EXISTS master.ui_spec;
+
+TRUNCATE TABLE master.identity_schema;
+
+ALTER TABLE master.identity_schema ADD COLUMN id_attr_json character varying(20480);
+
+INSERT INTO master.identity_schema(id,id_version,title,description,id_attr_json,schema_json,status_code,add_props,effective_from,lang_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes) SELECT id,id_version,title,description,id_attr_json,schema_json,status_code,add_props,effective_from,lang_code,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes FROM master.identity_schema_migr_bkp;
+
+DROP TABLE IF EXISTS master.identity_schema_migr_bkp;
+
+ALTER TABLE master.bulkupload_transaction ALTER COLUMN upload_description TYPE character varying(256);
+
+TRUNCATE TABLE master.biometric_type cascade;
+
+ALTER TABLE master.biometric_type DROP CONSTRAINT IF EXISTS pk_bmtyp_code CASCADE;
+
+ALTER TABLE master.biometric_type ALTER COLUMN lang_code set NOT NULL;
+
+ALTER TABLE master.biometric_type ADD CONSTRAINT pk_bmtyp_code PRIMARY KEY (code, lang_code);
+
+INSERT INTO master.biometric_type SELECT * FROM master.biometric_type_migr_bkp;
+
+DROP TABLE IF EXISTS master.biometric_type_migr_bkp;
+
+ALTER TABLE master.biometric_attribute DROP CONSTRAINT IF EXISTS fk_bmattr_bmtyp CASCADE;
+
+ALTER TABLE master.biometric_attribute ADD CONSTRAINT fk_bmattr_bmtyp FOREIGN KEY (bmtyp_code, lang_code)
+REFERENCES master.biometric_type (code, lang_code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+
+ALTER TABLE master.user_detail_h ALTER COLUMN lang_code set NOT NULL;
+
+ALTER TABLE master.user_detail_h ALTER COLUMN status_code set NOT NULL;
+
+ALTER TABLE master.user_detail ALTER COLUMN status_code set NOT NULL;
+
+ALTER TABLE master.user_detail ALTER COLUMN name set NOT NULL;
+
+ALTER TABLE master.user_detail ALTER COLUMN lang_code set NOT NULL;
+
+ALTER TABLE master.zone_user ALTER COLUMN lang_code set NOT NULL;
+
+ALTER TABLE master.user_detail ADD COLUMN uin character varying(28);
+
+ALTER TABLE master.user_detail ADD COLUMN email character varying(256);
+
+ALTER TABLE master.user_detail ADD COLUMN mobile character varying(16);
+
+ALTER TABLE master.user_detail_h ADD COLUMN uin character varying(28);
+
+ALTER TABLE master.user_detail_h ADD COLUMN email character varying(256);
+
+ALTER TABLE master.user_detail_h ADD COLUMN mobile character varying(16);
+
+ALTER TABLE master.app_authentication_method ALTER COLUMN lang_code set NOT NULL;
+
+ALTER TABLE master.app_role_priority ALTER COLUMN lang_code set NOT NULL;
+
+
+TRUNCATE TABLE master.reg_exceptional_holiday;
+
+ALTER TABLE master.reg_exceptional_holiday ALTER COLUMN lang_code set NOT NULL;
+
+INSERT INTO master.reg_exceptional_holiday SELECT * FROM master.reg_exceptional_holiday_migr_bkp;
+
+DROP TABLE IF EXISTS master.reg_exceptional_holiday_migr_bkp;
+
+DROP TABLE IF EXISTS master.permitted_local_config;
+
+
+------------------------------------------------
+
+ALTER TABLE master.device_type ALTER COLUMN lang_code set NOT NULL;
+ALTER TABLE master.device_spec ALTER COLUMN lang_code set NOT NULL;
+ALTER TABLE master.device_master ALTER COLUMN lang_code set NOT NULL;
+
+ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_dspec CASCADE;
+ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_zone CASCADE;
+ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS fk_devicem_center CASCADE;
+ALTER TABLE master.device_spec DROP CONSTRAINT IF EXISTS fk_dspec_dtyp CASCADE;
+
+ALTER TABLE master.device_type DROP CONSTRAINT IF EXISTS pk_dtyp_code;
+ALTER TABLE master.device_spec DROP CONSTRAINT IF EXISTS pk_dspec_code;
+ALTER TABLE master.device_master DROP CONSTRAINT IF EXISTS pk_devicem_id;
+
+ALTER TABLE master.device_type ADD CONSTRAINT pk_dtyp_code PRIMARY KEY (code, lang_code);
+ALTER TABLE master.device_spec ADD CONSTRAINT pk_dspec_code PRIMARY KEY (id, lang_code);
+ALTER TABLE master.device_master ADD CONSTRAINT pk_devicem_id PRIMARY KEY (id,lang_code);
+
+ALTER TABLE master.device_spec ADD CONSTRAINT fk_dspec_dtyp FOREIGN KEY (dtyp_code,lang_code)
+REFERENCES master.device_type (code,lang_code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+ALTER TABLE master.device_master ADD CONSTRAINT fk_devicem_dspec FOREIGN KEY (dspec_id,lang_code)
+REFERENCES master.device_spec (id,lang_code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+ALTER TABLE master.device_master ADD CONSTRAINT fk_devicem_zone FOREIGN KEY (zone_code,lang_code)
+REFERENCES master.zone (code,lang_code) MATCH FULL
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+ALTER TABLE master.device_master ADD CONSTRAINT fk_devicem_center FOREIGN KEY (regcntr_id,lang_code)
+REFERENCES master.registration_center (id,lang_code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+truncate table master.device_master cascade;
+truncate table master.device_spec cascade;
+truncate table master.device_type cascade;
+
+INSERT INTO master.device_type SELECT * FROM master.device_type_migr_bkp;
+INSERT INTO master.device_spec SELECT * FROM master.device_spec_migr_bkp;
+INSERT INTO master.device_master SELECT * FROM master.device_master_migr_bkp;
+
+DROP TABLE IF EXISTS master.device_type_migr_bkp;
+DROP TABLE IF EXISTS master.device_spec_migr_bkp;
+DROP TABLE IF EXISTS master.device_master_migr_bkp;
+
+----------------------------------------------------------
+
+ALTER TABLE master.machine_type ALTER COLUMN lang_code set NOT NULL;
+ALTER TABLE master.machine_spec ALTER COLUMN lang_code set NOT NULL;
+ALTER TABLE master.machine_master ALTER COLUMN lang_code set NOT NULL;
+
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_mspec CASCADE;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_zone CASCADE;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS fk_machm_center CASCADE;
+ALTER TABLE master.machine_spec DROP CONSTRAINT IF EXISTS fk_mspec_mtyp CASCADE;
+
+ALTER TABLE master.machine_type DROP CONSTRAINT IF EXISTS pk_mtyp_code;
+ALTER TABLE master.machine_spec DROP CONSTRAINT IF EXISTS pk_mspec_code;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS pk_machm_id;
+
+ALTER TABLE master.machine_type ADD CONSTRAINT pk_mtyp_code PRIMARY KEY (code, lang_code);
+ALTER TABLE master.machine_spec ADD CONSTRAINT pk_mspec_code PRIMARY KEY (id, lang_code);
+ALTER TABLE master.machine_master ADD CONSTRAINT pk_machm_id PRIMARY KEY (id, lang_code);
+
+ALTER TABLE master.machine_spec ADD CONSTRAINT fk_mspec_mtyp FOREIGN KEY (mtyp_code,lang_code)
+REFERENCES master.machine_type (code,lang_code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+ALTER TABLE master.machine_master ADD CONSTRAINT fk_machm_mspec FOREIGN KEY (mspec_id,lang_code)
+REFERENCES master.machine_spec (id,lang_code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+ALTER TABLE master.machine_master ADD CONSTRAINT fk_machm_zone FOREIGN KEY (zone_code,lang_code)
+REFERENCES master.zone (code,lang_code) MATCH FULL
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+ALTER TABLE master.machine_master ADD CONSTRAINT fk_machm_center FOREIGN KEY (regcntr_id,lang_code)
+REFERENCES master.registration_center (id,lang_code) MATCH SIMPLE
+ON DELETE NO ACTION ON UPDATE NO ACTION;
+
+truncate table master.machine_master cascade;
+truncate table master.machine_spec cascade;
+truncate table master.machine_type cascade;
+
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS uq_machm_name;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS uq_machm_key_index;
+ALTER TABLE master.machine_master DROP CONSTRAINT IF EXISTS uq_machm_skey_index;
+
+INSERT INTO master.machine_type SELECT * FROM master.machine_type_migr_bkp;
+INSERT INTO master.machine_spec SELECT * FROM master.machine_spec_migr_bkp;
+INSERT INTO master.machine_master SELECT * FROM master.machine_master_migr_bkp;
+
+DROP TABLE IF EXISTS master.machine_type_migr_bkp;
+DROP TABLE IF EXISTS master.machine_spec_migr_bkp;
+DROP TABLE IF EXISTS master.machine_master_migr_bkp;
+DROP TABLE IF EXISTS master.machine_master_migr_dupes;
+
+--------------------------------------------------------------------------------------------
+
+truncate table master.loc_holiday cascade;
+
+ALTER TABLE master.loc_holiday DROP CONSTRAINT IF EXISTS pk_lochol_id;
+
+ALTER TABLE master.loc_holiday ADD CONSTRAINT pk_lochol_id PRIMARY KEY (id,location_code,lang_code);
+
+INSERT INTO master.loc_holiday SELECT * FROM master.loc_holiday_migr_bkp;
+
+DROP TABLE IF EXISTS master.loc_holiday_migr_dupes;
+
+DROP TABLE IF EXISTS master.loc_holiday_migr_bkp;
+
+-----------------------------------------------------------------------------------
+
+
+
+
diff --git a/db_release_scripts/mosip_master/sql/1.2_master-scripts_revoke.sql b/db_release_scripts/mosip_master/sql/1.2_master-scripts_revoke.sql
deleted file mode 100644
index dff0692ea99..00000000000
--- a/db_release_scripts/mosip_master/sql/1.2_master-scripts_revoke.sql
+++ /dev/null
@@ -1,37 +0,0 @@
--- --------------------------------------------------------------------------------------------------------
--- Database Name: mosip_master
--- Release Version : 1.1.5
--- Purpose : Revoking Database Alter deployement done for release in Master DB.
--- Create By : Ram Bhatt
--- Created Date : Jan-2021
---
--- Modified Date Modified By Comments / Remarks
--- -----------------------------------------------------------------------------------------------------------
-
--- -----------------------------------------------------------------------------------------------------------
-\c mosip_master sysadmin
-
-DROP TABLE master.ui_spec;
-
-ALTER TABLE master.identity_schema ADD COLUMN id_attr_json character varying;
-
-
-UPDATE TABLE master.identity_schema SET id_attr_json ='[{"id":"IDSchemaVersion","description":"ID Schema Version","label":{"eng":"IDSchemaVersion"},"type":"number","minimum":0,"maximum":0,"controlType":null,"fieldType":"default","format":"none","fieldCategory":"none","inputRequired":false,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"IdSchemaVersion","contactType":null,"group":null,"alignmentGroup":null,"visible":null,"changeAction":null,"required":true},{"id":"UIN","description":"UIN","label":{"eng":"UIN"},"type":"string","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"none","inputRequired":false,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"UIN","contactType":null,"group":null,"alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"fullName","description":"Full Name","label":{"ara":"الاسم الكامل","eng":"Full Name","fra":"Nom complet"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(?=.{3,50}$).*","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"name","contactType":null,"group":"FullName","alignmentGroup":null,"visible":null,"changeAction":null,"required":true},{"id":"dateOfBirth","description":"dateOfBirth","label":{"ara":"الاسم الكامل","eng":"DOB","fra":"DOB"},"type":"string","minimum":0,"maximum":0,"controlType":"ageDate","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(1869|18[7-9][0-9]|19[0-9][0-9]|20[0-9][0-9])/([0][1-9]|1[0-2])/([0][1-9]|[1-2][0-9]|3[01])$","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"identity.isNew || (identity.isUpdate && (identity.updatableFieldGroups contains ''GuardianDetails'' || identity.updatableFieldGroups contains ''DateOfBirth''))"}],"subType":"dateOfBirth","contactType":null,"group":"DateOfBirth","alignmentGroup":null,"visible":null,"changeAction":null,"required":true},{"id":"gender","description":"gender","label":{"ara":"الاسم الكامل","eng":"Gender","fra":"Le genre"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"dynamic","format":"","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"gender","contactType":null,"group":"Gender","alignmentGroup":"group1","visible":null,"changeAction":null,"required":true},{"id":"addressLine1","description":"addressLine1","label":{"ara":"الاسم الكامل","eng":"line1","fra":"line1"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(?=.{0,50}$).*","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"addressLine1","contactType":"Postal","group":"Address","alignmentGroup":"address","visible":null,"changeAction":null,"required":true},{"id":"addressLine2","description":"addressLine2","label":{"ara":"الاسم الكامل","eng":"line2","fra":"line2"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(?=.{3,50}$).*","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"addressLine2","contactType":"Postal","group":"Address","alignmentGroup":"address","visible":null,"changeAction":null,"required":true},{"id":"addressLine3","description":"addressLine3","label":{"ara":"الاسم الكامل","eng":"line3","fra":"line3"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(?=.{3,50}$).*","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"addressLine3","contactType":"Postal","group":"Address","alignmentGroup":"address","visible":null,"changeAction":null,"required":true},{"id":"residenceStatus","description":"residenceStatus","label":{"ara":"الاسم الكامل","eng":"Residence Status","fra":"Reside Status"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"dynamic","format":"none","fieldCategory":"kyc","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"residenceStatus","contactType":null,"group":"ResidenceStatus","alignmentGroup":"group1","visible":null,"changeAction":null,"required":false},{"id":"referenceIdentityNumber","description":"referenceIdentityNumber","label":{"ara":"الاسم الكامل","eng":"Reference Identity Number","fra":"Reference Identity Number"},"type":"string","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"kyc","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^([0-9]{10,30})$","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"none","contactType":null,"group":"ReferenceIdentityNumber","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"region","description":"region","label":{"ara":"الاسم الكامل","eng":"Region","fra":"Region"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(?=.{0,50}$).*","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"Region","contactType":"Postal","group":"Location","alignmentGroup":"location","visible":null,"changeAction":null,"required":true},{"id":"province","description":"province","label":{"ara":"الاسم الكامل","eng":"Province","fra":"Province"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(?=.{0,50}$).*","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"Province","contactType":"Postal","group":"Location","alignmentGroup":"location","visible":null,"changeAction":null,"required":true},{"id":"city","description":"city","label":{"ara":"الاسم الكامل","eng":"City","fra":"City"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^(?=.{0,50}$).*","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"City","contactType":"Postal","group":"Location","alignmentGroup":"location","visible":null,"changeAction":null,"required":true},{"id":"zone","description":"zone","label":{"ara":"الاسم الكامل","eng":"Zone","fra":"Zone"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"Zone","contactType":null,"group":"Location","alignmentGroup":"location","visible":null,"changeAction":null,"required":true},{"id":"postalCode","description":"postalCode","label":{"ara":"الاسم الكامل","eng":"Postal","fra":"Postal"},"type":"string","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^[(?i)A-Z0-9]{5}$|^NA$","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"Postal Code","contactType":"Postal","group":"Location","alignmentGroup":"location","visible":null,"changeAction":null,"required":true},{"id":"phone","description":"phone","label":{"ara":"الاسم الكامل","eng":"Phone","fra":"Phone"},"type":"string","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^[+]*([0-9]{1})([0-9]{9})$","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"Phone","contactType":"email","group":"Phone","alignmentGroup":"contact","visible":null,"changeAction":null,"required":true},{"id":"email","description":"email","label":{"ara":"الاسم الكامل","eng":"Email","fra":"Email"},"type":"string","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[{"type":"regex","validator":"^[A-Za-z0-9_\\-]+(\\.[A-Za-z0-9_]+)*@[A-Za-z0-9_-]+(\\.[A-Za-z0-9_]+)*(\\.[a-zA-Z]{2,})$","arguments":[],"langCode":null}],"bioAttributes":null,"requiredOn":[],"subType":"Email","contactType":"email","group":"Email","alignmentGroup":"contact","visible":null,"changeAction":null,"required":true},{"id":"modeOfClaim","description":"Mode of Claim","label":{"ara":"الاسم الكامل","eng":"Mode of claim","fra":"Mode of Claim"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"dropdown","fieldType":"dynamic","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"modeOfClaim","contactType":null,"group":"modeOfClaim","alignmentGroup":"contact","visible":null,"changeAction":null,"required":true},{"id":"parentOrGuardianName","description":"parentOrGuardianName","label":{"ara":"الاسم الكامل","eng":"Parent Name","fra":"Parent Name"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"evidence","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"( identity.isNew && identity.isChild ) || ( identity.isUpdate && identity.isChild )"}],"subType":"parentOrGuardianName","contactType":null,"group":"GuardianDetails","alignmentGroup":"introducer","visible":{"engine":"MVEL","expr":"( identity.isNew && identity.isChild ) || ( identity.isUpdate && identity.isChild )"},"changeAction":null,"required":false},{"id":"parentOrGuardianRID","description":"parentOrGuardianRID","label":{"ara":"الاسم الكامل","eng":"Parent RID","fra":"Parent RID"},"type":"string","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"evidence","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"( identity.isChild && (identity.parentOrGuardianUIN == nil || identity.parentOrGuardianUIN == empty) )"}],"subType":"RID","contactType":null,"group":"GuardianDetails","alignmentGroup":"introducer","visible":{"engine":"MVEL","expr":"( identity.isChild && (identity.parentOrGuardianUIN == nil || identity.parentOrGuardianUIN == empty) )"},"changeAction":null,"required":false},{"id":"parentOrGuardianUIN","description":"parentOrGuardianUIN","label":{"ara":"الاسم الكامل","eng":"Parent UIn","fra":"Parent UIN"},"type":"string","minimum":0,"maximum":0,"controlType":"textbox","fieldType":"default","format":"none","fieldCategory":"evidence","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"( identity.isChild && (identity.parentOrGuardianRID == nil || identity.parentOrGuardianRID == empty) )"}],"subType":"UIN","contactType":null,"group":"GuardianDetails","alignmentGroup":"introducer","visible":{"engine":"MVEL","expr":"( identity.isChild && (identity.parentOrGuardianRID == nil || identity.parentOrGuardianRID == empty) )"},"changeAction":null,"required":false},{"id":"proofOfAddress","description":"proofOfAddress","label":{"ara":"إثبات العنوان","eng":"Address Proof","fra":"Address Proof"},"type":"documentType","minimum":0,"maximum":0,"controlType":"fileupload","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"identity.isNew || ( identity.isUpdate && (identity.updatableFields contains ''addressLine1'' || identity.updatableFields contains ''addressLine2'' || identity.updatableFields contains ''addressLine3''))"}],"subType":"POA","contactType":null,"group":"Documents","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"proofOfIdentity","description":"proofOfIdentity","label":{"ara":"إثبات الهوية","eng":"Identity Proof","fra":"Identity Proof"},"type":"documentType","minimum":0,"maximum":0,"controlType":"fileupload","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"identity.isNew || ( identity.isUpdate && identity.updatableFields contains ''fullName'')"}],"subType":"POI","contactType":null,"group":"Documents","alignmentGroup":null,"visible":null,"changeAction":null,"required":true},{"id":"proofOfRelationship","description":"proofOfRelationship","label":{"ara":"إثبات العلاقة","eng":"Relationship Proof","fra":"Relationship Proof"},"type":"documentType","minimum":0,"maximum":0,"controlType":"fileupload","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"( identity.isNew && identity.isChild ) || ( identity.isUpdate && (identity.updatableFieldGroups contains ''GuardianDetails'' || identity.isChild))"}],"subType":"POR","contactType":null,"group":"Documents","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"proofOfDateOfBirth","description":"proofOfDateOfBirth","label":{"ara":"دليل DOB","eng":"DOB Proof","fra":"DOB Proof"},"type":"documentType","minimum":0,"maximum":0,"controlType":"fileupload","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[{"engine":"MVEL","expr":"identity.isUpdate && identity.updatableFields contains ''dateOfBirth''"}],"subType":"POB","contactType":null,"group":"Documents","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"proofOfException","description":"proofOfException","label":{"ara":"إثبات الاستثناء","eng":"Exception Proof","fra":"Exception Proof"},"type":"documentType","minimum":0,"maximum":0,"controlType":"fileupload","fieldType":"default","format":"none","fieldCategory":"evidence","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"POE","contactType":null,"group":"Documents","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"proofOfException-1","description":"proofOfException","label":{"ara":"إثبات الاستثناء 2","eng":"Exception Proof","fra":"Exception Proof"},"type":"documentType","minimum":0,"maximum":0,"controlType":"fileupload","fieldType":"default","format":"none","fieldCategory":"evidence","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"POE","contactType":null,"group":"Documents","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"individualBiometrics","description":"","label":{"ara":"القياسات الحيوية الفردية","eng":"Applicant Biometrics","fra":"Applicant Biometrics"},"type":"biometricsType","minimum":0,"maximum":0,"controlType":"biometrics","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":["leftEye","rightEye","rightIndex","rightLittle","rightRing","rightMiddle","leftIndex","leftLittle","leftRing","leftMiddle","leftThumb","rightThumb","face"],"requiredOn":[{"engine":"MVEL","expr":"(identity.isNew || identity.isLost || ( identity.isUpdate && identity.updatableFieldGroups contains ''Biometrics''))"}],"subType":"applicant","contactType":null,"group":"Biometrics","alignmentGroup":null,"visible":null,"changeAction":null,"required":true},{"id":"individualAuthBiometrics","description":"Used to hold biometrics only for authentication","label":{"ara":"القياسات الحيوية الفردية","eng":"Authentication Biometrics","fra":"Authentication Biometrics"},"type":"biometricsType","minimum":0,"maximum":0,"controlType":"biometrics","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":["leftEye","rightEye","rightIndex","rightLittle","rightRing","rightMiddle","leftIndex","leftLittle","leftRing","leftMiddle","leftThumb","rightThumb","face"],"requiredOn":[{"engine":"MVEL","expr":"!identity.isChild && identity.isUpdate && !(identity.updatableFieldGroups contains ''Biometrics'' || identity.updatableFieldGroups contains ''GuardianDetails'')"}],"subType":"applicant-auth","contactType":null,"group":null,"alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"parentOrGuardianBiometrics","description":"","label":{"ara":"القياسات الحيوية للوالدين","eng":"Guardian Biometrics","fra":"Guardian Biometrics"},"type":"biometricsType","minimum":0,"maximum":0,"controlType":"biometrics","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":["leftEye","rightEye","rightIndex","rightLittle","rightRing","rightMiddle","leftIndex","leftLittle","leftRing","leftMiddle","leftThumb","rightThumb","face"],"requiredOn":[{"engine":"MVEL","expr":"(identity.isChild && identity.isNew) || (identity.isUpdate && identity.updatableFieldGroups contains ''GuardianDetails'')"}],"subType":"introducer","contactType":null,"group":"Biometrics","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"consentText","description":"Applicant consent text","label":{"ara":"موافقة مقدم الطلب","eng":"Applicant Consent","fra":"Consentement du demandeur"},"type":"simpleType","minimum":0,"maximum":0,"controlType":"html","fieldType":"default","format":"none","fieldCategory":"evidence","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"consent","contactType":null,"group":"consent","alignmentGroup":null,"visible":null,"changeAction":null,"required":false},{"id":"consent","description":"Applicant consent flag","label":{"ara":"أقبل مشاركة معلومات تحديد الهوية الشخصية الخاصة بي","eng":"I accept to share my PII","fra":"J''accepte de partager mes PII"},"type":"string","minimum":0,"maximum":0,"controlType":"checkbox","fieldType":"default","format":"none","fieldCategory":"pvt","inputRequired":true,"validators":[],"bioAttributes":null,"requiredOn":[],"subType":"consent","contactType":null,"group":"consent","alignmentGroup":null,"visible":null,"changeAction":null,"required":true}]';
-
-
---------------------------------------------------------------------------------------------------------------
-ALTER TABLE master.bulkupload_transaction ALTER COLUMN upload_description character varying(256);
-
-
------------------------------------------------------------------------------------------------------------------
-
-ALTER TABLE master.ui_spec ALTER COLUMN version TYPE numeric(5);
-ALTER TABLE master.ui_spec ALTER COLUMN identity_schema_version TYPE numeric(5);
-
-ALTER TABLE master.user_detail ADD COLUMN uin character varying(28);
-ALTER TABLE master.user_detail ADD COLUMN email character varying(256);
-ALTER TABLE master.user_detail ADD COLUMN mobile character varying(16);
-
-ALTER TABLE master.user_detail_h ADD COLUMN uin character varying(28);
-ALTER TABLE master.user_detail_h ADD COLUMN email character varying(256);
-ALTER TABLE master.user_detail_h ADD COLUMN mobile character varying(16);
diff --git a/db_release_scripts/mosip_master/sql/README.md b/db_release_scripts/mosip_master/sql/README.md
new file mode 100644
index 00000000000..d4fc7658a2a
--- /dev/null
+++ b/db_release_scripts/mosip_master/sql/README.md
@@ -0,0 +1,32 @@
+Release migration and respective revoke sql scripts.
+
+
+## From 1.1.5 to 1.2.0
+
+1. Execute `1.2.0-release.sql` to migrate from 1.1.5 db to 1.2.0 compatible db.
+2. On successful execution, run data migration python scripts under `migration-scripts/1.2.0/*`.
+3. On failure, execute `1.2.0-revoke.sql` to restore to pre-migration point.
+
+
+## Below backups are taken during the migration, Kindly remove them after verifying the migrated database.
+
+template_migr_bkp
+module_detail_migr_bkp
+identity_schema_migr_bkp
+biometric_type_migr_bkp
+reg_exceptional_holiday_migr_bkp
+device_spec_migr_bkp
+device_type_migr_bkp
+device_master_migr_bkp
+machine_spec_migr_bkp
+machine_type_migr_bkp
+machine_master_migr_bkp
+loc_holiday_migr_bkp
+dynamic_field_migr_bkp
+
+
+NOTE:
+
+1. Unique constraint on `name`, `key_index`, `sign_key_index` was applied on `machine_master` table, All the available duplicates are dumped into `machine_master_migr_dupes` table.
+2. Primary key was changed on `loc_holiday` table, Old primary key (id, location_code, lang_code) is changed to (holiday_date, location_code, lang_code)
+ All the duplicates w.r.t new primary key is dumped into `loc_holiday_migr_dupes` table.
\ No newline at end of file
diff --git a/db_scripts/mosip_hotlist/ddl/hotlist-hotlist.sql b/db_scripts/mosip_hotlist/ddl/hotlist-hotlist.sql
index fda103f43ac..4693748df6b 100644
--- a/db_scripts/mosip_hotlist/ddl/hotlist-hotlist.sql
+++ b/db_scripts/mosip_hotlist/ddl/hotlist-hotlist.sql
@@ -42,7 +42,5 @@ COMMENT ON COLUMN hotlist.hotlist.start_timestamp IS E'startTimestamp: Timestamp
-- ddl-end --
COMMENT ON COLUMN hotlist.hotlist.expiry_timestamp IS E'expiryTimestamp: Timestamp when respective hotlisted ID will expire.';
-- ddl-end --
-ALTER TABLE hotlist.hotlist OWNER TO sysadmin;
--- ddl-end --
diff --git a/db_scripts/mosip_hotlist/ddl/hotlist-hotlist_h.sql b/db_scripts/mosip_hotlist/ddl/hotlist-hotlist_h.sql
index 425e257e49b..d9eeb69832e 100644
--- a/db_scripts/mosip_hotlist/ddl/hotlist-hotlist_h.sql
+++ b/db_scripts/mosip_hotlist/ddl/hotlist-hotlist_h.sql
@@ -40,7 +40,5 @@ COMMENT ON COLUMN hotlist.hotlist_h.status IS E'status: status to denote whether
-- ddl-end --
COMMENT ON COLUMN hotlist.hotlist_h.start_timestamp IS E'startTimestamp: Timestamp when respective ID is hotlisted.';
-- ddl-end --
-ALTER TABLE hotlist.hotlist_h OWNER TO sysadmin;
--- ddl-end --
diff --git a/db_scripts/mosip_master/ddl/master-blocklisted_words.sql b/db_scripts/mosip_master/ddl/master-blocklisted_words.sql
index 6ac6df35933..302ad727ab2 100644
--- a/db_scripts/mosip_master/ddl/master-blocklisted_words.sql
+++ b/db_scripts/mosip_master/ddl/master-blocklisted_words.sql
@@ -5,7 +5,7 @@
CREATE TABLE master.blocklisted_words(
word character varying(128) NOT NULL,
descr character varying(256),
- lang_code character varying(3) NOT NULL,
+ lang_code character varying(3),
is_active boolean NOT NULL,
cr_by character varying(256) NOT NULL,
cr_dtimes timestamp NOT NULL,
@@ -13,7 +13,7 @@ CREATE TABLE master.blocklisted_words(
upd_dtimes timestamp,
is_deleted boolean DEFAULT FALSE,
del_dtimes timestamp,
- CONSTRAINT pk_blwrd_code PRIMARY KEY (word,lang_code)
+ CONSTRAINT pk_blwrd_code PRIMARY KEY (word)
);
-- ddl-end --
diff --git a/db_scripts/mosip_master/ddl/master-ca_cert_store.sql b/db_scripts/mosip_master/ddl/master-ca_cert_store.sql
index a85dd4b03c7..df9974fa6df 100644
--- a/db_scripts/mosip_master/ddl/master-ca_cert_store.sql
+++ b/db_scripts/mosip_master/ddl/master-ca_cert_store.sql
@@ -29,7 +29,5 @@ CREATE TABLE master.ca_cert_store (
CREATE INDEX pk_cacs_id ON master.ca_cert_store USING btree (cert_id);
-- ddl-end --
-ALTER TABLE master.ca_cert_store OWNER TO sysadmin;
--- ddl-end --
diff --git a/db_scripts/mosip_master/ddl/master-loc_holiday.sql b/db_scripts/mosip_master/ddl/master-loc_holiday.sql
index 37471906663..4cb57fe984e 100644
--- a/db_scripts/mosip_master/ddl/master-loc_holiday.sql
+++ b/db_scripts/mosip_master/ddl/master-loc_holiday.sql
@@ -16,7 +16,7 @@ CREATE TABLE master.loc_holiday(
upd_dtimes timestamp,
is_deleted boolean DEFAULT FALSE,
del_dtimes timestamp,
- CONSTRAINT pk_lochol_id PRIMARY KEY (id,location_code,lang_code),
+ CONSTRAINT pk_lochol_id PRIMARY KEY (holiday_date,location_code,lang_code),
CONSTRAINT uk_lochol_name UNIQUE (holiday_name,holiday_date,location_code,lang_code)
);
diff --git a/db_scripts/mosip_master/ddl/master-ui_spec.sql b/db_scripts/mosip_master/ddl/master-ui_spec.sql
index c56f0e182ec..d1314b5721a 100644
--- a/db_scripts/mosip_master/ddl/master-ui_spec.sql
+++ b/db_scripts/mosip_master/ddl/master-ui_spec.sql
@@ -30,5 +30,3 @@ COMMENT ON TABLE master.ui_spec IS E'UI Specifications : Stores UI Specificatio
-- ddl-end --
COMMENT ON CONSTRAINT unq_dmn_type_vrsn_ischmid ON master.ui_spec IS E'Unique Constraint on domain,title,version,identity_schema_id';
-- ddl-end --
-ALTER TABLE master.ui_spec OWNER TO sysadmin;
--- ddl-end --