GNM-1226 Merge to master
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..d05d003
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,66 @@
+# Contributing to Eclipse openK User Modules
+
+Thanks for your interest in this project.
+
+## Project description
+
+The project starts with the module Feed-In Management ("Last- und
+Einspeisemanagement") based on the German Electricity Feed-In Act. The future
+demand for electric energy is to be adapted to the supply and availability of
+renewable energy. Based on specific rules and parameters the Feed-In Management
+calculates a blueprint for electric switching stations and power plants based on
+renewable energy. Implementing the calculation input data is needed from
+electric networks, switching stations, power plants, electric demands and
+feed-in capabilities.
+
+* https://projects.eclipse.org/projects/technology.openk-usermodules
+
+## Developer resources
+
+Information regarding source code management, builds, coding standards, and
+more.
+
+* https://projects.eclipse.org/projects/technology.openk-usermodules/developer
+
+The project maintains the following source code repositories
+
+* http://git.eclipse.org/c/openk-usermodules/openk-usermodules.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.mics.centralService.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.mics.homeService.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.plannedGridMeasures.backend.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.plannedGridMeasures.frontend.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.standbyPlanning.backend.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.standbyPlanning.docu.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.standbyPlanning.frontend.git
+
+This project uses Bugzilla to track ongoing development and issues.
+
+* Search for issues: https://eclipse.org/bugs/buglist.cgi?product=openK User
+   Modules
+* Create a new report: https://eclipse.org/bugs/enter_bug.cgi?product=openK
+   User Modules
+
+Be sure to search for existing bugs before you create another one. Remember that
+contributions are always welcome!
+
+## Eclipse Contributor Agreement
+
+Before your contribution can be accepted by the project team contributors must
+electronically sign the Eclipse Contributor Agreement (ECA).
+
+* http://www.eclipse.org/legal/ECA.php
+
+Commits that are provided by non-committers must have a Signed-off-by field in
+the footer indicating that the author is aware of the terms by which the
+contribution has been provided to the project. The non-committer must
+additionally have an Eclipse Foundation account and must have a signed Eclipse
+Contributor Agreement (ECA) on file.
+
+For more information, please see the Eclipse Committer Handbook:
+https://www.eclipse.org/projects/handbook/#resources-commit
+
+## Contact
+
+Contact the project developers via the project's "dev" list.
+
+* https://accounts.eclipse.org/mailing-list/openk-usermodules-dev
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
index 11ecb79..55979aa 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,198 +1,260 @@
-Eclipse Public License - v 1.0
+Eclipse Public License - v 2.0
 
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
-LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
-CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+    PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+    OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
 
 1. DEFINITIONS
 
 "Contribution" means:
 
-a) in the case of the initial Contributor, the initial code and documentation
-   distributed under this Agreement, and
-b) in the case of each subsequent Contributor:
-    i) changes to the Program, and
-   ii) additions to the Program;
+  a) in the case of the initial Contributor, the initial content
+     Distributed under this Agreement, and
 
-   where such changes and/or additions to the Program originate from and are
-   distributed by that particular Contributor. A Contribution 'originates' from
-   a Contributor if it was added to the Program by such Contributor itself or
-   anyone acting on such Contributor's behalf. Contributions do not include
-   additions to the Program which: (i) are separate modules of software
-   distributed in conjunction with the Program under their own license
-   agreement, and (ii) are not derivative works of the Program.
+  b) in the case of each subsequent Contributor:
+     i) changes to the Program, and
+     ii) additions to the Program;
+  where such changes and/or additions to the Program originate from
+  and are Distributed by that particular Contributor. A Contribution
+  "originates" from a Contributor if it was added to the Program by
+  such Contributor itself or anyone acting on such Contributor's behalf.
+  Contributions do not include changes or additions to the Program that
+  are not Modified Works.
 
-"Contributor" means any person or entity that distributes the Program.
+"Contributor" means any person or entity that Distributes the Program.
 
-"Licensed Patents" mean patent claims licensable by a Contributor which are
-necessarily infringed by the use or sale of its Contribution alone or when
-combined with the Program.
+"Licensed Patents" mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
 
-"Program" means the Contributions distributed in accordance with this Agreement.
+"Program" means the Contributions Distributed in accordance with this
+Agreement.
 
-"Recipient" means anyone who receives the Program under this Agreement,
-including all Contributors.
+"Recipient" means anyone who receives the Program under this Agreement
+or any Secondary License (as applicable), including Contributors.
+
+"Derivative Works" shall mean any work, whether in Source Code or other
+form, that is based on (or derived from) the Program and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship.
+
+"Modified Works" shall mean any work in Source Code or other form that
+results from an addition to, deletion from, or modification of the
+contents of the Program, including, for purposes of clarity any new file
+in Source Code form that contains any contents of the Program. Modified
+Works shall not include works that contain only declarations,
+interfaces, types, classes, structures, or files of the Program solely
+in each case in order to link to, bind by name, or subclass the Program
+or Modified Works thereof.
+
+"Distribute" means the acts of a) distributing or b) making available
+in any manner that enables the transfer of a copy.
+
+"Source Code" means the form of a Program preferred for making
+modifications, including but not limited to software source code,
+documentation source, and configuration files.
+
+"Secondary License" means either the GNU General Public License,
+Version 2.0, or any later versions of that license, including any
+exceptions or additional permissions as identified by the initial
+Contributor.
 
 2. GRANT OF RIGHTS
-  a) Subject to the terms of this Agreement, each Contributor hereby grants
-     Recipient a non-exclusive, worldwide, royalty-free copyright license to
-     reproduce, prepare derivative works of, publicly display, publicly perform,
-     distribute and sublicense the Contribution of such Contributor, if any, and
-     such derivative works, in source code and object code form.
-  b) Subject to the terms of this Agreement, each Contributor hereby grants
-     Recipient a non-exclusive, worldwide, royalty-free patent license under
-     Licensed Patents to make, use, sell, offer to sell, import and otherwise
-     transfer the Contribution of such Contributor, if any, in source code and
-     object code form. This patent license shall apply to the combination of the
-     Contribution and the Program if, at the time the Contribution is added by
-     the Contributor, such addition of the Contribution causes such combination
-     to be covered by the Licensed Patents. The patent license shall not apply
-     to any other combinations which include the Contribution. No hardware per
-     se is licensed hereunder.
-  c) Recipient understands that although each Contributor grants the licenses to
-     its Contributions set forth herein, no assurances are provided by any
-     Contributor that the Program does not infringe the patent or other
-     intellectual property rights of any other entity. Each Contributor
-     disclaims any liability to Recipient for claims brought by any other entity
-     based on infringement of intellectual property rights or otherwise. As a
-     condition to exercising the rights and licenses granted hereunder, each
-     Recipient hereby assumes sole responsibility to secure any other
-     intellectual property rights needed, if any. For example, if a third party
-     patent license is required to allow Recipient to distribute the Program, it
-     is Recipient's responsibility to acquire that license before distributing
-     the Program.
-  d) Each Contributor represents that to its knowledge it has sufficient
-     copyright rights in its Contribution, if any, to grant the copyright
-     license set forth in this Agreement.
+
+  a) Subject to the terms of this Agreement, each Contributor hereby
+  grants Recipient a non-exclusive, worldwide, royalty-free copyright
+  license to reproduce, prepare Derivative Works of, publicly display,
+  publicly perform, Distribute and sublicense the Contribution of such
+  Contributor, if any, and such Derivative Works.
+
+  b) Subject to the terms of this Agreement, each Contributor hereby
+  grants Recipient a non-exclusive, worldwide, royalty-free patent
+  license under Licensed Patents to make, use, sell, offer to sell,
+  import and otherwise transfer the Contribution of such Contributor,
+  if any, in Source Code or other form. This patent license shall
+  apply to the combination of the Contribution and the Program if, at
+  the time the Contribution is added by the Contributor, such addition
+  of the Contribution causes such combination to be covered by the
+  Licensed Patents. The patent license shall not apply to any other
+  combinations which include the Contribution. No hardware per se is
+  licensed hereunder.
+
+  c) Recipient understands that although each Contributor grants the
+  licenses to its Contributions set forth herein, no assurances are
+  provided by any Contributor that the Program does not infringe the
+  patent or other intellectual property rights of any other entity.
+  Each Contributor disclaims any liability to Recipient for claims
+  brought by any other entity based on infringement of intellectual
+  property rights or otherwise. As a condition to exercising the
+  rights and licenses granted hereunder, each Recipient hereby
+  assumes sole responsibility to secure any other intellectual
+  property rights needed, if any. For example, if a third party
+  patent license is required to allow Recipient to Distribute the
+  Program, it is Recipient's responsibility to acquire that license
+  before distributing the Program.
+
+  d) Each Contributor represents that to its knowledge it has
+  sufficient copyright rights in its Contribution, if any, to grant
+  the copyright license set forth in this Agreement.
+
+  e) Notwithstanding the terms of any Secondary License, no
+  Contributor makes additional grants to any Recipient (other than
+  those set forth in this Agreement) as a result of such Recipient's
+  receipt of the Program under the terms of a Secondary License
+  (if permitted under the terms of Section 3).
 
 3. REQUIREMENTS
 
-A Contributor may choose to distribute the Program in object code form under its
-own license agreement, provided that:
+3.1 If a Contributor Distributes the Program in any form, then:
 
-  a) it complies with the terms and conditions of this Agreement; and
-  b) its license agreement:
-      i) effectively disclaims on behalf of all Contributors all warranties and
-         conditions, express and implied, including warranties or conditions of
-         title and non-infringement, and implied warranties or conditions of
-         merchantability and fitness for a particular purpose;
-     ii) effectively excludes on behalf of all Contributors all liability for
-         damages, including direct, indirect, special, incidental and
-         consequential damages, such as lost profits;
-    iii) states that any provisions which differ from this Agreement are offered
-         by that Contributor alone and not by any other party; and
-     iv) states that source code for the Program is available from such
-         Contributor, and informs licensees how to obtain it in a reasonable
-         manner on or through a medium customarily used for software exchange.
+  a) the Program must also be made available as Source Code, in
+  accordance with section 3.2, and the Contributor must accompany
+  the Program with a statement that the Source Code for the Program
+  is available under this Agreement, and informs Recipients how to
+  obtain it in a reasonable manner on or through a medium customarily
+  used for software exchange; and
 
-When the Program is made available in source code form:
+  b) the Contributor may Distribute the Program under a license
+  different than this Agreement, provided that such license:
+     i) effectively disclaims on behalf of all other Contributors all
+     warranties and conditions, express and implied, including
+     warranties or conditions of title and non-infringement, and
+     implied warranties or conditions of merchantability and fitness
+     for a particular purpose;
 
-  a) it must be made available under this Agreement; and
-  b) a copy of this Agreement must be included with each copy of the Program.
-     Contributors may not remove or alter any copyright notices contained within
-     the Program.
+     ii) effectively excludes on behalf of all other Contributors all
+     liability for damages, including direct, indirect, special,
+     incidental and consequential damages, such as lost profits;
 
-Each Contributor must identify itself as the originator of its Contribution, if
-any, in a manner that reasonably allows subsequent Recipients to identify the
-originator of the Contribution.
+     iii) does not attempt to limit or alter the recipients' rights
+     in the Source Code under section 3.2; and
+
+     iv) requires any subsequent distribution of the Program by any
+     party to be under a license that satisfies the requirements
+     of this section 3.
+
+3.2 When the Program is Distributed as Source Code:
+
+  a) it must be made available under this Agreement, or if the
+  Program (i) is combined with other material in a separate file or
+  files made available under a Secondary License, and (ii) the initial
+  Contributor attached to the Source Code the notice described in
+  Exhibit A of this Agreement, then the Program may be made available
+  under the terms of such Secondary Licenses, and
+
+  b) a copy of this Agreement must be included with each copy of
+  the Program.
+
+3.3 Contributors may not remove or alter any copyright, patent,
+trademark, attribution notices, disclaimers of warranty, or limitations
+of liability ("notices") contained within the Program from any copy of
+the Program which they Distribute, provided that Contributors may add
+their own appropriate notices.
 
 4. COMMERCIAL DISTRIBUTION
 
-Commercial distributors of software may accept certain responsibilities with
-respect to end users, business partners and the like. While this license is
-intended to facilitate the commercial use of the Program, the Contributor who
-includes the Program in a commercial product offering should do so in a manner
-which does not create potential liability for other Contributors. Therefore, if
-a Contributor includes the Program in a commercial product offering, such
-Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
-every other Contributor ("Indemnified Contributor") against any losses, damages
-and costs (collectively "Losses") arising from claims, lawsuits and other legal
-actions brought by a third party against the Indemnified Contributor to the
-extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor to
-control, and cooperate with the Commercial Contributor in, the defense and any
-related settlement negotiations. The Indemnified Contributor may participate in
-any such claim at its own expense.
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program,
+the Contributor who includes the Program in a commercial product
+offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes
+the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every
+other Contributor ("Indemnified Contributor") against any losses,
+damages and costs (collectively "Losses") arising from claims, lawsuits
+and other legal actions brought by a third party against the Indemnified
+Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program
+in a commercial product offering. The obligations in this section do not
+apply to any claims or Losses relating to any actual or alleged
+intellectual property infringement. In order to qualify, an Indemnified
+Contributor must: a) promptly notify the Commercial Contributor in
+writing of such claim, and b) allow the Commercial Contributor to control,
+and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
 
-For example, a Contributor might include the Program in a commercial product
-offering, Product X. That Contributor is then a Commercial Contributor. If that
-Commercial Contributor then makes performance claims, or offers warranties
-related to Product X, those performance claims and warranties are such
-Commercial Contributor's responsibility alone. Under this section, the
-Commercial Contributor would have to defend claims against the other
-Contributors related to those performance claims and warranties, and if a court
-requires any other Contributor to pay any damages as a result, the Commercial
-Contributor must pay those damages.
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay
+those damages.
 
 5. NO WARRANTY
 
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
-IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
-Recipient is solely responsible for determining the appropriateness of using and
-distributing the Program and assumes all risks associated with its exercise of
-rights under this Agreement , including but not limited to the risks and costs
-of program errors, compliance with applicable laws, damage to or loss of data,
-programs or equipment, and unavailability or interruption of operations.
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
+BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
+TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE. Each Recipient is solely responsible for determining the
+appropriateness of using and distributing the Program and assumes all
+risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs
+or equipment, and unavailability or interruption of operations.
 
 6. DISCLAIMER OF LIABILITY
 
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
-CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
-PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
-GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
+SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
+EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
 
 7. GENERAL
 
-If any provision of this Agreement is invalid or unenforceable under applicable
-law, it shall not affect the validity or enforceability of the remainder of the
-terms of this Agreement, and without further action by the parties hereto, such
-provision shall be reformed to the minimum extent necessary to make such
-provision valid and enforceable.
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
 
-If Recipient institutes patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Program itself
-(excluding combinations of the Program with other software or hardware)
-infringes such Recipient's patent(s), then such Recipient's rights granted under
-Section 2(b) shall terminate as of the date such litigation is filed.
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software
+or hardware) infringes such Recipient's patent(s), then such Recipient's
+rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
 
-All Recipient's rights under this Agreement shall terminate if it fails to
-comply with any of the material terms or conditions of this Agreement and does
-not cure such failure in a reasonable period of time after becoming aware of
-such noncompliance. If all Recipient's rights under this Agreement terminate,
-Recipient agrees to cease use and distribution of the Program as soon as
-reasonably practicable. However, Recipient's obligations under this Agreement
-and any licenses granted by Recipient relating to the Program shall continue and
-survive.
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and survive.
 
-Everyone is permitted to copy and distribute copies of this Agreement, but in
-order to avoid inconsistency the Agreement is copyrighted and may only be
-modified in the following manner. The Agreement Steward reserves the right to
-publish new versions (including revisions) of this Agreement from time to time.
-No one other than the Agreement Steward has the right to modify this Agreement.
-The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation
-may assign the responsibility to serve as the Agreement Steward to a suitable
-separate entity. Each new version of the Agreement will be given a
-distinguishing version number. The Program (including Contributions) may always
-be distributed subject to the version of the Agreement under which it was
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign the
+responsibility to serve as the Agreement Steward to a suitable separate
+entity. Each new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+Distributed subject to the version of the Agreement under which it was
 received. In addition, after a new version of the Agreement is published,
-Contributor may elect to distribute the Program (including its Contributions)
-under the new version. Except as expressly stated in Sections 2(a) and 2(b)
-above, Recipient receives no rights or licenses to the intellectual property of
-any Contributor under this Agreement, whether expressly, by implication,
-estoppel or otherwise. All rights in the Program not expressly granted under
-this Agreement are reserved.
+Contributor may elect to Distribute the Program (including its
+Contributions) under the new version.
 
-This Agreement is governed by the laws of the State of New York and the
-intellectual property laws of the United States of America. No party to this
-Agreement will bring a legal action under this Agreement more than one year
-after the cause of action arose. Each party waives its rights to a jury trial in
-any resulting litigation.
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
+receives no rights or licenses to the intellectual property of any
+Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted
+under this Agreement are reserved. Nothing in this Agreement is intended
+to be enforceable by any entity that is not a Contributor or Recipient.
+No third-party beneficiary rights are created under this Agreement.
\ No newline at end of file
diff --git a/NOTICE.md b/NOTICE.md
new file mode 100644
index 0000000..f249680
--- /dev/null
+++ b/NOTICE.md
@@ -0,0 +1,545 @@
+# Notices for Eclipse openK User Modules
+
+This content is produced and maintained by the Eclipse openK User Modules
+project.
+
+* Project home:
+   https://projects.eclipse.org/projects/technology.openk-usermodules
+
+## Trademarks
+
+Eclipse openK User Modules is a trademark of the Eclipse Foundation.
+
+## Copyright
+
+All content is the property of the respective authors or their employers. For
+more information regarding authorship of content, please consult the listed
+source code repository logs.
+
+## Declared Project Licenses
+
+This program and the accompanying materials are made available under the terms
+of the Eclipse Public License v. 2.0 which is available at
+http://www.eclipse.org/legal/epl-2.0.
+
+SPDX-License-Identifier: EPL-2.0
+
+## Source Code
+
+The project maintains the following source code repositories:
+
+* http://git.eclipse.org/c/openk-usermodules/openk-usermodules.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.mics.centralService.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.mics.homeService.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.plannedGridMeasures.backend.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.plannedGridMeasures.frontend.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.standbyPlanning.backend.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.standbyPlanning.docu.git
+* http://git.eclipse.org/c/openk-usermodules/org.eclipse.openk-usermodules.standbyPlanning.frontend.git
+
+## Third-party Content
+
+This project leverages the following third party content.
+
+ag-grid (18.0.1)
+
+* License: MIT
+* Project: https://www.ag-grid.com/
+* Source: https://github.com/ag-grid/ag-grid
+
+ag-grid-angular (n/a)
+
+* License: MIT
+* Project: https://www.ag-grid.com/
+* Source: https://github.com/ag-grid/ag-grid-angular
+
+ajv (6.5.2)
+
+* License: MIT AND (BSD-3-Clause OR AFL-2.1)
+* Source: https://github.com/epoberezkin/ajv/releases/tag/v6.5.2
+
+angular animations (5.2.11)
+
+* License: MIT
+* Project: https://angular.io/guide/animations
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular animations (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/guide/animations
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular calendar (0.23.7)
+
+* License: MIT
+* Source: https://github.com/mattlewis92/angular-calendar/releases/tag/v0.23.7
+
+angular common (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular common (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/api/common
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular compiler (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular compiler (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular core (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular core (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular forms (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular forms (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular http (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular http (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular jwt (1.0)
+
+* License: MIT
+* Source: https://github.com/auth0/angular2-jwt
+
+angular material2 (5.2.5)
+
+* License: MIT
+* Source: https://github.com/angular/material2/tree/5.2.5
+
+angular platform-browser (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular platform-browser (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular platform-browser-dynamic (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular platform-browser-dynamic (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular router (5.2.11)
+
+* License: MIT
+* Source: https://github.com/angular/angular/releases/tag/5.2.11
+
+angular router (6.1.0)
+
+* License: Apache-2.0 AND MIT
+* Project: https://angular.io/
+* Source: https://github.com/angular/angular/releases/tag/6.1.0
+
+angular2-uuid (1.1.1)
+
+* License: MIT
+
+Apache Commons Lang (2.6)
+
+* License: Apache License, 2.0
+
+Apache HttpClient (4.5.3)
+
+* License: Apache-2.0
+
+Apache HttpClient (4.5.3)
+
+* License: Apache-2.0
+
+Apache Log4j (1.2.17)
+
+* License: Apache License 2.0
+
+arc42 template (n/a)
+
+* License: MIT
+* Project: https://arc42.org/overview/
+* Source:
+   https://github.com/arc42/arc42-template/raw/master/dist/arc42-template-EN-plain-docx.zip
+
+auth0/angular-jwt (2.0.0)
+
+* License: MIT
+* Project: https://github.com/auth0/angular2-jwt
+* Source: https://github.com/auth0/angular2-jwt/releases/tag/2.0.0
+
+Bootstrap (3.3.7)
+
+* License: MIT
+
+bootstrap (4.1.1)
+
+* License: MIT
+* Project: https://getbootstrap.com/
+* Source: https://github.com/twbs/bootstrap
+
+bootstrap toggle (2.2.2)
+
+* License: MIT
+* Source: https://github.com/minhur/bootstrap-toggle/releases/tag/2.2.2
+
+camunda-engine-spring (7.9.0)
+
+* License: Apache-2.0
+* Project: https://github.com/camunda/camunda-bpm-platform
+* Source: https://github.com/camunda/
+
+cglib (3.1)
+
+* License: Apache License, 2.0, New BSD license
+
+classlist.js (1.1.20150312)
+
+* License: Unlicense
+
+classlist.js (1.1.20150312)
+
+* License: Unlicense
+
+com.google.code.gson : gson : (2.8.5)
+
+* License: Apache-2.0
+* Project: https://github.com/google/gson
+* Source: https://github.com/google/gson
+
+commons-codec (1.11)
+
+* License: Apache-2.0 AND BSD-3-Clause
+
+commons-codec:commons-codec (1.10)
+
+* License: Apache License, 2.0
+
+commons-io (2.5)
+
+* License: Apache License, 2.0
+
+commons-io:commons-io (2.6)
+
+* License: Apache-2.0
+
+core js (2.5.7)
+
+* License: BSD 3-Clause AND MIT
+* Source: https://github.com/zloirock/core-js/releases/tag/v2.5.7
+
+core-js (2.5.4)
+
+* License: MIT
+* Project: https://github.com/zloirock/core-js
+* Source: https://github.com/zloirock/core-js/releases/tag/v2.5.4
+
+core-js, (2.4.1)
+
+* License: MIT
+
+dozer V.5.5.1 (5.5.1)
+
+* License: Apache License, 2.0
+
+dropwizard (1.3.1)
+
+* License: Apache-2.0 AND MIT AND BSD-3-Clause
+* Source: https://github.com/dropwizard/dropwizard/tree/v1.3.1
+
+dropwizard.dropwizard-core (9.0.2)
+
+* License: Apache-2.0
+
+easymock (3.3.1)
+
+* License: Apache License, 2.0
+
+file-saver (1.3.8)
+
+* License: MIT
+* Source: https://github.com/eligrey/FileSaver.js/releases/tag/1.3.8
+
+font-awesome (4.7.0)
+
+* License: OFL-1.1 AND MIT
+
+font-awesome (4.7.0)
+
+* License: OFL-1.1 AND MIT
+
+gson (2.8.0)
+
+* License: Apache-2.0
+
+h2 Database (1.3.168)
+
+* License: Eclipse Public License
+
+HikariCP-java7 (2.4.13)
+
+* License: Apache-2.0
+* Project: http://brettwooldridge.github.io/HikariCP/
+* Source: https://github.com/brettwooldridge/HikariCP
+
+jackson-annotations (2.5.4)
+
+* License: Apache-2.0
+
+jackson-core (2.8.6)
+
+* License: Apache-2.0
+
+jackson-databind (2.8.6)
+
+
+jackson-dataformat-yaml (2.8.6)
+
+* License: Apache-2.0
+
+javax.mail (1.4.3)
+
+* License: (CDDL-1.0 OR GPL-2.0+ WITH Classpath-exception-2.0)
+
+javax.servlet-api (3.1.0)
+
+* License: Apache-2.0 AND (CDDL-1.1 or GPL-2.0)
+
+javax.servlet-api (3.1.0)
+
+* License: Apache-2.0 AND (CDDL-1.1 or GPL-2.0)
+
+jawa-jwt (3.2.0)
+
+* License: MIT
+
+jersey-bundles-jaxrs-ri (jaxrs-ri-2.22.1.jar) (2.22.1)
+
+* License: Common Development and Distribution License, Apache 2.0
+
+jersey-container-servlet-core (2.23.2)
+
+* License: Common Development and Distribution License 1.1
+
+jersey-media-json-jackson (2.23.2)
+
+* License: CDDL-1.1 OR GPL-2.0 With Classpath-exception-2.0
+
+jersey-spring3 (2.23.2)
+
+* License: CDDL-1.1 OR GPL-2.0 With Classpath-exception-2.0
+* Project:
+   https://mvnrepository.com/artifact/org.glassfish.jersey.ext/jersey-spring3
+* Source:
+   https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-spring3/2.23.2/
+
+jjwt (0.6.0)
+
+* License: Apache License, 2.0
+
+jQuery (3.3.1)
+
+* License: MIT
+
+JUnit (4.12)
+
+* License: Eclipse Public License
+
+mockito (1.9.5)
+
+* License: Apache License, 2.0, New BSD license, MIT license
+
+ng-bootstrap (2.2.0)
+
+* License: MIT
+* Project: https://ng-bootstrap.github.io/#/home
+* Source: https://github.com/ng-bootstrap/ng-bootstrap
+
+ng2 daterangepicker (2.0.12)
+
+* License: MIT
+* Project: https://www.npmjs.com/package/ng2-daterangepicker
+* Source:
+   https://github.com/evansmwendwa/ng2-daterangepicker/releases/tag/2.0.12
+
+ng2-tree-2.0.0-rc.11 (2.0.0)
+
+* License: MIT
+* Source: https://github.com/valor-software/ng2-tree/tree/v2.0.0-rc.11
+
+Popper (1.14.3)
+
+* License: MIT AND CC-BY-3.0 AND (MIT OR GPL-2.0) AND LicenseRef-Public-Domain
+* Project: https://popper.js.org/
+* Source: https://github.com/FezVrasta/popper.js/releases/tag/v1.14.3
+
+postgres.postgresql (9.1)
+
+* License: BSD-3-Clause AND License-Ref-Public-Domain
+
+powermock (1.7.3)
+
+* License: Apache-2.0 AND BSD-3-Clause AND MIT AND (GPL-2.0 OR GPL-2.0 With
+   Classpath-exception) AND LicenseRef-Public-Domain
+* Source: https://github.com/powermock/powermock/tree/powermock-1.7.3
+
+powermock-module-junit4-common (1.6.6)
+
+* License: Apache-2.0
+
+primeicons (1.0.0)
+
+* License: MIT
+* Project: https://www.primefaces.org/primeng/#/
+* Source: https://github.com/primefaces/primeicons
+
+primeng (6.0.0)
+
+* License: MIT
+* Project: https://www.primefaces.org/primeng/#/
+* Source: https://github.com/primefaces/primeng
+
+primeng (6.1.3)
+
+* License: MIT
+* Project: https://www.primefaces.org/primeng/#/
+* Source: https://github.com/primefaces/primeng
+
+RabbitMQ AMQP client (5.2.0)
+
+* License: MPL-2.0 OR GPL-2.0 OR Apache-2.0
+
+rxjs (5.5.11)
+
+* License: Apache-2.0
+* Source: https://github.com/ReactiveX/rxjs/releases/tag/5.5.11
+
+rxjs (6.2.2)
+
+* License: Apache-2.0
+* Project: https://github.com/Reactive-Extensions/RxJS
+* Source: https://github.com/Reactive-Extensions/RxJS
+
+slf4j-api (1.7.5)
+
+* License: MIT License + MIT License with no endorsement clause
+
+slf4j-log4j12 (1.7.25)
+
+* License: MIT
+
+Source Sans Pro (n/a)
+
+* License: OFL-1.1
+* Project:
+   http://www.adobe.com/products/type/font-information/source-sans-pro-readme.html
+
+spinKit (1.2.5)
+
+* License: MIT
+
+spring-data-jpa (1.9.1)
+
+* License: Apache License, 2.0
+
+spring-jdbc (4.3.17)
+
+* License: Apache-2.0
+* Project: https://spring.io/
+* Source:
+   http://central.maven.org/maven2/org/springframework/spring-jdbc/4.3.17.RELEASE/
+
+spring-test (4.3.17)
+
+* License: Apache-2.0 AND LicenseRef-Public-Domain
+* Project: https://spring.io/
+* Source:
+   http://central.maven.org/maven2/org/springframework/spring-test/3.2.17.RELEASE/
+
+spring-web (4.3.17)
+
+* License: Apache-2.0
+* Project: https://spring.io/
+* Source: https://github.com/spring-projects/spring-framework
+
+swagger-core (1.5.12)
+
+* License: Apache-2.0
+
+swagger-jersey2-jaxrs (1.5.12)
+
+* License: Apache-2.0
+
+urlrewritefilter (4.0.4)
+
+* License: BSD-3-Clause AND (Apache-2.0 OR LGPL-2.0 OR GPL-2.0)
+* Project: https://github.com/paultuckey/urlrewritefilter
+* Source: https://github.com/paultuckey/urlrewritefilter
+
+web-animations (2.3.1)
+
+* License: Apache-2.0 AND BSD-3-Clause AND MIT
+* Source: https://github.com/web-animations/web-animations-js
+
+web-animations-js (2.3.1)
+
+* License: Apache-2.0
+* Project: https://github.com/web-animations/web-animations-js
+* Source:
+   https://github.com/web-animations/web-animations-js/releases/tag/2.3.1
+
+zone.js (0.8.26)
+
+* License: MIT
+
+zone.js (0.8.26)
+
+* License: MIT
+* Source: https://github.com/angular/zone.js/releases/tag/v0.8.26
+
+## Cryptography
+
+Content may contain encryption software. The country in which you are currently
+may have restrictions on the import, possession, and use, and/or re-export to
+another country, of encryption software. BEFORE using any encryption software,
+please check the country's laws, regulations and policies concerning the import,
+possession, or use, and re-export of encryption software, to see if this is
+permitted.
\ No newline at end of file
diff --git a/backendSettings.json b/backendSettings.json
index 391d555..267442a 100644
--- a/backendSettings.json
+++ b/backendSettings.json
@@ -12,18 +12,22 @@
   "appointmentRepetition": [
     {
       "id": 1,
+      "name": "einmalig"
+    },
+	{
+      "id": 2,
       "name": "täglich"
     },
     {
-      "id": 2,
+      "id": 3,
       "name": "wöchentlich"
     },
     {
-      "id": 3,
+      "id": 4,
       "name": "monatlich"
     },
     {
-      "id": 4,
+      "id": 5,
       "name": "jährlich"
     }
   ]
diff --git a/db/migrations/V0_10__CREATE_PLGM_DB.sql b/db/migrations/V0_10__CREATE_PLGM_DB.sql
index a1ac460..d512007 100644
--- a/db/migrations/V0_10__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_10__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --INSERT new Field color_code into TABLE REF_BRANCH
 --UPDATE HREF_BRANCH,
 --UPDATE REF_BRANCH INSERT TRIGGER, REF_BRANCH DELETE TRIGGER, REF_BRANCH UPDATE TRIGGER
diff --git a/db/migrations/V0_11__CREATE_PLGM_DB.sql b/db/migrations/V0_11__CREATE_PLGM_DB.sql
index d03efc6..ebf82e2 100644
--- a/db/migrations/V0_11__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_11__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --INSERT new TABLE REF_USER_SETTINGS inkl. INSERT-, UPDATE-, DELETE-TRIGGER
 --INSERT new TABLE HREF_USER_SETTINGS
 
diff --git a/db/migrations/V0_12__CREATE_PLGM_DB.sql b/db/migrations/V0_12__CREATE_PLGM_DB.sql
index c3973ac..8809b45 100644
--- a/db/migrations/V0_12__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_12__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --INSERT new Foreign-key Constraints into Table TBL_GRIDMEASURES
 --(ref_cost_center, ref_branch, ref_branch_level)
 
diff --git a/db/migrations/V0_13__CREATE_PLGM_DB.sql b/db/migrations/V0_13__CREATE_PLGM_DB.sql
index 6e7a3d8..5544bfd 100644
--- a/db/migrations/V0_13__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_13__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Change field value in REF_USER_SETTINGS to a maximum size of 4096 characters
 --Change field value in HREF_USER_SETTINGS to a maximum size of 4096 characters
 
diff --git a/db/migrations/V0_14__CREATE_PLGM_DB.sql b/db/migrations/V0_14__CREATE_PLGM_DB.sql
index 547ffe9..747f9dd 100644
--- a/db/migrations/V0_14__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_14__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Change field value in REF_USER_SETTINGS to a maximum size of 4096 characters
 --Change field value in HREF_USER_SETTINGS to a maximum size of 4096 characters
 
diff --git a/db/migrations/V0_15__CREATE_PLGM_DB.sql b/db/migrations/V0_15__CREATE_PLGM_DB.sql
index 8da55ef..a00eb8c 100644
--- a/db/migrations/V0_15__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_15__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Change field value in REF_USER_SETTINGS to a maximum size of 4096 characters
 --Change field value in HREF_USER_SETTINGS to a maximum size of 4096 characters
 
diff --git a/db/migrations/V0_16__CREATE_PLGM_DB.sql b/db/migrations/V0_16__CREATE_PLGM_DB.sql
index 88105cb..d99b3c3 100644
--- a/db/migrations/V0_16__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_16__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table REF_USER_SETTINGS and all dependent items renamed to TBL_USER_SETTINGS
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_17__CREATE_PLGM_DB.sql b/db/migrations/V0_17__CREATE_PLGM_DB.sql
index ff8e61b..0116d7d 100644
--- a/db/migrations/V0_17__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_17__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Foreign Key Field FK_REF_COST_CENTER in table TBL_GRIDMEASURES, HTBL_GRIDMEASURES set to String.
 --Delete Foreign Key Constraint fk_gridmeasure__cost_center
 
diff --git a/db/migrations/V0_18__CREATE_PLGM_DB.sql b/db/migrations/V0_18__CREATE_PLGM_DB.sql
index 25af019..bd007bd 100644
--- a/db/migrations/V0_18__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_18__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --DROP TABLE for REF_USER_SETTINGS added
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_19__CREATE_PLGM_DB.sql b/db/migrations/V0_19__CREATE_PLGM_DB.sql
index 3a94fd7..3de9eac 100644
--- a/db/migrations/V0_19__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_19__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --DROP TABLE for TBL_USER_SETTINGS added
 --DROP SEQUENCE for TTBL_USER_SETTINGS_ID_SEQ added
 
diff --git a/db/migrations/V0_20__CREATE_PLGM_DB.sql b/db/migrations/V0_20__CREATE_PLGM_DB.sql
index 8352b84..5d5a38a 100644
--- a/db/migrations/V0_20__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_20__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Data added to TBL_GRIDMEASURE
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_21__CREATE_PLGM_DB.sql b/db/migrations/V0_21__CREATE_PLGM_DB.sql
index ff39751..b1c5924 100644
--- a/db/migrations/V0_21__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_21__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_22__CREATE_PLGM_DB.sql b/db/migrations/V0_22__CREATE_PLGM_DB.sql
index 8458e7e..3029d99 100644
--- a/db/migrations/V0_22__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_22__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_23__CREATE_PLGM_DB.sql b/db/migrations/V0_23__CREATE_PLGM_DB.sql
index 6fa5538..edb8ccb 100644
--- a/db/migrations/V0_23__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_23__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_24__CREATE_PLGM_DB.sql b/db/migrations/V0_24__CREATE_PLGM_DB.sql
index 5a09d6a..a00461d 100644
--- a/db/migrations/V0_24__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_24__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_25__CREATE_PLGM_DB.sql b/db/migrations/V0_25__CREATE_PLGM_DB.sql
index ec7df19..67e3a14 100644
--- a/db/migrations/V0_25__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_25__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_26__CREATE_PLGM_DB.sql b/db/migrations/V0_26__CREATE_PLGM_DB.sql
index 3f3408f..3b1c0d2 100644
--- a/db/migrations/V0_26__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_26__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_27__CREATE_PLGM_DB.sql b/db/migrations/V0_27__CREATE_PLGM_DB.sql
index 2f940f0..c9cfb39 100644
--- a/db/migrations/V0_27__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_27__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_28__CREATE_PLGM_DB.sql b/db/migrations/V0_28__CREATE_PLGM_DB.sql
index 27ed3af..5f0e39e 100644
--- a/db/migrations/V0_28__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_28__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_29__CREATE_PLGM_DB.sql b/db/migrations/V0_29__CREATE_PLGM_DB.sql
index dec77e3..9c71f39 100644
--- a/db/migrations/V0_29__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_29__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_30__CREATE_PLGM_DB.sql b/db/migrations/V0_30__CREATE_PLGM_DB.sql
index f65806b..6a66046 100644
--- a/db/migrations/V0_30__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_30__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_31__CREATE_PLGM_DB.sql b/db/migrations/V0_31__CREATE_PLGM_DB.sql
index a6baf40..ad80d99 100644
--- a/db/migrations/V0_31__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_31__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_32__CREATE_PLGM_DB.sql b/db/migrations/V0_32__CREATE_PLGM_DB.sql
index 0497d72..7ff1c1e 100644
--- a/db/migrations/V0_32__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_32__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_33__CREATE_PLGM_DB.sql b/db/migrations/V0_33__CREATE_PLGM_DB.sql
index ac99837..6e0c734 100644
--- a/db/migrations/V0_33__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_33__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_34__CREATE_PLGM_DB.sql b/db/migrations/V0_34__CREATE_PLGM_DB.sql
index cf4902b..0ef6d73 100644
--- a/db/migrations/V0_34__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_34__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_35__CREATE_PLGM_DB.sql b/db/migrations/V0_35__CREATE_PLGM_DB.sql
index 136f71b..6f5671f 100644
--- a/db/migrations/V0_35__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_35__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_36__CREATE_PLGM_DB.sql b/db/migrations/V0_36__CREATE_PLGM_DB.sql
index f6e33f0..f560f3a 100644
--- a/db/migrations/V0_36__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_36__CREATE_PLGM_DB.sql
@@ -1,16 +1,18 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
---Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
+
+--Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 
 -- ---------------------------------------------
 -- DROPS
diff --git a/db/migrations/V0_37__CREATE_PLGM_DB.sql b/db/migrations/V0_37__CREATE_PLGM_DB.sql
index 6ca69e1..048a253 100644
--- a/db/migrations/V0_37__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_37__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Table TBL_LOCK added, table HTBL_LOCK added incl. Triggers
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_38__CREATE_PLGM_DB.sql b/db/migrations/V0_38__CREATE_PLGM_DB.sql
index cde134c..48449c5 100644
--- a/db/migrations/V0_38__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_38__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Index HUSER_INDEX added
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_39__CREATE_PLGM_DB.sql b/db/migrations/V0_39__CREATE_PLGM_DB.sql
index b26ffcf..c7ac9fd 100644
--- a/db/migrations/V0_39__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_39__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Index HUSER_INDEX added
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_3__CREATE_PLGM_DB.sql b/db/migrations/V0_3__CREATE_PLGM_DB.sql
index 8c3c5c4..d45f183 100644
--- a/db/migrations/V0_3__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_3__CREATE_PLGM_DB.sql
@@ -1,14 +1,17 @@
-/*
-******************************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --CREATE ROLE PLGM_SERVICE LOGIN
 --NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
 --ALTER ROLE PLGM_SERVICE with password 'plgm_service';
diff --git a/db/migrations/V0_40__CREATE_PLGM_DB.sql b/db/migrations/V0_40__CREATE_PLGM_DB.sql
index 8024d50..370cf74 100644
--- a/db/migrations/V0_40__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_40__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Index HUSER_INDEX added
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_41__CREATE_PLGM_DB.sql b/db/migrations/V0_41__CREATE_PLGM_DB.sql
index bbe4c5e..0b84eb9 100644
--- a/db/migrations/V0_41__CREATE_PLGM_DB.sql
+++ b/db/migrations/V0_41__CREATE_PLGM_DB.sql
@@ -1,15 +1,17 @@
-/*
-**********
-********************************************************************
-* Copyright © 2018 PTA GmbH.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-*
-*     http://www.eclipse.org/legal/epl-v10.html
-*
-******************************************************************************
-*/
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
 --Index HUSER_INDEX added
 
 -- ---------------------------------------------
diff --git a/db/migrations/V0_42__CREATE_PLGM_DB.sql b/db/migrations/V0_42__CREATE_PLGM_DB.sql
new file mode 100644
index 0000000..9717758
--- /dev/null
+++ b/db/migrations/V0_42__CREATE_PLGM_DB.sql
@@ -0,0 +1,3666 @@
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
+--Field COLOR_CODE added in Table REF_GM_STATUS, HREF_GM_STATUS, Insert-, Delete-, and Update-Triggers
+
+-- ---------------------------------------------
+-- DROPS
+-- ---------------------------------------------
+DROP TABLE IF EXISTS public.TBL_STEPS;
+DROP SEQUENCE IF EXISTS public.TBL_STEPS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_SINGLE_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS public.TBL_SINGLE_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_LOCK CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_LOCK_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_USER_DEPARTMENT CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_USER_DEPARTMENT_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_COST_CENTER CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_COST_CENTER_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_GRIDMEASURE CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH_LEVEL CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_LEVEL_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_GM_STATUS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_GM_STATUS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.tbl_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_measure_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_measure_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_id_counter CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_id_counter_id_seq;
+
+DROP TABLE IF EXISTS public.REF_TERRITORY CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_TERRITORY_ID_SEQ;
+
+
+DROP INDEX IF EXISTS public.huser_index;
+
+-- ---------------------------------------------
+-- TABLE REF_TERRITORY
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_TERRITORY_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_TERRITORY
+(
+  id integer NOT NULL DEFAULT nextval('REF_TERRITORY_ID_SEQ'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_TERRITORY_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_TERRITORY
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_TERRITORY TO plgm_service;
+
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Nord', 'Region Nord', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Ost', 'Region Ost', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('SUED', 'Region SUED', 'testuser','12.04.2018','testuser','12.04.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_LOCK
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.TBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.TBL_LOCK_ID_SEQ
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_lock
+(
+  id integer NOT NULL DEFAULT nextval('TBL_LOCK_ID_SEQ'::regclass),
+  key integer NOT NULL, -- Id from tbl_gridmeasure
+  username character varying(50) NOT NULL,
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_lock_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_lock
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_lock TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_lock_unique_key ON public.tbl_lock (key ASC, info ASC );
+
+-- ---------------------------------------------
+-- TABLE TBL_USER_SETTINGS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_user_settings_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_user_settings_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_user_settings
+(
+  id integer NOT NULL DEFAULT nextval('tbl_user_settings_id_seq'::regclass),
+  username character varying(50) NOT NULL,
+  setting_type character varying(50),
+  value character varying(4096),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_user_settings_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_user_settings
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_user_settings TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_user_set_unique_key ON public.tbl_user_settings (username ASC, setting_type ASC );
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_ID_COUNTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_id_counter_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_id_counter_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_id_counter
+(
+  id integer NOT NULL DEFAULT nextval('tbl_id_counter_id_seq'::regclass),
+  counter integer NOT NULL,
+  counter_type character varying(256),
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_id_counter_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_id_counter
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_id_counter TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_USER_DEPARTMENT
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_USER_DEPARTMENT_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 3
+  CACHE 1;
+ALTER TABLE public.REF_USER_DEPARTMENT_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_USER_DEPARTMENT
+(
+  id integer NOT NULL DEFAULT nextval('REF_USER_DEPARTMENT_ID_SEQ'::regclass),
+  name character varying(50) NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT ref_user_department_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_USER_DEPARTMENT
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_USER_DEPARTMENT TO plgm_service;
+
+
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Schnelle Truppe', 'testuser', '12.04.2018','testuser', '12.04.2018');
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Abt. Aufsicht', 'testuser', '12.04.2018','testuser', '12.04.2018');
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Abt. Wartung', 'testuser', '12.04.2018','testuser', '12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_COST_CENTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_COST_CENTER_ID_SEQ
+   INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_COST_CENTER_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_COST_CENTER
+(
+  id integer NOT NULL DEFAULT nextval('REF_COST_CENTER_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_COST_CENTER_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_COST_CENTER
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_COST_CENTER TO plgm_service;
+
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-155', 'Kostenstelle der Abteilung abc', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-004', 'Kostenstelle der Abteilung xyz', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-222', 'Kostenstelle der Abteilung hij', 'testuser','12.04.2018','testuser','12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_BRANCH
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_BRANCH
+(
+  ID integer NOT NULL DEFAULT nextval('REF_BRANCH_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  DESCRIPTION character varying(255),
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone  NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_BRANCH_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_BRANCH TO PLGM_SERVICE;
+
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('S', 'Strom', '#fc6042','testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('G', 'Gas', '#fdea64', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('F', 'Fernwärme', '#2cc990', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('W', 'Wasser', '#2c82c9', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+-- ---------------------------------------------
+-- TABLE REF_BRANCH_LEVEL
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_branch_level_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.ref_branch_level_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.ref_branch_level
+(
+  id integer NOT NULL DEFAULT nextval('ref_branch_level_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  fk_ref_branch integer NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT ref_branch_level_pkey PRIMARY KEY (id),
+  CONSTRAINT FK_REF_BRANCH_LEVEL__REF_BRANCH FOREIGN KEY (FK_REF_BRANCH)
+      REFERENCES public.REF_BRANCH (ID) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.ref_branch_level
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.ref_branch_level TO plgm_service;
+
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level1', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level2', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level3', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level1', 'eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level2', 'noch eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Fernwärme Level3', 'und noch eine Beschreibung', 3, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_GM_STATUS
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_GM_STATUS
+(
+  ID integer NOT NULL DEFAULT nextval('REF_GM_STATUS_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_GM_STATUS_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_GM_STATUS TO PLGM_SERVICE;
+
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (0,'Neu','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (1,'Beantragt','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (2,'Storniert','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (3,'Zur Genehmigung','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (4,'Genehmigt','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (5,'Angefordert','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (6,'Freigegeben','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (7,'Schalten aktiv','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (8,'In Arbeit','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (9,'Arbeit beendet','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (10,'Maßnahme beendet','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (11,'Geschlossen','system','09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, create_date, mod_user, mod_date)
+VALUES
+  (12,'Abgelehnt','system','17.06.2018','system','17.06.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_GRIDMEASURE
+-- ---------------------------------------------
+-- REQUESTER_NAME COLUMN DELETED--
+CREATE SEQUENCE public.TBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.TBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.tbl_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_gridmeasure_id_seq'::regclass),
+  id_descriptive character varying(50),
+  title character varying(256),
+  affected_resource character varying(256),
+  remark character varying(1024),
+  email_addresses character varying(1024),
+  fk_ref_gm_status integer,
+  switching_object character varying(256),
+  cost_center character varying(50),
+  approval_by character varying(256),
+  area_of_switching character varying(256),
+  appointment_repetition character varying(100),
+  appointment_startdate timestamp without time zone,
+  appointment_numberof integer,
+  planned_starttime_first_sequence timestamp without time zone,
+  planned_starttime_first_singlemeasure timestamp without time zone,
+  planned_endtime_last_singlemeasure timestamp without time zone,
+  planned_endtime_gridmeasure timestamp without time zone,
+  starttime_first_sequence timestamp without time zone,
+  starttime_first_singlemeasure timestamp without time zone,
+  endtime_last_singlemeasure timestamp without time zone,
+  endtime_gridmeasure timestamp without time zone,
+  time_of_reallocation character varying(100),
+  description character varying(1024),
+  fk_ref_branch integer,
+  fk_ref_branch_level integer,
+  create_user character varying(100) NOT NULL,
+  create_user_department character varying(100),
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_user_department character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_gridmeasure__gm_status FOREIGN KEY (fk_ref_gm_status)
+      REFERENCES public.ref_gm_status (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch FOREIGN KEY (fk_ref_branch)
+      REFERENCES public.ref_branch (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch_level FOREIGN KEY (fk_ref_branch_level)
+      REFERENCES public.ref_branch_level (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_gridmeasure TO plgm_service;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_1', 'Kabel erneuern', 'Kabel', 'Kabel defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 0,
+            'Kabel', 'K-155',
+            'otto', 'Frankfurt', 'einmalig', '2018-06-14 15:15:00',
+            7, '2018-06-09 15:00:00', '2018-06-10 16:30:00',
+            '2018-06-11 14:00:00', '2018-06-17 20:15:00',
+            '2018-06-14 15:15:00', '2018-06-15 15:45:00', '2018-06-16 13:00:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Das Kabel austauschen', 1,
+            1, 'otto', 4, '2018-06-09 15:00:00',
+            'otto', 3, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_2', 'Lampe erneuern', 'Lampe', 'Lampe defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 1,
+            'Lampe', 'K-004',
+            'jasper', 'Mannheim', 'einmalig', '2018-06-16 15:15:00',
+            3, '2018-06-11 15:00:00', '2018-06-12 16:30:00',
+            '2018-06-13 14:00:00', '2018-06-19 20:15:00',
+            '2018-06-16 15:15:00', '2018-06-17 15:45:00', '2018-06-18 13:00:00',
+            '2018-06-20 16:00:00', 'in zwei Tagen', 'Die Lampe austauschen', 2,
+            1, 'jasper', 3, '2018-06-11 15:00:00',
+            'jasper', 4, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_3', 'Transformator erneuern', 'Transformator', 'Transformator defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 2,
+            'Transformator', 'K-222',
+            'hugo', 'Murr', 'täglich', '2018-06-17 15:15:00',
+            6, '2018-06-12 15:00:00', '2018-06-13 16:30:00',
+            '2018-06-14 14:00:00', '2018-06-20 20:15:00',
+            '2018-06-17 15:15:00', '2018-06-18 15:45:00', '2018-06-19 13:00:00',
+            '2018-06-21 16:00:00', 'in 8 Tagen', 'Den Transformator austauschen', 4,
+            1, 'hugo', 4, '2018-06-12 15:00:00',
+            'otto', 4, '2018-06-17 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_4', 'Transformator ersetzen', 'Transformator', 'Transformator kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 3,
+            'Transformator', 'K-155',
+            'otto', 'Stuttgart', 'einmalig', '2018-06-18 15:15:00',
+            3, '2018-06-13 15:00:00', '2018-06-14 16:30:00',
+            '2018-06-15 14:00:00', '2018-06-21 20:15:00',
+            '2018-06-18 15:15:00', '2018-06-19 15:45:00', '2018-06-20 13:00:00',
+            '2018-06-22 16:00:00', 'in 9 Tagen', 'Den Transformator austauschen', 3,
+            1, 'otto', 4, '2018-06-13 15:00:00',
+            'otto', 5, '2018-06-18 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_5', 'Gas Station', 'Station', 'Station defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 4,
+            'Station', 'K-004',
+            'otto', 'Ludwigsburg', 'wöchentlich', '2018-07-14 15:15:00',
+            1, '2018-07-09 15:00:00', '2018-07-10 16:30:00',
+            '2018-07-11 14:00:00', '2018-07-17 20:15:00',
+            '2018-07-14 15:15:00', '2018-07-15 15:45:00', '2018-07-16 13:00:00',
+            '2018-07-18 16:00:00', 'in zwei Wochen', 'Die Gas Station untersuchen', 2,
+            1, 'otto', 5, '2018-07-09 15:00:00',
+            'otto', 3, '2018-07-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_6', 'Stuhl mit drei Beinen', 'Stuhl', 'Stuhl kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 5,
+            'Stuhl', 'K-155',
+            'otto', 'Hamburg', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-07 15:00:00', '2018-06-08 16:30:00',
+            '2018-06-09 14:00:00', '2018-06-15 20:15:00',
+            '2018-06-12 15:15:00', '2018-06-13 15:45:00', '2018-06-14 13:00:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Stuhl austauschen', 4,
+            1, 'claudio', 4, '2018-06-07 15:00:00',
+            'claudio', 3, '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_7', 'Kabel vergrößern', 'Kabel', 'Kabel zu kurz', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 6,
+            'Kabel', 'K-222',
+            'dagmar', 'Steinheim', 'einmalig', '2018-08-14 15:15:00',
+            27, '2018-08-09 15:00:00', '2018-08-10 16:30:00',
+            '2018-08-11 14:00:00', '2018-08-17 20:15:00',
+            '2018-08-14 15:15:00', '2018-08-15 15:45:00', '2018-06-16 13:00:00',
+            '2018-08-18 16:00:00', 'in zwei Wochen', 'Das Kabel vergrößern', 3,
+            1, 'claudio', 3, '2018-08-09 15:00:00',
+            'bruno', 5, '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_8', 'Transformator austauschen', 'Transformator', 'Transformator 160 Grads', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 7,
+            'Transformator', 'K-155',
+            'dagmar', 'Murr', 'täglich', '2018-06-14 15:15:00',
+            6, '2018-06-09 15:00:00', '2018-06-10 16:30:00',
+            '2018-06-11 14:00:00', '2018-06-17 20:15:00',
+            '2018-06-14 15:15:00', '2018-06-15 15:45:00', '2018-06-16 13:00:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Den Transformator austauschen', 1,
+            1, 'dagmar', 4, '2018-06-09 15:00:00',
+            'dagmar', 3, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_9', 'Alles kaputt', 'Alles', 'Alles defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 8,
+            'Alles', 'K-222',
+            'otto', 'Berlin', 'einmalig', '2018-06-15 15:15:00',
+            2, '2018-06-10 15:00:00', '2018-06-11 16:30:00',
+            '2018-06-12 14:00:00', '2018-06-18 20:15:00',
+            '2018-06-15 15:15:00', '2018-06-16 15:45:00', '2018-06-17 13:00:00',
+            '2018-06-19 16:00:00', 'in zwei Jahren', 'Alles wegwerfen', 2,
+            3, 'bruno', 5, '2018-06-10 15:00:00',
+            'claudio', 5, '2018-06-15 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_10', 'Schalter erneuern', 'Schalter', 'Schalter defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 9,
+            'Schalter', 'K-004',
+            'hugo', 'Kassel', 'einmalig', '2018-08-14 15:15:00',
+            9, '2018-08-09 15:00:00', '2018-08-10 16:30:00',
+            '2018-08-11 14:00:00', '2018-08-17 20:15:00',
+            '2018-08-14 15:15:00', '2018-08-15 15:45:00', '2018-08-16 13:00:00',
+            '2018-08-18 16:00:00', 'in 6 Tagen', 'Den Schalter austauschen', 1,
+            1, 'dagmar', 3, '2018-08-09 15:00:00',
+            'otto', 3, '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_11', 'Rechner austauschen', 'Rechner', 'Rechner defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 10,
+            'Rechner', 'K-155',
+            'claudio', 'Murr', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-07 15:00:00', '2018-06-08 16:30:00',
+            '2018-06-09 14:00:00', '2018-06-15 20:15:00',
+            '2018-06-12 15:15:00', '2018-06-13 15:45:00', '2018-06-14 13:00:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Rechner austauschen', 4,
+            1, 'hugo', 5, '2018-06-07 15:00:00',
+            'otto', 3, '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_12', 'Maschine untersuchen', 'Maschine', 'Maschine defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 11,
+            'Maschine', 'K-004',
+            'otto', 'Ludwigsburg', 'einmalig', '2018-06-20 15:15:00',
+            5, '2018-06-15 15:00:00', '2018-06-16 16:30:00',
+            '2018-06-17 14:00:00', '2018-06-23 20:15:00',
+            '2018-06-20 15:15:00', '2018-06-21 15:45:00', '2018-06-22 13:00:00',
+            '2018-06-24 16:00:00', 'in 8 Tagen', 'Die Maschine austauschen', 1,
+            1, 'bruno', 4, '2018-06-15 15:00:00',
+            'bruno', 3, '2018-06-20 15:15:00');
+
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_SINGLE_GRIDMEASURE
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_single_gridmeasure_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_single_gridmeasure_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_single_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_single_gridmeasure_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  title character varying(256),
+  switching_object character varying(256),
+  cim_id character varying(256),
+  cim_name character varying(256),
+  cim_description character varying(1024),
+  planned_starttime_singlemeasure timestamp without time zone,
+  planned_endtime_singlemeasure timestamp without time zone,
+  description character varying(1024),
+  responsible_onsite_name character varying(256),
+  responsible_onsite_department character varying(256),
+  network_control character varying(256),
+  fk_tbl_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_single_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_single_gridmeasure__gridmeasure FOREIGN KEY (fk_tbl_gridmeasure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_single_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_single_gridmeasure TO plgm_service;
+
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe ausschalten', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Kabel kürzen', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (3, 'Transformator tauschen', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe erneuern', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-12 16:30:00', '2018-06-13 14:00:00',
+            'Beschreibung', 2, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-13 16:30:00', '2018-06-14 14:00:00',
+            'Beschreibung', 3, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-14 16:30:00', '2018-06-15 14:00:00',
+            'Beschreibung', 4, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Gas', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Gas 2', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Stuhl', 'Stuhl', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 6, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Kabel', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 7, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Transformator 2', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Alles', 'Alles', '2', 'cim', 'cim Beschreibung',
+            '2018-06-11 16:30:00', '2018-06-12 14:00:00',
+            'Beschreibung', 9, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Schalter', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Schalter 2', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Rechner', 'Rechner', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 11, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Maschine', 'Maschine', '2', 'cim', 'cim Beschreibung',
+            '2018-06-16 16:30:00', '2018-06-17 14:00:00',
+            'Beschreibung', 12, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+
+-- ---------------------------------------------
+-- TABLE TBL_STEPS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_steps_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_steps_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_steps
+(
+  id integer NOT NULL DEFAULT nextval('tbl_steps_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  switching_object character varying(256),
+  type character varying(256),
+  present_time character varying(256),
+  present_state character varying(256),
+  target_state character varying(256),
+  operator character varying(256),
+  fk_tbl_single_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_steps_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_steps__single_gridmeasure FOREIGN KEY (fk_tbl_single_gridmeasure)
+      REFERENCES public.tbl_single_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_steps
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_steps TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_VERSION
+-- ---------------------------------------------
+
+DROP TABLE IF EXISTS public.REF_VERSION;
+
+CREATE TABLE public.REF_VERSION
+(
+  id integer NOT NULL,
+  version character varying(100) NOT NULL,
+  CONSTRAINT ref_version_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_VERSION
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_VERSION TO PLGM_SERVICE;
+
+INSERT INTO REF_VERSION VALUES (1, '0.0.1_PG');
+
+-- ---------------------------------------------
+-- TABLE TBL_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_documents_id_seq'::regclass),
+  document_name character varying(260),
+  document bytea,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_documents_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_documents TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE TBL_MEASURE_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_measure_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_measure_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_measure_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_measure_documents_id_seq'::regclass),
+  fk_tbl_measure integer,
+  fk_tbl_documents integer,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_measure_documents_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_tbl_measure_documents_measure FOREIGN KEY (fk_tbl_measure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE CASCADE,
+  CONSTRAINT fk_tbl_measure_documents_documents FOREIGN KEY (fk_tbl_documents)
+      REFERENCES public.tbl_documents (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_measure_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_measure_documents TO plgm_service;
+
+
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- HISTORY-TABLES
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+-- PUBLIC.HREF_TERRITORY Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_TERRITORY;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_TERRITORY_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_TERRITORY_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_TERRITORY
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_TERRITORY_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_TERRITORY_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_TERRITORY
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_TERRITORY TO PLGM_SERVICE;
+
+
+
+-- PUBLIC.HTBL_LOCK Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_LOCK;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_LOCK_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_LOCK_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_LOCK
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_LOCK_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  KEY integer,
+  USERNAME character varying (50),
+  INFO character varying (256),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_LOCK_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_LOCK
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_LOCK TO PLGM_SERVICE;
+
+
+
+
+-- PUBLIC.HTBL_USER_SETTINGS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_USER_SETTINGS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_USER_SETTINGS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_USER_SETTINGS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_USER_SETTINGS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  USERNAME character varying (50),
+  SETTING_TYPE character varying (50),
+  VALUE character varying(4096),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_USER_SETTINGS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_USER_SETTINGS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_USER_DEPARTMENT Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_USER_DEPARTMENT;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_USER_DEPARTMENT
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_USER_DEPARTMENT_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_USER_DEPARTMENT_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_USER_DEPARTMENT
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_USER_DEPARTMENT TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_COST_CENTER Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_COST_CENTER;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_COST_CENTER_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_COST_CENTER
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_COST_CENTER_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_COST_CENTER_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_COST_CENTER TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  COLOR_CODE character varying (20),
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH_LEVEL Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH_LEVEL
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_LEVEL_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  FK_REF_BRANCH integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_LEVEL_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH_LEVEL TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_GM_STATUS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_GM_STATUS;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_GM_STATUS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_GM_STATUS
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_GM_STATUS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying(50),
+  COLOR_CODE character varying(20),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_GM_STATUS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_GM_STATUS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HTBL_GRIDMEASURE Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+-- REQUESTER_NAME COLUMN DELETED--
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_GRIDMEASURE_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_GRIDMEASURE
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_GRIDMEASURE_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  ID_DESCRIPTIVE character varying (50),
+  TITLE character varying (256),
+  AFFECTED_RESOURCE character varying (256),
+  REMARK character varying (1024),
+  EMAIL_ADDRESSES character varying(1024),
+  FK_REF_GM_STATUS integer,
+  SWITCHING_OBJECT character varying (256),
+  COST_CENTER character varying (50),
+  APPROVAL_BY character varying (256),
+  AREA_OF_SWITCHING character varying (256),
+  APPOINTMENT_REPETITION character varying (100),
+  APPOINTMENT_STARTDATE timestamp without time zone,
+  APPOINTMENT_NUMBEROF integer,
+  PLANNED_STARTTIME_FIRST_SEQUENCE timestamp without time zone,
+  PLANNED_STARTTIME_FIRST_SINGLEMEASURE timestamp without time zone,
+  PLANNED_ENDTIME_LAST_SINGLEMEASURE timestamp without time zone,
+  PLANNED_ENDTIME_GRIDMEASURE timestamp without time zone,
+  STARTTIME_FIRST_SEQUENCE timestamp without time zone,
+  STARTTIME_FIRST_SINGLEMEASURE timestamp without time zone,
+  ENDTIME_LAST_SINGLEMEASURE timestamp without time zone,
+  ENDTIME_GRIDMEASURE timestamp without time zone,
+  TIME_OF_REALLOCATION character varying (100),
+  DESCRIPTION character varying (1024),
+  FK_REF_BRANCH integer,
+  FK_REF_BRANCH_LEVEL integer,
+  CREATE_USER_DEPARTMENT character varying (100),
+  MOD_USER_DEPARTMENT character varying (100),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_GRIDMEASURE_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_GRIDMEASURE TO PLGM_SERVICE;
+
+CREATE INDEX HUSER_INDEX ON PUBLIC.HTBL_GRIDMEASURE (HUSER);
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'otto',12,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'otto',12,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'otto',12,3, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'otto',12,4, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'otto',12,5, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'otto',12,6, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'otto',12,7, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'otto',12,8, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:09:00', 'otto',12,9, 'admin', '2018-06-11 14:09:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:10:00', 'otto',12,10, 'admin', '2018-06-11 14:10:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:11:00', 'otto',12,11, 'admin', '2018-06-11 14:11:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:55:00', 'admin',13,0, 'admin', '2018-07-01 14:55:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:56:00', 'admin',13,1, 'admin', '2018-07-01 14:56:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,3, 'admin', '2018-07-01 14:57:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,12, 'admin', '2018-07-01 14:57:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:00:00', 'admin',11,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:01:00', 'admin',11,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:02:00', 'admin',11,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:03:00', 'admin',11,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:04:00', 'admin',11,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:05:00', 'admin',11,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:06:00', 'admin',11,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:07:00', 'admin',11,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:08:00', 'admin',11,9, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:09:00', 'admin',11,10, 'admin', '2018-06-11 14:09:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',10,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',10,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',10,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',10,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',10,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',10,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',10,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',10,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'admin',10,9, 'admin', '2018-06-11 14:08:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',9,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',9,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',9,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',9,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',9,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',9,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',9,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',9,8, 'admin', '2018-06-11 14:07:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',8,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',8,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',8,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',8,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',8,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',8,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',8,7, 'admin', '2018-06-11 14:06:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',7,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',7,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',7,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',7,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',7,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',7,6, 'admin', '2018-06-11 14:05:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',6,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',6,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',6,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',6,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',6,5, 'admin', '2018-06-11 14:04:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',5,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',5,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',5,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',5,4, 'admin', '2018-06-11 14:03:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',4,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',4,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',4,3, 'admin', '2018-06-11 14:02:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',3,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',3,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',3,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',3,2, 'admin', '2018-06-11 14:03:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',2,0, 'jasper', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',2,1, 'jasper', '2018-06-11 14:01:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',1,0, 'otto', '2018-06-11 14:01:00');
+
+-- PUBLIC.HTBL_ID_COUNTER Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_ID_COUNTER;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_ID_COUNTER_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_ID_COUNTER_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_ID_COUNTER_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_ID_COUNTER
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_ID_COUNTER_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  COUNTER integer,
+  COUNTER_TYPE character varying (256),
+  INFO character varying (256),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_ID_COUNTER_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_ID_COUNTER
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_ID_COUNTER TO PLGM_SERVICE;
+
+
+
+-- PUBLIC.HTBL_SINGLE_GRIDMEASURE Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_SINGLE_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+
+
+CREATE TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_SINGLE_GRIDMEASURE_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  SORTORDER integer,
+  TITLE character varying (256),
+  SWITCHING_OBJECT character varying (256),
+  CIM_ID character varying (256),
+  CIM_NAME character varying (256),
+  CIM_DESCRIPTION character varying (1024),
+  RESPONSIBLE_ONSITE_NAME character varying(256),
+  RESPONSIBLE_ONSITE_DEPARTMENT character varying(256),
+  NETWORK_CONTROL character varying (256),
+  PLANNED_STARTTIME_SINGLEMEASURE timestamp without time zone,
+  PLANNED_ENDTIME_SINGLEMEASURE timestamp without time zone,
+  DESCRIPTION character varying (1024),
+  FK_TBL_GRIDMEASURE integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_SINGLE_GRIDMEASURE_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE TO PLGM_SERVICE;
+
+
+
+
+-- PUBLIC.HTBL_STEPS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_STEPS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_STEPS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_STEPS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_STEPS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_STEPS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_STEPS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  SORTORDER integer,
+  SWITCHING_OBJECT character varying (256),
+  TYPE character varying(256),
+  PRESENT_TIME character varying(256),
+  PRESENT_STATE character varying(256),
+  TARGET_STATE character varying (256),
+  OPERATOR character varying(256),
+  FK_TBL_SINGLE_GRIDMEASURE integer,
+  CREATE_USER character varying (100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying (100),
+  MOD_DATE timestamp without time zone,
+
+  CONSTRAINT HTBL_STEPS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_STEPS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_STEPS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HTBL_DOCUMENTS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_DOCUMENTS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_DOCUMENTS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_DOCUMENTS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_DOCUMENTS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_DOCUMENTS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_DOCUMENTS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  DOCUMENT_NAME character varying (260),
+  DOCUMENT bytea,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_DOCUMENTS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_DOCUMENTS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_DOCUMENTS TO PLGM_SERVICE;
+
+-- PUBLIC.HTBL_MEASURE_DOCUMENTS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_MEASURE_DOCUMENTS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_MEASURE_DOCUMENTS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  FK_TBL_MEASURE integer,
+  FK_TBL_DOCUMENTS integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_MEASURE_DOCUMENTS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS TO PLGM_SERVICE;
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- TRIGGER
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+-- ---------------------------------------------
+-- TRIGGER REF_TERRITORY
+-- ---------------------------------------------
+
+
+-- PUBLIC.REF_TERRITORY INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_TERRITORY (
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_INSERT_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_TERRITORY UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_TERRITORY (
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_UPDATE_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_TERRITORY DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_TERRITORY (
+
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_DELETE_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_DELETE_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_ID_COUNTER (
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.COUNTER,NEW.COUNTER_TYPE,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_INSERT_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_ID_COUNTER (
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.COUNTER,NEW.COUNTER_TYPE,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_UPDATE_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_ID_COUNTER (
+
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.COUNTER,OLD.COUNTER_TYPE,OLD.INFO,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_DELETE_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_DELETE_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION, RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT,NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.SORTORDER,NEW.TITLE,NEW.SWITCHING_OBJECT,NEW.CIM_ID,NEW.CIM_NAME,NEW.CIM_DESCRIPTION,NEW.PLANNED_STARTTIME_SINGLEMEASURE,NEW.PLANNED_ENDTIME_SINGLEMEASURE,NEW.DESCRIPTION, NEW.RESPONSIBLE_ONSITE_NAME, NEW.RESPONSIBLE_ONSITE_DEPARTMENT,NEW.NETWORK_CONTROL,NEW.FK_TBL_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_INSERT_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION,RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT,NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.SORTORDER,NEW.TITLE,NEW.SWITCHING_OBJECT,NEW.CIM_ID,NEW.CIM_NAME,NEW.CIM_DESCRIPTION,NEW.PLANNED_STARTTIME_SINGLEMEASURE,NEW.PLANNED_ENDTIME_SINGLEMEASURE,NEW.DESCRIPTION,NEW.RESPONSIBLE_ONSITE_NAME, NEW.RESPONSIBLE_ONSITE_DEPARTMENT,NEW.NETWORK_CONTROL,NEW.FK_TBL_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_UPDATE_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION,RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT, NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.SORTORDER,OLD.TITLE,OLD.SWITCHING_OBJECT,OLD.CIM_ID,OLD.CIM_NAME,OLD.CIM_DESCRIPTION,OLD.PLANNED_STARTTIME_SINGLEMEASURE,OLD.PLANNED_ENDTIME_SINGLEMEASURE,OLD.DESCRIPTION,OLD.RESPONSIBLE_ONSITE_NAME, OLD.RESPONSIBLE_ONSITE_DEPARTMENT,OLD.NETWORK_CONTROL,OLD.FK_TBL_GRIDMEASURE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_DELETE_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG();
+
+
+
+
+
+-- PUBLIC.TBL_STEPS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_STEPS (
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR, FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.SORTORDER,NEW.SWITCHING_OBJECT,NEW.TYPE, NEW.PRESENT_TIME, NEW.PRESENT_STATE, NEW.TARGET_STATE, NEW.OPERATOR, NEW.FK_TBL_SINGLE_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_INSERT_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_STEPS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_STEPS (
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR,FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.SORTORDER,NEW.SWITCHING_OBJECT,NEW.TYPE,NEW.PRESENT_TIME, NEW.PRESENT_STATE, NEW.TARGET_STATE, NEW.OPERATOR,NEW.FK_TBL_SINGLE_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_UPDATE_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_STEPS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_STEPS (
+
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR,FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.SORTORDER,OLD.SWITCHING_OBJECT,OLD.TYPE,OLD.PRESENT_TIME, OLD.PRESENT_STATE, OLD.TARGET_STATE, OLD.OPERATOR,OLD.FK_TBL_SINGLE_GRIDMEASURE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_DELETE_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_DELETE_TRG();
+
+
+-- PUBLIC.TBL_LOCK INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_LOCK (
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.KEY,NEW.USERNAME,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_LOCK_INSERT_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_LOCK UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_LOCK (
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.KEY,NEW.USERNAME,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_LOCK_UPDATE_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_LOCK DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_LOCK (
+
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.KEY,OLD.USERNAME,OLD.INFO,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_LOCK_DELETE_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_DELETE_TRG();
+
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_USER_SETTINGS (
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.USERNAME,NEW.SETTING_TYPE,NEW.VALUE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_INSERT_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_USER_SETTINGS (
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.USERNAME,NEW.SETTING_TYPE,NEW.VALUE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_UPDATE_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_USER_SETTINGS (
+
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.USERNAME,OLD.SETTING_TYPE,OLD.VALUE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_DELETE_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_USER_DEPARTMENT (
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_INSERT_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_USER_DEPARTMENT (
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_UPDATE_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_USER_DEPARTMENT (
+
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_DELETE_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG();
+
+
+-- PUBLIC.HREF_COST_CENTER INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HHREF_COST_CENTER (
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.HID,NEW.HACTION,NEW.HDATE,NEW.HUSER,NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_INSERT_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_INSERT_TRG();
+
+
+
+-- PUBLIC.HREF_COST_CENTER UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HHREF_COST_CENTER (
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.HID,NEW.HACTION,NEW.HDATE,NEW.HUSER,NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_UPDATE_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_UPDATE_TRG();
+
+
+
+-- PUBLIC.HREF_COST_CENTER DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HHREF_COST_CENTER (
+
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.HID,OLD.HACTION,OLD.HDATE,OLD.HUSER,OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_DELETE_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH (
+
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_BRANCH_INSERT_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH (
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_UPDATE_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_BRANCH (
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.COLOR_CODE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_DELETE_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH_LEVEL (
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_INSERT_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH_LEVEL (
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_UPDATE_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_BRANCH_LEVEL (
+
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.FK_REF_BRANCH,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_DELETE_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG();
+
+
+
+
+
+-- PUBLIC.REF_GM_STATUS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_GM_STATUS (
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_INSERT_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_GM_STATUS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_GM_STATUS (
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_UPDATE_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_GM_STATUS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_GM_STATUS (
+
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.COLOR_CODE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_DELETE_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_DELETE_TRG();
+
+
+
+
+
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_GRIDMEASURE (
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SEQUENCE,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,PLANNED_ENDTIME_LAST_SINGLEMEASURE,PLANNED_ENDTIME_GRIDMEASURE,STARTTIME_FIRST_SEQUENCE,STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_LAST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.ID_DESCRIPTIVE,NEW.TITLE,NEW.AFFECTED_RESOURCE,NEW.REMARK,NEW.EMAIL_ADDRESSES,NEW.FK_REF_GM_STATUS,NEW.SWITCHING_OBJECT,NEW.COST_CENTER,NEW.APPROVAL_BY,NEW.AREA_OF_SWITCHING,NEW.APPOINTMENT_REPETITION,NEW.APPOINTMENT_STARTDATE,NEW.APPOINTMENT_NUMBEROF,NEW.PLANNED_STARTTIME_FIRST_SEQUENCE,NEW.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_LAST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_GRIDMEASURE,NEW.STARTTIME_FIRST_SEQUENCE,NEW.STARTTIME_FIRST_SINGLEMEASURE,NEW.ENDTIME_LAST_SINGLEMEASURE,NEW.ENDTIME_GRIDMEASURE,NEW.TIME_OF_REALLOCATION,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.FK_REF_BRANCH_LEVEL,NEW.CREATE_USER,NEW.CREATE_USER_DEPARTMENT,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_USER_DEPARTMENT,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_INSERT_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_GRIDMEASURE (
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SEQUENCE,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,PLANNED_ENDTIME_LAST_SINGLEMEASURE,PLANNED_ENDTIME_GRIDMEASURE,STARTTIME_FIRST_SEQUENCE,STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_LAST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.ID_DESCRIPTIVE,NEW.TITLE,NEW.AFFECTED_RESOURCE,NEW.REMARK,NEW.EMAIL_ADDRESSES,NEW.FK_REF_GM_STATUS,NEW.SWITCHING_OBJECT,NEW.COST_CENTER,NEW.APPROVAL_BY,NEW.AREA_OF_SWITCHING,NEW.APPOINTMENT_REPETITION,NEW.APPOINTMENT_STARTDATE,NEW.APPOINTMENT_NUMBEROF,NEW.PLANNED_STARTTIME_FIRST_SEQUENCE,NEW.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_LAST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_GRIDMEASURE,NEW.STARTTIME_FIRST_SEQUENCE,NEW.STARTTIME_FIRST_SINGLEMEASURE,NEW.ENDTIME_LAST_SINGLEMEASURE,NEW.ENDTIME_GRIDMEASURE,NEW.TIME_OF_REALLOCATION,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.FK_REF_BRANCH_LEVEL,NEW.CREATE_USER,NEW.CREATE_USER_DEPARTMENT,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_USER_DEPARTMENT,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_UPDATE_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_GRIDMEASURE (
+
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SEQUENCE,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,PLANNED_ENDTIME_LAST_SINGLEMEASURE,PLANNED_ENDTIME_GRIDMEASURE,STARTTIME_FIRST_SEQUENCE,STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_LAST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.ID_DESCRIPTIVE,OLD.TITLE,OLD.AFFECTED_RESOURCE,OLD.REMARK,OLD.EMAIL_ADDRESSES,OLD.FK_REF_GM_STATUS,OLD.SWITCHING_OBJECT,OLD.COST_CENTER,OLD.APPROVAL_BY,OLD.AREA_OF_SWITCHING,OLD.APPOINTMENT_REPETITION,OLD.APPOINTMENT_STARTDATE,OLD.APPOINTMENT_NUMBEROF,OLD.PLANNED_STARTTIME_FIRST_SEQUENCE,OLD.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,OLD.PLANNED_ENDTIME_LAST_SINGLEMEASURE,OLD.PLANNED_ENDTIME_GRIDMEASURE,OLD.STARTTIME_FIRST_SEQUENCE,OLD.STARTTIME_FIRST_SINGLEMEASURE,OLD.ENDTIME_LAST_SINGLEMEASURE,OLD.ENDTIME_GRIDMEASURE,OLD.TIME_OF_REALLOCATION,OLD.DESCRIPTION,OLD.FK_REF_BRANCH,OLD.FK_REF_BRANCH_LEVEL,OLD.CREATE_USER,OLD.CREATE_USER_DEPARTMENT,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_USER_DEPARTMENT,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_DELETE_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_DELETE_TRG();
+
+
+-- PUBLIC.TBL_DOCUMENTS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_DOCUMENTS (
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.DOCUMENT_NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_INSERT_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_DOCUMENTS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_DOCUMENTS (
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.DOCUMENT_NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_UPDATE_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_DOCUMENTS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_DOCUMENTS (
+
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.DOCUMENT_NAME,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_DELETE_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_DELETE_TRG();
+
+
+
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.FK_TBL_MEASURE,NEW.FK_TBL_DOCUMENTS,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_INSERT_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.FK_TBL_MEASURE,NEW.FK_TBL_DOCUMENTS,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_UPDATE_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.FK_TBL_MEASURE,OLD.FK_TBL_DOCUMENTS,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_DELETE_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG();
diff --git a/db/migrations/V0_43__CREATE_PLGM_DB.sql b/db/migrations/V0_43__CREATE_PLGM_DB.sql
new file mode 100644
index 0000000..1a5ffa7
--- /dev/null
+++ b/db/migrations/V0_43__CREATE_PLGM_DB.sql
@@ -0,0 +1,3666 @@
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
+--Field COLOR_CODE added in Table REF_GM_STATUS, HREF_GM_STATUS, Insert-, Delete-, and Update-Triggers
+
+-- ---------------------------------------------
+-- DROPS
+-- ---------------------------------------------
+DROP TABLE IF EXISTS public.TBL_STEPS;
+DROP SEQUENCE IF EXISTS public.TBL_STEPS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_SINGLE_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS public.TBL_SINGLE_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_LOCK CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_LOCK_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_USER_DEPARTMENT CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_USER_DEPARTMENT_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_COST_CENTER CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_COST_CENTER_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_GRIDMEASURE CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH_LEVEL CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_LEVEL_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_GM_STATUS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_GM_STATUS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.tbl_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_measure_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_measure_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_id_counter CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_id_counter_id_seq;
+
+DROP TABLE IF EXISTS public.REF_TERRITORY CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_TERRITORY_ID_SEQ;
+
+
+DROP INDEX IF EXISTS public.huser_index;
+
+-- ---------------------------------------------
+-- TABLE REF_TERRITORY
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_TERRITORY_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_TERRITORY
+(
+  id integer NOT NULL DEFAULT nextval('REF_TERRITORY_ID_SEQ'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_TERRITORY_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_TERRITORY
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_TERRITORY TO plgm_service;
+
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Nord', 'Region Nord', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Ost', 'Region Ost', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('SUED', 'Region SUED', 'testuser','12.04.2018','testuser','12.04.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_LOCK
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.TBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.TBL_LOCK_ID_SEQ
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_lock
+(
+  id integer NOT NULL DEFAULT nextval('TBL_LOCK_ID_SEQ'::regclass),
+  key integer NOT NULL, -- Id from tbl_gridmeasure
+  username character varying(50) NOT NULL,
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_lock_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_lock
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_lock TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_lock_unique_key ON public.tbl_lock (key ASC, info ASC );
+
+-- ---------------------------------------------
+-- TABLE TBL_USER_SETTINGS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_user_settings_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_user_settings_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_user_settings
+(
+  id integer NOT NULL DEFAULT nextval('tbl_user_settings_id_seq'::regclass),
+  username character varying(50) NOT NULL,
+  setting_type character varying(50),
+  value character varying(4096),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_user_settings_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_user_settings
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_user_settings TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_user_set_unique_key ON public.tbl_user_settings (username ASC, setting_type ASC );
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_ID_COUNTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_id_counter_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_id_counter_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_id_counter
+(
+  id integer NOT NULL DEFAULT nextval('tbl_id_counter_id_seq'::regclass),
+  counter integer NOT NULL,
+  counter_type character varying(256),
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_id_counter_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_id_counter
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_id_counter TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_USER_DEPARTMENT
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_USER_DEPARTMENT_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 3
+  CACHE 1;
+ALTER TABLE public.REF_USER_DEPARTMENT_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_USER_DEPARTMENT
+(
+  id integer NOT NULL DEFAULT nextval('REF_USER_DEPARTMENT_ID_SEQ'::regclass),
+  name character varying(50) NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT ref_user_department_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_USER_DEPARTMENT
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_USER_DEPARTMENT TO plgm_service;
+
+
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Schnelle Truppe', 'testuser', '12.04.2018','testuser', '12.04.2018');
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Abt. Aufsicht', 'testuser', '12.04.2018','testuser', '12.04.2018');
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Abt. Wartung', 'testuser', '12.04.2018','testuser', '12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_COST_CENTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_COST_CENTER_ID_SEQ
+   INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_COST_CENTER_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_COST_CENTER
+(
+  id integer NOT NULL DEFAULT nextval('REF_COST_CENTER_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_COST_CENTER_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_COST_CENTER
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_COST_CENTER TO plgm_service;
+
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-155', 'Kostenstelle der Abteilung abc', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-004', 'Kostenstelle der Abteilung xyz', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-222', 'Kostenstelle der Abteilung hij', 'testuser','12.04.2018','testuser','12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_BRANCH
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_BRANCH
+(
+  ID integer NOT NULL DEFAULT nextval('REF_BRANCH_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  DESCRIPTION character varying(255),
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone  NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_BRANCH_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_BRANCH TO PLGM_SERVICE;
+
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('S', 'Strom', '#fc6042','testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('G', 'Gas', '#fdea64', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('F', 'Fernwärme', '#2cc990', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('W', 'Wasser', '#2c82c9', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+-- ---------------------------------------------
+-- TABLE REF_BRANCH_LEVEL
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_branch_level_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.ref_branch_level_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.ref_branch_level
+(
+  id integer NOT NULL DEFAULT nextval('ref_branch_level_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  fk_ref_branch integer NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT ref_branch_level_pkey PRIMARY KEY (id),
+  CONSTRAINT FK_REF_BRANCH_LEVEL__REF_BRANCH FOREIGN KEY (FK_REF_BRANCH)
+      REFERENCES public.REF_BRANCH (ID) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.ref_branch_level
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.ref_branch_level TO plgm_service;
+
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level1', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level2', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level3', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level1', 'eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level2', 'noch eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Fernwärme Level3', 'und noch eine Beschreibung', 3, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_GM_STATUS
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_GM_STATUS
+(
+  ID integer NOT NULL DEFAULT nextval('REF_GM_STATUS_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_GM_STATUS_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_GM_STATUS TO PLGM_SERVICE;
+
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (0,'Neu','system', '#79b61c', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (1,'Beantragt','system', '#6db12d', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (2,'Storniert','system', '#990000', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (3,'Zur Genehmigung','system', '#60ab3f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (4,'Genehmigt','system', '#54a650', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (5,'Angefordert','system', '#379979', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (6,'Freigegeben','system', '#1c8d9f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (7,'Schalten aktiv','system', '#1c8d9f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (8,'In Arbeit','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (9,'Arbeit beendet','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (10,'Maßnahme beendet','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (11,'Geschlossen','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (12,'Abgelehnt','system', '#990000', '17.06.2018','system','17.06.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_GRIDMEASURE
+-- ---------------------------------------------
+-- REQUESTER_NAME COLUMN DELETED--
+CREATE SEQUENCE public.TBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.TBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.tbl_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_gridmeasure_id_seq'::regclass),
+  id_descriptive character varying(50),
+  title character varying(256),
+  affected_resource character varying(256),
+  remark character varying(1024),
+  email_addresses character varying(1024),
+  fk_ref_gm_status integer,
+  switching_object character varying(256),
+  cost_center character varying(50),
+  approval_by character varying(256),
+  area_of_switching character varying(256),
+  appointment_repetition character varying(100),
+  appointment_startdate timestamp without time zone,
+  appointment_numberof integer,
+  planned_starttime_first_sequence timestamp without time zone,
+  planned_starttime_first_singlemeasure timestamp without time zone,
+  planned_endtime_last_singlemeasure timestamp without time zone,
+  planned_endtime_gridmeasure timestamp without time zone,
+  starttime_first_sequence timestamp without time zone,
+  starttime_first_singlemeasure timestamp without time zone,
+  endtime_last_singlemeasure timestamp without time zone,
+  endtime_gridmeasure timestamp without time zone,
+  time_of_reallocation character varying(100),
+  description character varying(1024),
+  fk_ref_branch integer,
+  fk_ref_branch_level integer,
+  create_user character varying(100) NOT NULL,
+  create_user_department character varying(100),
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_user_department character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_gridmeasure__gm_status FOREIGN KEY (fk_ref_gm_status)
+      REFERENCES public.ref_gm_status (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch FOREIGN KEY (fk_ref_branch)
+      REFERENCES public.ref_branch (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch_level FOREIGN KEY (fk_ref_branch_level)
+      REFERENCES public.ref_branch_level (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_gridmeasure TO plgm_service;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_1', 'Kabel erneuern', 'Kabel', 'Kabel defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 0,
+            'Kabel', 'K-155',
+            'otto', 'Frankfurt', 'einmalig', '2018-06-14 15:15:00',
+            7, '2018-06-09 15:00:00', '2018-06-10 16:30:00',
+            '2018-06-11 14:00:00', '2018-06-17 20:15:00',
+            '2018-06-14 15:15:00', '2018-06-15 15:45:00', '2018-06-16 13:00:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Das Kabel austauschen', 1,
+            1, 'otto', 4, '2018-06-09 15:00:00',
+            'otto', 3, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_2', 'Lampe erneuern', 'Lampe', 'Lampe defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 1,
+            'Lampe', 'K-004',
+            'jasper', 'Mannheim', 'einmalig', '2018-06-16 15:15:00',
+            3, '2018-06-11 15:00:00', '2018-06-12 16:30:00',
+            '2018-06-13 14:00:00', '2018-06-19 20:15:00',
+            '2018-06-16 15:15:00', '2018-06-17 15:45:00', '2018-06-18 13:00:00',
+            '2018-06-20 16:00:00', 'in zwei Tagen', 'Die Lampe austauschen', 2,
+            1, 'jasper', 3, '2018-06-11 15:00:00',
+            'jasper', 4, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_3', 'Transformator erneuern', 'Transformator', 'Transformator defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 2,
+            'Transformator', 'K-222',
+            'hugo', 'Murr', 'täglich', '2018-06-17 15:15:00',
+            6, '2018-06-12 15:00:00', '2018-06-13 16:30:00',
+            '2018-06-14 14:00:00', '2018-06-20 20:15:00',
+            '2018-06-17 15:15:00', '2018-06-18 15:45:00', '2018-06-19 13:00:00',
+            '2018-06-21 16:00:00', 'in 8 Tagen', 'Den Transformator austauschen', 4,
+            1, 'hugo', 4, '2018-06-12 15:00:00',
+            'otto', 4, '2018-06-17 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_4', 'Transformator ersetzen', 'Transformator', 'Transformator kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 3,
+            'Transformator', 'K-155',
+            'otto', 'Stuttgart', 'einmalig', '2018-06-18 15:15:00',
+            3, '2018-06-13 15:00:00', '2018-06-14 16:30:00',
+            '2018-06-15 14:00:00', '2018-06-21 20:15:00',
+            '2018-06-18 15:15:00', '2018-06-19 15:45:00', '2018-06-20 13:00:00',
+            '2018-06-22 16:00:00', 'in 9 Tagen', 'Den Transformator austauschen', 3,
+            1, 'otto', 4, '2018-06-13 15:00:00',
+            'otto', 5, '2018-06-18 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_5', 'Gas Station', 'Station', 'Station defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 4,
+            'Station', 'K-004',
+            'otto', 'Ludwigsburg', 'wöchentlich', '2018-07-14 15:15:00',
+            1, '2018-07-09 15:00:00', '2018-07-10 16:30:00',
+            '2018-07-11 14:00:00', '2018-07-17 20:15:00',
+            '2018-07-14 15:15:00', '2018-07-15 15:45:00', '2018-07-16 13:00:00',
+            '2018-07-18 16:00:00', 'in zwei Wochen', 'Die Gas Station untersuchen', 2,
+            1, 'otto', 5, '2018-07-09 15:00:00',
+            'otto', 3, '2018-07-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_6', 'Stuhl mit drei Beinen', 'Stuhl', 'Stuhl kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 5,
+            'Stuhl', 'K-155',
+            'otto', 'Hamburg', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-07 15:00:00', '2018-06-08 16:30:00',
+            '2018-06-09 14:00:00', '2018-06-15 20:15:00',
+            '2018-06-12 15:15:00', '2018-06-13 15:45:00', '2018-06-14 13:00:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Stuhl austauschen', 4,
+            1, 'claudio', 4, '2018-06-07 15:00:00',
+            'claudio', 3, '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_7', 'Kabel vergrößern', 'Kabel', 'Kabel zu kurz', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 6,
+            'Kabel', 'K-222',
+            'dagmar', 'Steinheim', 'einmalig', '2018-08-14 15:15:00',
+            27, '2018-08-09 15:00:00', '2018-08-10 16:30:00',
+            '2018-08-11 14:00:00', '2018-08-17 20:15:00',
+            '2018-08-14 15:15:00', '2018-08-15 15:45:00', '2018-06-16 13:00:00',
+            '2018-08-18 16:00:00', 'in zwei Wochen', 'Das Kabel vergrößern', 3,
+            1, 'claudio', 3, '2018-08-09 15:00:00',
+            'bruno', 5, '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_8', 'Transformator austauschen', 'Transformator', 'Transformator 160 Grads', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 7,
+            'Transformator', 'K-155',
+            'dagmar', 'Murr', 'täglich', '2018-06-14 15:15:00',
+            6, '2018-06-09 15:00:00', '2018-06-10 16:30:00',
+            '2018-06-11 14:00:00', '2018-06-17 20:15:00',
+            '2018-06-14 15:15:00', '2018-06-15 15:45:00', '2018-06-16 13:00:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Den Transformator austauschen', 1,
+            1, 'dagmar', 4, '2018-06-09 15:00:00',
+            'dagmar', 3, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_9', 'Alles kaputt', 'Alles', 'Alles defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 8,
+            'Alles', 'K-222',
+            'otto', 'Berlin', 'einmalig', '2018-06-15 15:15:00',
+            2, '2018-06-10 15:00:00', '2018-06-11 16:30:00',
+            '2018-06-12 14:00:00', '2018-06-18 20:15:00',
+            '2018-06-15 15:15:00', '2018-06-16 15:45:00', '2018-06-17 13:00:00',
+            '2018-06-19 16:00:00', 'in zwei Jahren', 'Alles wegwerfen', 2,
+            3, 'bruno', 5, '2018-06-10 15:00:00',
+            'claudio', 5, '2018-06-15 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_10', 'Schalter erneuern', 'Schalter', 'Schalter defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 9,
+            'Schalter', 'K-004',
+            'hugo', 'Kassel', 'einmalig', '2018-08-14 15:15:00',
+            9, '2018-08-09 15:00:00', '2018-08-10 16:30:00',
+            '2018-08-11 14:00:00', '2018-08-17 20:15:00',
+            '2018-08-14 15:15:00', '2018-08-15 15:45:00', '2018-08-16 13:00:00',
+            '2018-08-18 16:00:00', 'in 6 Tagen', 'Den Schalter austauschen', 1,
+            1, 'dagmar', 3, '2018-08-09 15:00:00',
+            'otto', 3, '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_11', 'Rechner austauschen', 'Rechner', 'Rechner defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 10,
+            'Rechner', 'K-155',
+            'claudio', 'Murr', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-07 15:00:00', '2018-06-08 16:30:00',
+            '2018-06-09 14:00:00', '2018-06-15 20:15:00',
+            '2018-06-12 15:15:00', '2018-06-13 15:45:00', '2018-06-14 13:00:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Rechner austauschen', 4,
+            1, 'hugo', 5, '2018-06-07 15:00:00',
+            'otto', 3, '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_sequence, planned_starttime_first_singlemeasure,
+            planned_endtime_last_singlemeasure, planned_endtime_gridmeasure,
+            starttime_first_sequence, starttime_first_singlemeasure, endtime_last_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_12', 'Maschine untersuchen', 'Maschine', 'Maschine defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 11,
+            'Maschine', 'K-004',
+            'otto', 'Ludwigsburg', 'einmalig', '2018-06-20 15:15:00',
+            5, '2018-06-15 15:00:00', '2018-06-16 16:30:00',
+            '2018-06-17 14:00:00', '2018-06-23 20:15:00',
+            '2018-06-20 15:15:00', '2018-06-21 15:45:00', '2018-06-22 13:00:00',
+            '2018-06-24 16:00:00', 'in 8 Tagen', 'Die Maschine austauschen', 1,
+            1, 'bruno', 4, '2018-06-15 15:00:00',
+            'bruno', 3, '2018-06-20 15:15:00');
+
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_SINGLE_GRIDMEASURE
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_single_gridmeasure_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_single_gridmeasure_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_single_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_single_gridmeasure_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  title character varying(256),
+  switching_object character varying(256),
+  cim_id character varying(256),
+  cim_name character varying(256),
+  cim_description character varying(1024),
+  planned_starttime_singlemeasure timestamp without time zone,
+  planned_endtime_singlemeasure timestamp without time zone,
+  description character varying(1024),
+  responsible_onsite_name character varying(256),
+  responsible_onsite_department character varying(256),
+  network_control character varying(256),
+  fk_tbl_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_single_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_single_gridmeasure__gridmeasure FOREIGN KEY (fk_tbl_gridmeasure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_single_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_single_gridmeasure TO plgm_service;
+
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe ausschalten', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Kabel kürzen', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (3, 'Transformator tauschen', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe erneuern', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-12 16:30:00', '2018-06-13 14:00:00',
+            'Beschreibung', 2, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-13 16:30:00', '2018-06-14 14:00:00',
+            'Beschreibung', 3, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-14 16:30:00', '2018-06-15 14:00:00',
+            'Beschreibung', 4, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Gas', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Gas 2', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Stuhl', 'Stuhl', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 6, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Kabel', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 7, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Transformator 2', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Alles', 'Alles', '2', 'cim', 'cim Beschreibung',
+            '2018-06-11 16:30:00', '2018-06-12 14:00:00',
+            'Beschreibung', 9, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Schalter', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Schalter 2', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Rechner', 'Rechner', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 11, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Maschine', 'Maschine', '2', 'cim', 'cim Beschreibung',
+            '2018-06-16 16:30:00', '2018-06-17 14:00:00',
+            'Beschreibung', 12, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+
+-- ---------------------------------------------
+-- TABLE TBL_STEPS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_steps_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_steps_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_steps
+(
+  id integer NOT NULL DEFAULT nextval('tbl_steps_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  switching_object character varying(256),
+  type character varying(256),
+  present_time character varying(256),
+  present_state character varying(256),
+  target_state character varying(256),
+  operator character varying(256),
+  fk_tbl_single_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_steps_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_steps__single_gridmeasure FOREIGN KEY (fk_tbl_single_gridmeasure)
+      REFERENCES public.tbl_single_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_steps
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_steps TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_VERSION
+-- ---------------------------------------------
+
+DROP TABLE IF EXISTS public.REF_VERSION;
+
+CREATE TABLE public.REF_VERSION
+(
+  id integer NOT NULL,
+  version character varying(100) NOT NULL,
+  CONSTRAINT ref_version_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_VERSION
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_VERSION TO PLGM_SERVICE;
+
+INSERT INTO REF_VERSION VALUES (1, '0.0.1_PG');
+
+-- ---------------------------------------------
+-- TABLE TBL_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_documents_id_seq'::regclass),
+  document_name character varying(260),
+  document bytea,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_documents_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_documents TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE TBL_MEASURE_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_measure_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_measure_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_measure_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_measure_documents_id_seq'::regclass),
+  fk_tbl_measure integer,
+  fk_tbl_documents integer,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_measure_documents_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_tbl_measure_documents_measure FOREIGN KEY (fk_tbl_measure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE CASCADE,
+  CONSTRAINT fk_tbl_measure_documents_documents FOREIGN KEY (fk_tbl_documents)
+      REFERENCES public.tbl_documents (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_measure_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_measure_documents TO plgm_service;
+
+
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- HISTORY-TABLES
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+-- PUBLIC.HREF_TERRITORY Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_TERRITORY;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_TERRITORY_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_TERRITORY_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_TERRITORY
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_TERRITORY_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_TERRITORY_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_TERRITORY
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_TERRITORY TO PLGM_SERVICE;
+
+
+
+-- PUBLIC.HTBL_LOCK Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_LOCK;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_LOCK_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_LOCK_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_LOCK
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_LOCK_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  KEY integer,
+  USERNAME character varying (50),
+  INFO character varying (256),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_LOCK_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_LOCK
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_LOCK TO PLGM_SERVICE;
+
+
+
+
+-- PUBLIC.HTBL_USER_SETTINGS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_USER_SETTINGS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_USER_SETTINGS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_USER_SETTINGS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_USER_SETTINGS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  USERNAME character varying (50),
+  SETTING_TYPE character varying (50),
+  VALUE character varying(4096),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_USER_SETTINGS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_USER_SETTINGS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_USER_DEPARTMENT Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_USER_DEPARTMENT;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_USER_DEPARTMENT
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_USER_DEPARTMENT_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_USER_DEPARTMENT_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_USER_DEPARTMENT
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_USER_DEPARTMENT TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_COST_CENTER Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_COST_CENTER;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_COST_CENTER_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_COST_CENTER
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_COST_CENTER_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_COST_CENTER_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_COST_CENTER TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  COLOR_CODE character varying (20),
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH_LEVEL Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH_LEVEL
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_LEVEL_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  FK_REF_BRANCH integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_LEVEL_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH_LEVEL TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_GM_STATUS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_GM_STATUS;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_GM_STATUS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_GM_STATUS
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_GM_STATUS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying(50),
+  COLOR_CODE character varying(20),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_GM_STATUS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_GM_STATUS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HTBL_GRIDMEASURE Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+-- REQUESTER_NAME COLUMN DELETED--
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_GRIDMEASURE_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_GRIDMEASURE
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_GRIDMEASURE_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  ID_DESCRIPTIVE character varying (50),
+  TITLE character varying (256),
+  AFFECTED_RESOURCE character varying (256),
+  REMARK character varying (1024),
+  EMAIL_ADDRESSES character varying(1024),
+  FK_REF_GM_STATUS integer,
+  SWITCHING_OBJECT character varying (256),
+  COST_CENTER character varying (50),
+  APPROVAL_BY character varying (256),
+  AREA_OF_SWITCHING character varying (256),
+  APPOINTMENT_REPETITION character varying (100),
+  APPOINTMENT_STARTDATE timestamp without time zone,
+  APPOINTMENT_NUMBEROF integer,
+  PLANNED_STARTTIME_FIRST_SEQUENCE timestamp without time zone,
+  PLANNED_STARTTIME_FIRST_SINGLEMEASURE timestamp without time zone,
+  PLANNED_ENDTIME_LAST_SINGLEMEASURE timestamp without time zone,
+  PLANNED_ENDTIME_GRIDMEASURE timestamp without time zone,
+  STARTTIME_FIRST_SEQUENCE timestamp without time zone,
+  STARTTIME_FIRST_SINGLEMEASURE timestamp without time zone,
+  ENDTIME_LAST_SINGLEMEASURE timestamp without time zone,
+  ENDTIME_GRIDMEASURE timestamp without time zone,
+  TIME_OF_REALLOCATION character varying (100),
+  DESCRIPTION character varying (1024),
+  FK_REF_BRANCH integer,
+  FK_REF_BRANCH_LEVEL integer,
+  CREATE_USER_DEPARTMENT character varying (100),
+  MOD_USER_DEPARTMENT character varying (100),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_GRIDMEASURE_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_GRIDMEASURE TO PLGM_SERVICE;
+
+CREATE INDEX HUSER_INDEX ON PUBLIC.HTBL_GRIDMEASURE (HUSER);
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'otto',12,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'otto',12,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'otto',12,3, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'otto',12,4, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'otto',12,5, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'otto',12,6, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'otto',12,7, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'otto',12,8, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:09:00', 'otto',12,9, 'admin', '2018-06-11 14:09:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:10:00', 'otto',12,10, 'admin', '2018-06-11 14:10:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:11:00', 'otto',12,11, 'admin', '2018-06-11 14:11:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:55:00', 'admin',13,0, 'admin', '2018-07-01 14:55:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:56:00', 'admin',13,1, 'admin', '2018-07-01 14:56:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,3, 'admin', '2018-07-01 14:57:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,12, 'admin', '2018-07-01 14:57:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:00:00', 'admin',11,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:01:00', 'admin',11,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:02:00', 'admin',11,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:03:00', 'admin',11,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:04:00', 'admin',11,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:05:00', 'admin',11,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:06:00', 'admin',11,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:07:00', 'admin',11,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:08:00', 'admin',11,9, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:09:00', 'admin',11,10, 'admin', '2018-06-11 14:09:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',10,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',10,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',10,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',10,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',10,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',10,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',10,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',10,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'admin',10,9, 'admin', '2018-06-11 14:08:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',9,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',9,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',9,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',9,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',9,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',9,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',9,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',9,8, 'admin', '2018-06-11 14:07:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',8,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',8,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',8,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',8,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',8,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',8,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',8,7, 'admin', '2018-06-11 14:06:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',7,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',7,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',7,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',7,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',7,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',7,6, 'admin', '2018-06-11 14:05:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',6,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',6,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',6,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',6,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',6,5, 'admin', '2018-06-11 14:04:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',5,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',5,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',5,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',5,4, 'admin', '2018-06-11 14:03:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',4,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',4,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',4,3, 'admin', '2018-06-11 14:02:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',3,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',3,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',3,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',3,2, 'admin', '2018-06-11 14:03:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',2,0, 'jasper', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',2,1, 'jasper', '2018-06-11 14:01:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',1,0, 'otto', '2018-06-11 14:01:00');
+
+-- PUBLIC.HTBL_ID_COUNTER Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_ID_COUNTER;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_ID_COUNTER_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_ID_COUNTER_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_ID_COUNTER_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_ID_COUNTER
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_ID_COUNTER_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  COUNTER integer,
+  COUNTER_TYPE character varying (256),
+  INFO character varying (256),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_ID_COUNTER_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_ID_COUNTER
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_ID_COUNTER TO PLGM_SERVICE;
+
+
+
+-- PUBLIC.HTBL_SINGLE_GRIDMEASURE Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_SINGLE_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+
+
+CREATE TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_SINGLE_GRIDMEASURE_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  SORTORDER integer,
+  TITLE character varying (256),
+  SWITCHING_OBJECT character varying (256),
+  CIM_ID character varying (256),
+  CIM_NAME character varying (256),
+  CIM_DESCRIPTION character varying (1024),
+  RESPONSIBLE_ONSITE_NAME character varying(256),
+  RESPONSIBLE_ONSITE_DEPARTMENT character varying(256),
+  NETWORK_CONTROL character varying (256),
+  PLANNED_STARTTIME_SINGLEMEASURE timestamp without time zone,
+  PLANNED_ENDTIME_SINGLEMEASURE timestamp without time zone,
+  DESCRIPTION character varying (1024),
+  FK_TBL_GRIDMEASURE integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_SINGLE_GRIDMEASURE_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE TO PLGM_SERVICE;
+
+
+
+
+-- PUBLIC.HTBL_STEPS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_STEPS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_STEPS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_STEPS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_STEPS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_STEPS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_STEPS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  SORTORDER integer,
+  SWITCHING_OBJECT character varying (256),
+  TYPE character varying(256),
+  PRESENT_TIME character varying(256),
+  PRESENT_STATE character varying(256),
+  TARGET_STATE character varying (256),
+  OPERATOR character varying(256),
+  FK_TBL_SINGLE_GRIDMEASURE integer,
+  CREATE_USER character varying (100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying (100),
+  MOD_DATE timestamp without time zone,
+
+  CONSTRAINT HTBL_STEPS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_STEPS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_STEPS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HTBL_DOCUMENTS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_DOCUMENTS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_DOCUMENTS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_DOCUMENTS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_DOCUMENTS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_DOCUMENTS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_DOCUMENTS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  DOCUMENT_NAME character varying (260),
+  DOCUMENT bytea,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_DOCUMENTS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_DOCUMENTS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_DOCUMENTS TO PLGM_SERVICE;
+
+-- PUBLIC.HTBL_MEASURE_DOCUMENTS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_MEASURE_DOCUMENTS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_MEASURE_DOCUMENTS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  FK_TBL_MEASURE integer,
+  FK_TBL_DOCUMENTS integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_MEASURE_DOCUMENTS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS TO PLGM_SERVICE;
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- TRIGGER
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+-- ---------------------------------------------
+-- TRIGGER REF_TERRITORY
+-- ---------------------------------------------
+
+
+-- PUBLIC.REF_TERRITORY INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_TERRITORY (
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_INSERT_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_TERRITORY UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_TERRITORY (
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_UPDATE_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_TERRITORY DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_TERRITORY (
+
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_DELETE_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_DELETE_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_ID_COUNTER (
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.COUNTER,NEW.COUNTER_TYPE,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_INSERT_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_ID_COUNTER (
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.COUNTER,NEW.COUNTER_TYPE,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_UPDATE_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_ID_COUNTER (
+
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.COUNTER,OLD.COUNTER_TYPE,OLD.INFO,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_DELETE_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_DELETE_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION, RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT,NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.SORTORDER,NEW.TITLE,NEW.SWITCHING_OBJECT,NEW.CIM_ID,NEW.CIM_NAME,NEW.CIM_DESCRIPTION,NEW.PLANNED_STARTTIME_SINGLEMEASURE,NEW.PLANNED_ENDTIME_SINGLEMEASURE,NEW.DESCRIPTION, NEW.RESPONSIBLE_ONSITE_NAME, NEW.RESPONSIBLE_ONSITE_DEPARTMENT,NEW.NETWORK_CONTROL,NEW.FK_TBL_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_INSERT_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION,RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT,NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.SORTORDER,NEW.TITLE,NEW.SWITCHING_OBJECT,NEW.CIM_ID,NEW.CIM_NAME,NEW.CIM_DESCRIPTION,NEW.PLANNED_STARTTIME_SINGLEMEASURE,NEW.PLANNED_ENDTIME_SINGLEMEASURE,NEW.DESCRIPTION,NEW.RESPONSIBLE_ONSITE_NAME, NEW.RESPONSIBLE_ONSITE_DEPARTMENT,NEW.NETWORK_CONTROL,NEW.FK_TBL_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_UPDATE_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION,RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT, NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.SORTORDER,OLD.TITLE,OLD.SWITCHING_OBJECT,OLD.CIM_ID,OLD.CIM_NAME,OLD.CIM_DESCRIPTION,OLD.PLANNED_STARTTIME_SINGLEMEASURE,OLD.PLANNED_ENDTIME_SINGLEMEASURE,OLD.DESCRIPTION,OLD.RESPONSIBLE_ONSITE_NAME, OLD.RESPONSIBLE_ONSITE_DEPARTMENT,OLD.NETWORK_CONTROL,OLD.FK_TBL_GRIDMEASURE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_DELETE_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG();
+
+
+
+
+
+-- PUBLIC.TBL_STEPS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_STEPS (
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR, FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.SORTORDER,NEW.SWITCHING_OBJECT,NEW.TYPE, NEW.PRESENT_TIME, NEW.PRESENT_STATE, NEW.TARGET_STATE, NEW.OPERATOR, NEW.FK_TBL_SINGLE_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_INSERT_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_STEPS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_STEPS (
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR,FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.SORTORDER,NEW.SWITCHING_OBJECT,NEW.TYPE,NEW.PRESENT_TIME, NEW.PRESENT_STATE, NEW.TARGET_STATE, NEW.OPERATOR,NEW.FK_TBL_SINGLE_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_UPDATE_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_STEPS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_STEPS (
+
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR,FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.SORTORDER,OLD.SWITCHING_OBJECT,OLD.TYPE,OLD.PRESENT_TIME, OLD.PRESENT_STATE, OLD.TARGET_STATE, OLD.OPERATOR,OLD.FK_TBL_SINGLE_GRIDMEASURE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_DELETE_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_DELETE_TRG();
+
+
+-- PUBLIC.TBL_LOCK INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_LOCK (
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.KEY,NEW.USERNAME,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_LOCK_INSERT_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_LOCK UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_LOCK (
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.KEY,NEW.USERNAME,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_LOCK_UPDATE_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_LOCK DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_LOCK (
+
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.KEY,OLD.USERNAME,OLD.INFO,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_LOCK_DELETE_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_DELETE_TRG();
+
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_USER_SETTINGS (
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.USERNAME,NEW.SETTING_TYPE,NEW.VALUE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_INSERT_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_USER_SETTINGS (
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.USERNAME,NEW.SETTING_TYPE,NEW.VALUE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_UPDATE_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_USER_SETTINGS (
+
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.USERNAME,OLD.SETTING_TYPE,OLD.VALUE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_DELETE_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_USER_DEPARTMENT (
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_INSERT_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_USER_DEPARTMENT (
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_UPDATE_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_USER_DEPARTMENT (
+
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_DELETE_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG();
+
+
+-- PUBLIC.HREF_COST_CENTER INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HHREF_COST_CENTER (
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.HID,NEW.HACTION,NEW.HDATE,NEW.HUSER,NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_INSERT_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_INSERT_TRG();
+
+
+
+-- PUBLIC.HREF_COST_CENTER UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HHREF_COST_CENTER (
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.HID,NEW.HACTION,NEW.HDATE,NEW.HUSER,NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_UPDATE_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_UPDATE_TRG();
+
+
+
+-- PUBLIC.HREF_COST_CENTER DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HHREF_COST_CENTER (
+
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.HID,OLD.HACTION,OLD.HDATE,OLD.HUSER,OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_DELETE_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH (
+
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_BRANCH_INSERT_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH (
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_UPDATE_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_BRANCH (
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.COLOR_CODE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_DELETE_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH_LEVEL (
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_INSERT_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH_LEVEL (
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_UPDATE_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_BRANCH_LEVEL (
+
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.FK_REF_BRANCH,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_DELETE_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG();
+
+
+
+
+
+-- PUBLIC.REF_GM_STATUS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_GM_STATUS (
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_INSERT_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_GM_STATUS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_GM_STATUS (
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_UPDATE_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_GM_STATUS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_GM_STATUS (
+
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.COLOR_CODE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_DELETE_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_DELETE_TRG();
+
+
+
+
+
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_GRIDMEASURE (
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SEQUENCE,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,PLANNED_ENDTIME_LAST_SINGLEMEASURE,PLANNED_ENDTIME_GRIDMEASURE,STARTTIME_FIRST_SEQUENCE,STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_LAST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.ID_DESCRIPTIVE,NEW.TITLE,NEW.AFFECTED_RESOURCE,NEW.REMARK,NEW.EMAIL_ADDRESSES,NEW.FK_REF_GM_STATUS,NEW.SWITCHING_OBJECT,NEW.COST_CENTER,NEW.APPROVAL_BY,NEW.AREA_OF_SWITCHING,NEW.APPOINTMENT_REPETITION,NEW.APPOINTMENT_STARTDATE,NEW.APPOINTMENT_NUMBEROF,NEW.PLANNED_STARTTIME_FIRST_SEQUENCE,NEW.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_LAST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_GRIDMEASURE,NEW.STARTTIME_FIRST_SEQUENCE,NEW.STARTTIME_FIRST_SINGLEMEASURE,NEW.ENDTIME_LAST_SINGLEMEASURE,NEW.ENDTIME_GRIDMEASURE,NEW.TIME_OF_REALLOCATION,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.FK_REF_BRANCH_LEVEL,NEW.CREATE_USER,NEW.CREATE_USER_DEPARTMENT,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_USER_DEPARTMENT,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_INSERT_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_GRIDMEASURE (
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SEQUENCE,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,PLANNED_ENDTIME_LAST_SINGLEMEASURE,PLANNED_ENDTIME_GRIDMEASURE,STARTTIME_FIRST_SEQUENCE,STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_LAST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.ID_DESCRIPTIVE,NEW.TITLE,NEW.AFFECTED_RESOURCE,NEW.REMARK,NEW.EMAIL_ADDRESSES,NEW.FK_REF_GM_STATUS,NEW.SWITCHING_OBJECT,NEW.COST_CENTER,NEW.APPROVAL_BY,NEW.AREA_OF_SWITCHING,NEW.APPOINTMENT_REPETITION,NEW.APPOINTMENT_STARTDATE,NEW.APPOINTMENT_NUMBEROF,NEW.PLANNED_STARTTIME_FIRST_SEQUENCE,NEW.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_LAST_SINGLEMEASURE,NEW.PLANNED_ENDTIME_GRIDMEASURE,NEW.STARTTIME_FIRST_SEQUENCE,NEW.STARTTIME_FIRST_SINGLEMEASURE,NEW.ENDTIME_LAST_SINGLEMEASURE,NEW.ENDTIME_GRIDMEASURE,NEW.TIME_OF_REALLOCATION,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.FK_REF_BRANCH_LEVEL,NEW.CREATE_USER,NEW.CREATE_USER_DEPARTMENT,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_USER_DEPARTMENT,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_UPDATE_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_GRIDMEASURE (
+
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SEQUENCE,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,PLANNED_ENDTIME_LAST_SINGLEMEASURE,PLANNED_ENDTIME_GRIDMEASURE,STARTTIME_FIRST_SEQUENCE,STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_LAST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.ID_DESCRIPTIVE,OLD.TITLE,OLD.AFFECTED_RESOURCE,OLD.REMARK,OLD.EMAIL_ADDRESSES,OLD.FK_REF_GM_STATUS,OLD.SWITCHING_OBJECT,OLD.COST_CENTER,OLD.APPROVAL_BY,OLD.AREA_OF_SWITCHING,OLD.APPOINTMENT_REPETITION,OLD.APPOINTMENT_STARTDATE,OLD.APPOINTMENT_NUMBEROF,OLD.PLANNED_STARTTIME_FIRST_SEQUENCE,OLD.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,OLD.PLANNED_ENDTIME_LAST_SINGLEMEASURE,OLD.PLANNED_ENDTIME_GRIDMEASURE,OLD.STARTTIME_FIRST_SEQUENCE,OLD.STARTTIME_FIRST_SINGLEMEASURE,OLD.ENDTIME_LAST_SINGLEMEASURE,OLD.ENDTIME_GRIDMEASURE,OLD.TIME_OF_REALLOCATION,OLD.DESCRIPTION,OLD.FK_REF_BRANCH,OLD.FK_REF_BRANCH_LEVEL,OLD.CREATE_USER,OLD.CREATE_USER_DEPARTMENT,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_USER_DEPARTMENT,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_DELETE_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_DELETE_TRG();
+
+
+-- PUBLIC.TBL_DOCUMENTS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_DOCUMENTS (
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.DOCUMENT_NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_INSERT_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_DOCUMENTS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_DOCUMENTS (
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.DOCUMENT_NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_UPDATE_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_DOCUMENTS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_DOCUMENTS (
+
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.DOCUMENT_NAME,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_DELETE_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_DELETE_TRG();
+
+
+
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.FK_TBL_MEASURE,NEW.FK_TBL_DOCUMENTS,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_INSERT_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.FK_TBL_MEASURE,NEW.FK_TBL_DOCUMENTS,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_UPDATE_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.FK_TBL_MEASURE,OLD.FK_TBL_DOCUMENTS,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_DELETE_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG();
diff --git a/db/migrations/V0_44__CREATE_PLGM_DB.sql b/db/migrations/V0_44__CREATE_PLGM_DB.sql
new file mode 100644
index 0000000..7709872
--- /dev/null
+++ b/db/migrations/V0_44__CREATE_PLGM_DB.sql
@@ -0,0 +1,3606 @@
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2018 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
+--Field COLOR_CODE added in Table REF_GM_STATUS, HREF_GM_STATUS, Insert-, Delete-, and Update-Triggers
+
+-- ---------------------------------------------
+-- DROPS
+-- ---------------------------------------------
+DROP TABLE IF EXISTS public.TBL_STEPS;
+DROP SEQUENCE IF EXISTS public.TBL_STEPS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_SINGLE_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS public.TBL_SINGLE_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_LOCK CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_LOCK_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_USER_DEPARTMENT CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_USER_DEPARTMENT_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_COST_CENTER CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_COST_CENTER_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_GRIDMEASURE CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH_LEVEL CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_LEVEL_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_GM_STATUS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_GM_STATUS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.tbl_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_measure_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_measure_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_id_counter CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_id_counter_id_seq;
+
+DROP TABLE IF EXISTS public.REF_TERRITORY CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_TERRITORY_ID_SEQ;
+
+
+DROP INDEX IF EXISTS public.huser_index;
+
+-- ---------------------------------------------
+-- TABLE REF_TERRITORY
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_TERRITORY_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_TERRITORY
+(
+  id integer NOT NULL DEFAULT nextval('REF_TERRITORY_ID_SEQ'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_TERRITORY_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_TERRITORY
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_TERRITORY TO plgm_service;
+
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Nord', 'Region Nord', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Ost', 'Region Ost', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('SUED', 'Region SUED', 'testuser','12.04.2018','testuser','12.04.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_LOCK
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.TBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.TBL_LOCK_ID_SEQ
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_lock
+(
+  id integer NOT NULL DEFAULT nextval('TBL_LOCK_ID_SEQ'::regclass),
+  key integer NOT NULL, -- Id from tbl_gridmeasure
+  username character varying(50) NOT NULL,
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_lock_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_lock
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_lock TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_lock_unique_key ON public.tbl_lock (key ASC, info ASC );
+
+-- ---------------------------------------------
+-- TABLE TBL_USER_SETTINGS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_user_settings_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_user_settings_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_user_settings
+(
+  id integer NOT NULL DEFAULT nextval('tbl_user_settings_id_seq'::regclass),
+  username character varying(50) NOT NULL,
+  setting_type character varying(50),
+  value character varying(4096),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_user_settings_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_user_settings
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_user_settings TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_user_set_unique_key ON public.tbl_user_settings (username ASC, setting_type ASC );
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_ID_COUNTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_id_counter_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_id_counter_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_id_counter
+(
+  id integer NOT NULL DEFAULT nextval('tbl_id_counter_id_seq'::regclass),
+  counter integer NOT NULL,
+  counter_type character varying(256),
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_id_counter_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_id_counter
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_id_counter TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_USER_DEPARTMENT
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_USER_DEPARTMENT_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 3
+  CACHE 1;
+ALTER TABLE public.REF_USER_DEPARTMENT_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_USER_DEPARTMENT
+(
+  id integer NOT NULL DEFAULT nextval('REF_USER_DEPARTMENT_ID_SEQ'::regclass),
+  name character varying(50) NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT ref_user_department_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_USER_DEPARTMENT
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_USER_DEPARTMENT TO plgm_service;
+
+
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Schnelle Truppe', 'testuser', '12.04.2018','testuser', '12.04.2018');
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Abt. Aufsicht', 'testuser', '12.04.2018','testuser', '12.04.2018');
+INSERT INTO public.ref_user_department(
+            name, create_user, create_date, mod_user, mod_date)
+    VALUES ('Abt. Wartung', 'testuser', '12.04.2018','testuser', '12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_COST_CENTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_COST_CENTER_ID_SEQ
+   INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_COST_CENTER_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_COST_CENTER
+(
+  id integer NOT NULL DEFAULT nextval('REF_COST_CENTER_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_COST_CENTER_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_COST_CENTER
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_COST_CENTER TO plgm_service;
+
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-155', 'Kostenstelle der Abteilung abc', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-004', 'Kostenstelle der Abteilung xyz', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-222', 'Kostenstelle der Abteilung hij', 'testuser','12.04.2018','testuser','12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_BRANCH
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_BRANCH
+(
+  ID integer NOT NULL DEFAULT nextval('REF_BRANCH_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  DESCRIPTION character varying(255),
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone  NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_BRANCH_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_BRANCH TO PLGM_SERVICE;
+
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('S', 'Strom', '#fc6042','testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('G', 'Gas', '#fdea64', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('F', 'Fernwärme', '#2cc990', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('W', 'Wasser', '#2c82c9', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+-- ---------------------------------------------
+-- TABLE REF_BRANCH_LEVEL
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_branch_level_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.ref_branch_level_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.ref_branch_level
+(
+  id integer NOT NULL DEFAULT nextval('ref_branch_level_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  fk_ref_branch integer NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT ref_branch_level_pkey PRIMARY KEY (id),
+  CONSTRAINT FK_REF_BRANCH_LEVEL__REF_BRANCH FOREIGN KEY (FK_REF_BRANCH)
+      REFERENCES public.REF_BRANCH (ID) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.ref_branch_level
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.ref_branch_level TO plgm_service;
+
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level1', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level2', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level3', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level1', 'eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level2', 'noch eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Fernwärme Level3', 'und noch eine Beschreibung', 3, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_GM_STATUS
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_GM_STATUS
+(
+  ID integer NOT NULL DEFAULT nextval('REF_GM_STATUS_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_GM_STATUS_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_GM_STATUS TO PLGM_SERVICE;
+
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (0,'Neu','system', '#79b61c', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (1,'Beantragt','system', '#6db12d', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (2,'Storniert','system', '#990000', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (3,'Zur Genehmigung','system', '#60ab3f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (4,'Genehmigt','system', '#54a650', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (5,'Angefordert','system', '#379979', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (6,'Freigegeben','system', '#1c8d9f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (7,'Schalten aktiv','system', '#1c8d9f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (8,'In Arbeit','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (9,'Arbeit beendet','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (10,'Maßnahme beendet','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (11,'Geschlossen','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (12,'Abgelehnt','system', '#990000', '17.06.2018','system','17.06.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_GRIDMEASURE
+-- ---------------------------------------------
+-- REQUESTER_NAME COLUMN DELETED--
+CREATE SEQUENCE public.TBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.TBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.tbl_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_gridmeasure_id_seq'::regclass),
+  id_descriptive character varying(50),
+  title character varying(256),
+  affected_resource character varying(256),
+  remark character varying(1024),
+  email_addresses character varying(1024),
+  fk_ref_gm_status integer,
+  switching_object character varying(256),
+  cost_center character varying(50),
+  approval_by character varying(256),
+  area_of_switching character varying(256),
+  appointment_repetition character varying(100),
+  appointment_startdate timestamp without time zone,
+  appointment_numberof integer,
+  planned_starttime_first_singlemeasure timestamp without time zone,
+  endtime_gridmeasure timestamp without time zone,
+  time_of_reallocation character varying(100),
+  description character varying(1024),
+  fk_ref_branch integer,
+  fk_ref_branch_level integer,
+  create_user character varying(100) NOT NULL,
+  create_user_department character varying(100),
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_user_department character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_gridmeasure__gm_status FOREIGN KEY (fk_ref_gm_status)
+      REFERENCES public.ref_gm_status (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch FOREIGN KEY (fk_ref_branch)
+      REFERENCES public.ref_branch (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch_level FOREIGN KEY (fk_ref_branch_level)
+      REFERENCES public.ref_branch_level (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_gridmeasure TO plgm_service;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_1', 'Kabel erneuern', 'Kabel', 'Kabel defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 0,
+            'Kabel', 'K-155',
+            'otto', 'Frankfurt', 'einmalig', '2018-06-14 15:15:00',
+            7, '2018-06-10 16:30:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Das Kabel austauschen', 1,
+            1, 'otto', 4, '2018-06-09 15:00:00',
+            'otto', 3, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_2', 'Lampe erneuern', 'Lampe', 'Lampe defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 1,
+            'Lampe', 'K-004',
+            'jasper', 'Mannheim', 'einmalig', '2018-06-16 15:15:00',
+            3, '2018-06-12 16:30:00',
+            '2018-06-20 16:00:00', 'in zwei Tagen', 'Die Lampe austauschen', 2,
+            1, 'jasper', 3, '2018-06-11 15:00:00',
+            'jasper', 4, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_3', 'Transformator erneuern', 'Transformator', 'Transformator defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 2,
+            'Transformator', 'K-222',
+            'hugo', 'Murr', 'täglich', '2018-06-17 15:15:00',
+            6, '2018-06-13 16:30:00',
+            '2018-06-21 16:00:00', 'in 8 Tagen', 'Den Transformator austauschen', 4,
+            1, 'hugo', 4, '2018-06-12 15:00:00',
+            'otto', 4, '2018-06-17 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_4', 'Transformator ersetzen', 'Transformator', 'Transformator kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 3,
+            'Transformator', 'K-155',
+            'otto', 'Stuttgart', 'einmalig', '2018-06-18 15:15:00',
+            3, '2018-06-14 16:30:00',
+            '2018-06-22 16:00:00', 'in 9 Tagen', 'Den Transformator austauschen', 3,
+            1, 'otto', 4, '2018-06-13 15:00:00',
+            'otto', 5, '2018-06-18 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_5', 'Gas Station', 'Station', 'Station defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 4,
+            'Station', 'K-004',
+            'otto', 'Ludwigsburg', 'wöchentlich', '2018-07-14 15:15:00',
+            1, '2018-07-10 16:30:00',
+            '2018-07-18 16:00:00', 'in zwei Wochen', 'Die Gas Station untersuchen', 2,
+            1, 'otto', 5, '2018-07-09 15:00:00',
+            'otto', 3, '2018-07-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_6', 'Stuhl mit drei Beinen', 'Stuhl', 'Stuhl kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 5,
+            'Stuhl', 'K-155',
+            'otto', 'Hamburg', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-08 16:30:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Stuhl austauschen', 4,
+            1, 'claudio', 4, '2018-06-07 15:00:00',
+            'claudio', 3, '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_7', 'Kabel vergrößern', 'Kabel', 'Kabel zu kurz', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 6,
+            'Kabel', 'K-222',
+            'dagmar', 'Steinheim', 'einmalig', '2018-08-14 15:15:00',
+            27, '2018-08-10 16:30:00',
+            '2018-08-18 16:00:00', 'in zwei Wochen', 'Das Kabel vergrößern', 3,
+            1, 'claudio', 3, '2018-08-09 15:00:00',
+            'bruno', 5, '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_8', 'Transformator austauschen', 'Transformator', 'Transformator 160 Grads', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 7,
+            'Transformator', 'K-155',
+            'dagmar', 'Murr', 'täglich', '2018-06-14 15:15:00',
+            6, '2018-06-10 16:30:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Den Transformator austauschen', 1,
+            1, 'dagmar', 4, '2018-06-09 15:00:00',
+            'dagmar', 3, '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_9', 'Alles kaputt', 'Alles', 'Alles defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 8,
+            'Alles', 'K-222',
+            'otto', 'Berlin', 'einmalig', '2018-06-15 15:15:00',
+            2, '2018-06-11 16:30:00',
+            '2018-06-19 16:00:00', 'in zwei Jahren', 'Alles wegwerfen', 2,
+            3, 'bruno', 5, '2018-06-10 15:00:00',
+            'claudio', 5, '2018-06-15 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_10', 'Schalter erneuern', 'Schalter', 'Schalter defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 9,
+            'Schalter', 'K-004',
+            'hugo', 'Kassel', 'einmalig', '2018-08-14 15:15:00',
+            9, '2018-08-10 16:30:00',
+            '2018-08-18 16:00:00', 'in 6 Tagen', 'Den Schalter austauschen', 1,
+            1, 'dagmar', 3, '2018-08-09 15:00:00',
+            'otto', 3, '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_11', 'Rechner austauschen', 'Rechner', 'Rechner defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 10,
+            'Rechner', 'K-155',
+            'claudio', 'Murr', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-08 16:30:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Rechner austauschen', 4,
+            1, 'hugo', 5, '2018-06-07 15:00:00',
+            'otto', 3, '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_12', 'Maschine untersuchen', 'Maschine', 'Maschine defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 11,
+            'Maschine', 'K-004',
+            'otto', 'Ludwigsburg', 'einmalig', '2018-06-20 15:15:00',
+            5, '2018-06-16 16:30:00',
+            '2018-06-24 16:00:00', 'in 8 Tagen', 'Die Maschine austauschen', 1,
+            1, 'bruno', 4, '2018-06-15 15:00:00',
+            'bruno', 3, '2018-06-20 15:15:00');
+
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_SINGLE_GRIDMEASURE
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_single_gridmeasure_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_single_gridmeasure_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_single_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_single_gridmeasure_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  title character varying(256),
+  switching_object character varying(256),
+  cim_id character varying(256),
+  cim_name character varying(256),
+  cim_description character varying(1024),
+  planned_starttime_singlemeasure timestamp without time zone,
+  planned_endtime_singlemeasure timestamp without time zone,
+  description character varying(1024),
+  responsible_onsite_name character varying(256),
+  responsible_onsite_department character varying(256),
+  network_control character varying(256),
+  fk_tbl_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_single_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_single_gridmeasure__gridmeasure FOREIGN KEY (fk_tbl_gridmeasure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_single_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_single_gridmeasure TO plgm_service;
+
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe ausschalten', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Kabel kürzen', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (3, 'Transformator tauschen', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe erneuern', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-12 16:30:00', '2018-06-13 14:00:00',
+            'Beschreibung', 2, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-13 16:30:00', '2018-06-14 14:00:00',
+            'Beschreibung', 3, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-14 16:30:00', '2018-06-15 14:00:00',
+            'Beschreibung', 4, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Gas', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Gas 2', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Stuhl', 'Stuhl', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 6, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Kabel', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 7, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Transformator 2', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Alles', 'Alles', '2', 'cim', 'cim Beschreibung',
+            '2018-06-11 16:30:00', '2018-06-12 14:00:00',
+            'Beschreibung', 9, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Schalter', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Schalter 2', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Rechner', 'Rechner', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 11, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Maschine', 'Maschine', '2', 'cim', 'cim Beschreibung',
+            '2018-06-16 16:30:00', '2018-06-17 14:00:00',
+            'Beschreibung', 12, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+
+-- ---------------------------------------------
+-- TABLE TBL_STEPS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_steps_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_steps_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_steps
+(
+  id integer NOT NULL DEFAULT nextval('tbl_steps_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  switching_object character varying(256),
+  type character varying(256),
+  present_time character varying(256),
+  present_state character varying(256),
+  target_state character varying(256),
+  operator character varying(256),
+  fk_tbl_single_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_steps_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_steps__single_gridmeasure FOREIGN KEY (fk_tbl_single_gridmeasure)
+      REFERENCES public.tbl_single_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_steps
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_steps TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_VERSION
+-- ---------------------------------------------
+
+DROP TABLE IF EXISTS public.REF_VERSION;
+
+CREATE TABLE public.REF_VERSION
+(
+  id integer NOT NULL,
+  version character varying(100) NOT NULL,
+  CONSTRAINT ref_version_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_VERSION
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_VERSION TO PLGM_SERVICE;
+
+INSERT INTO REF_VERSION VALUES (1, '0.0.1_PG');
+
+-- ---------------------------------------------
+-- TABLE TBL_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_documents_id_seq'::regclass),
+  document_name character varying(260),
+  document bytea,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_documents_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_documents TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE TBL_MEASURE_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_measure_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_measure_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_measure_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_measure_documents_id_seq'::regclass),
+  fk_tbl_measure integer,
+  fk_tbl_documents integer,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_measure_documents_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_tbl_measure_documents_measure FOREIGN KEY (fk_tbl_measure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE CASCADE,
+  CONSTRAINT fk_tbl_measure_documents_documents FOREIGN KEY (fk_tbl_documents)
+      REFERENCES public.tbl_documents (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_measure_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_measure_documents TO plgm_service;
+
+
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- HISTORY-TABLES
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+-- PUBLIC.HREF_TERRITORY Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_TERRITORY;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_TERRITORY_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_TERRITORY_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_TERRITORY
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_TERRITORY_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_TERRITORY_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_TERRITORY
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_TERRITORY TO PLGM_SERVICE;
+
+
+
+-- PUBLIC.HTBL_LOCK Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_LOCK;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_LOCK_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_LOCK_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_LOCK
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_LOCK_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  KEY integer,
+  USERNAME character varying (50),
+  INFO character varying (256),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_LOCK_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_LOCK
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_LOCK TO PLGM_SERVICE;
+
+
+
+
+-- PUBLIC.HTBL_USER_SETTINGS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_USER_SETTINGS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_USER_SETTINGS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_USER_SETTINGS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_USER_SETTINGS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  USERNAME character varying (50),
+  SETTING_TYPE character varying (50),
+  VALUE character varying(4096),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_USER_SETTINGS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_USER_SETTINGS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_USER_DEPARTMENT Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_USER_DEPARTMENT;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_USER_DEPARTMENT_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_USER_DEPARTMENT
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_USER_DEPARTMENT_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_USER_DEPARTMENT_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_USER_DEPARTMENT
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_USER_DEPARTMENT TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_COST_CENTER Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_COST_CENTER;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_COST_CENTER_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_COST_CENTER
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_COST_CENTER_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_COST_CENTER_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_COST_CENTER TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  COLOR_CODE character varying (20),
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH_LEVEL Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH_LEVEL
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_LEVEL_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  FK_REF_BRANCH integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_LEVEL_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH_LEVEL TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_GM_STATUS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_GM_STATUS;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_GM_STATUS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_GM_STATUS
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_GM_STATUS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying(50),
+  COLOR_CODE character varying(20),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_GM_STATUS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_GM_STATUS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HTBL_GRIDMEASURE Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+-- REQUESTER_NAME COLUMN DELETED--
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_GRIDMEASURE_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_GRIDMEASURE
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_GRIDMEASURE_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  ID_DESCRIPTIVE character varying (50),
+  TITLE character varying (256),
+  AFFECTED_RESOURCE character varying (256),
+  REMARK character varying (1024),
+  EMAIL_ADDRESSES character varying(1024),
+  FK_REF_GM_STATUS integer,
+  SWITCHING_OBJECT character varying (256),
+  COST_CENTER character varying (50),
+  APPROVAL_BY character varying (256),
+  AREA_OF_SWITCHING character varying (256),
+  APPOINTMENT_REPETITION character varying (100),
+  APPOINTMENT_STARTDATE timestamp without time zone,
+  APPOINTMENT_NUMBEROF integer,
+  PLANNED_STARTTIME_FIRST_SINGLEMEASURE timestamp without time zone,
+  ENDTIME_GRIDMEASURE timestamp without time zone,
+  TIME_OF_REALLOCATION character varying (100),
+  DESCRIPTION character varying (1024),
+  FK_REF_BRANCH integer,
+  FK_REF_BRANCH_LEVEL integer,
+  CREATE_USER_DEPARTMENT character varying (100),
+  MOD_USER_DEPARTMENT character varying (100),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_GRIDMEASURE_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_GRIDMEASURE TO PLGM_SERVICE;
+
+CREATE INDEX HUSER_INDEX ON PUBLIC.HTBL_GRIDMEASURE (HUSER);
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'otto',12,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'otto',12,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'otto',12,3, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'otto',12,4, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'otto',12,5, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'otto',12,6, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'otto',12,7, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'otto',12,8, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:09:00', 'otto',12,9, 'admin', '2018-06-11 14:09:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:10:00', 'otto',12,10, 'admin', '2018-06-11 14:10:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:11:00', 'otto',12,11, 'admin', '2018-06-11 14:11:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:55:00', 'admin',13,0, 'admin', '2018-07-01 14:55:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:56:00', 'admin',13,1, 'admin', '2018-07-01 14:56:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,3, 'admin', '2018-07-01 14:57:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,12, 'admin', '2018-07-01 14:57:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:00:00', 'admin',11,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:01:00', 'admin',11,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:02:00', 'admin',11,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:03:00', 'admin',11,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:04:00', 'admin',11,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:05:00', 'admin',11,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:06:00', 'admin',11,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:07:00', 'admin',11,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:08:00', 'admin',11,9, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:09:00', 'admin',11,10, 'admin', '2018-06-11 14:09:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',10,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',10,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',10,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',10,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',10,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',10,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',10,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',10,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'admin',10,9, 'admin', '2018-06-11 14:08:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',9,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',9,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',9,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',9,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',9,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',9,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',9,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',9,8, 'admin', '2018-06-11 14:07:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',8,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',8,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',8,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',8,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',8,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',8,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',8,7, 'admin', '2018-06-11 14:06:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',7,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',7,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',7,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',7,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',7,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',7,6, 'admin', '2018-06-11 14:05:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',6,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',6,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',6,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',6,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',6,5, 'admin', '2018-06-11 14:04:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',5,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',5,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',5,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',5,4, 'admin', '2018-06-11 14:03:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',4,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',4,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',4,3, 'admin', '2018-06-11 14:02:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',3,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',3,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',3,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',3,2, 'admin', '2018-06-11 14:03:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',2,0, 'jasper', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',2,1, 'jasper', '2018-06-11 14:01:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',1,0, 'otto', '2018-06-11 14:01:00');
+
+-- PUBLIC.HTBL_ID_COUNTER Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_ID_COUNTER;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_ID_COUNTER_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_ID_COUNTER_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_ID_COUNTER_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_ID_COUNTER
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_ID_COUNTER_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  COUNTER integer,
+  COUNTER_TYPE character varying (256),
+  INFO character varying (256),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_ID_COUNTER_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_ID_COUNTER
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_ID_COUNTER TO PLGM_SERVICE;
+
+
+
+-- PUBLIC.HTBL_SINGLE_GRIDMEASURE Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_SINGLE_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+
+
+CREATE TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_SINGLE_GRIDMEASURE_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  SORTORDER integer,
+  TITLE character varying (256),
+  SWITCHING_OBJECT character varying (256),
+  CIM_ID character varying (256),
+  CIM_NAME character varying (256),
+  CIM_DESCRIPTION character varying (1024),
+  RESPONSIBLE_ONSITE_NAME character varying(256),
+  RESPONSIBLE_ONSITE_DEPARTMENT character varying(256),
+  NETWORK_CONTROL character varying (256),
+  PLANNED_STARTTIME_SINGLEMEASURE timestamp without time zone,
+  PLANNED_ENDTIME_SINGLEMEASURE timestamp without time zone,
+  DESCRIPTION character varying (1024),
+  FK_TBL_GRIDMEASURE integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_SINGLE_GRIDMEASURE_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_SINGLE_GRIDMEASURE TO PLGM_SERVICE;
+
+
+
+
+-- PUBLIC.HTBL_STEPS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_STEPS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_STEPS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_STEPS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_STEPS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_STEPS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_STEPS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  SORTORDER integer,
+  SWITCHING_OBJECT character varying (256),
+  TYPE character varying(256),
+  PRESENT_TIME character varying(256),
+  PRESENT_STATE character varying(256),
+  TARGET_STATE character varying (256),
+  OPERATOR character varying(256),
+  FK_TBL_SINGLE_GRIDMEASURE integer,
+  CREATE_USER character varying (100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying (100),
+  MOD_DATE timestamp without time zone,
+
+  CONSTRAINT HTBL_STEPS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_STEPS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_STEPS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HTBL_DOCUMENTS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_DOCUMENTS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_DOCUMENTS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_DOCUMENTS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_DOCUMENTS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_DOCUMENTS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_DOCUMENTS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  DOCUMENT_NAME character varying (260),
+  DOCUMENT bytea,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_DOCUMENTS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_DOCUMENTS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_DOCUMENTS TO PLGM_SERVICE;
+
+-- PUBLIC.HTBL_MEASURE_DOCUMENTS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_MEASURE_DOCUMENTS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_MEASURE_DOCUMENTS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  FK_TBL_MEASURE integer,
+  FK_TBL_DOCUMENTS integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_MEASURE_DOCUMENTS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_MEASURE_DOCUMENTS TO PLGM_SERVICE;
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- TRIGGER
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+-- ---------------------------------------------
+-- TRIGGER REF_TERRITORY
+-- ---------------------------------------------
+
+
+-- PUBLIC.REF_TERRITORY INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_TERRITORY (
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_INSERT_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_TERRITORY UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_TERRITORY (
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_UPDATE_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_TERRITORY DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_TERRITORY_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_TERRITORY (
+
+						  ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_TERRITORY_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_TERRITORY_DELETE_TRG ON PUBLIC.REF_TERRITORY;
+
+CREATE TRIGGER REF_TERRITORY_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_TERRITORY
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_TERRITORY_DELETE_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_ID_COUNTER (
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.COUNTER,NEW.COUNTER_TYPE,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_INSERT_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_ID_COUNTER (
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.COUNTER,NEW.COUNTER_TYPE,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_UPDATE_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_ID_COUNTER DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_ID_COUNTER_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_ID_COUNTER (
+
+						  ID,COUNTER,COUNTER_TYPE,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.COUNTER,OLD.COUNTER_TYPE,OLD.INFO,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_ID_COUNTER_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_ID_COUNTER_DELETE_TRG ON PUBLIC.TBL_ID_COUNTER;
+
+CREATE TRIGGER TBL_ID_COUNTER_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_ID_COUNTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_ID_COUNTER_DELETE_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION, RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT,NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.SORTORDER,NEW.TITLE,NEW.SWITCHING_OBJECT,NEW.CIM_ID,NEW.CIM_NAME,NEW.CIM_DESCRIPTION,NEW.PLANNED_STARTTIME_SINGLEMEASURE,NEW.PLANNED_ENDTIME_SINGLEMEASURE,NEW.DESCRIPTION, NEW.RESPONSIBLE_ONSITE_NAME, NEW.RESPONSIBLE_ONSITE_DEPARTMENT,NEW.NETWORK_CONTROL,NEW.FK_TBL_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_INSERT_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION,RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT,NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.SORTORDER,NEW.TITLE,NEW.SWITCHING_OBJECT,NEW.CIM_ID,NEW.CIM_NAME,NEW.CIM_DESCRIPTION,NEW.PLANNED_STARTTIME_SINGLEMEASURE,NEW.PLANNED_ENDTIME_SINGLEMEASURE,NEW.DESCRIPTION,NEW.RESPONSIBLE_ONSITE_NAME, NEW.RESPONSIBLE_ONSITE_DEPARTMENT,NEW.NETWORK_CONTROL,NEW.FK_TBL_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_UPDATE_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_SINGLE_GRIDMEASURE DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_SINGLE_GRIDMEASURE (
+
+						  ID,SORTORDER,TITLE,SWITCHING_OBJECT,CIM_ID,CIM_NAME,CIM_DESCRIPTION,PLANNED_STARTTIME_SINGLEMEASURE,PLANNED_ENDTIME_SINGLEMEASURE,DESCRIPTION,RESPONSIBLE_ONSITE_NAME, RESPONSIBLE_ONSITE_DEPARTMENT, NETWORK_CONTROL,FK_TBL_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.SORTORDER,OLD.TITLE,OLD.SWITCHING_OBJECT,OLD.CIM_ID,OLD.CIM_NAME,OLD.CIM_DESCRIPTION,OLD.PLANNED_STARTTIME_SINGLEMEASURE,OLD.PLANNED_ENDTIME_SINGLEMEASURE,OLD.DESCRIPTION,OLD.RESPONSIBLE_ONSITE_NAME, OLD.RESPONSIBLE_ONSITE_DEPARTMENT,OLD.NETWORK_CONTROL,OLD.FK_TBL_GRIDMEASURE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_SINGLE_GRIDMEASURE_DELETE_TRG ON PUBLIC.TBL_SINGLE_GRIDMEASURE;
+
+CREATE TRIGGER TBL_SINGLE_GRIDMEASURE_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_SINGLE_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_SINGLE_GRIDMEASURE_DELETE_TRG();
+
+
+
+
+
+-- PUBLIC.TBL_STEPS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_STEPS (
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR, FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.SORTORDER,NEW.SWITCHING_OBJECT,NEW.TYPE, NEW.PRESENT_TIME, NEW.PRESENT_STATE, NEW.TARGET_STATE, NEW.OPERATOR, NEW.FK_TBL_SINGLE_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_INSERT_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_STEPS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_STEPS (
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR,FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.SORTORDER,NEW.SWITCHING_OBJECT,NEW.TYPE,NEW.PRESENT_TIME, NEW.PRESENT_STATE, NEW.TARGET_STATE, NEW.OPERATOR,NEW.FK_TBL_SINGLE_GRIDMEASURE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_UPDATE_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_STEPS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_STEPS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_STEPS (
+
+						  ID,SORTORDER,SWITCHING_OBJECT,TYPE,PRESENT_TIME, PRESENT_STATE, TARGET_STATE, OPERATOR,FK_TBL_SINGLE_GRIDMEASURE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.SORTORDER,OLD.SWITCHING_OBJECT,OLD.TYPE,OLD.PRESENT_TIME, OLD.PRESENT_STATE, OLD.TARGET_STATE, OLD.OPERATOR,OLD.FK_TBL_SINGLE_GRIDMEASURE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_STEPS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_STEPS_DELETE_TRG ON PUBLIC.TBL_STEPS;
+
+CREATE TRIGGER TBL_STEPS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_STEPS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_STEPS_DELETE_TRG();
+
+
+-- PUBLIC.TBL_LOCK INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_LOCK (
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.KEY,NEW.USERNAME,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_LOCK_INSERT_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_LOCK UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_LOCK (
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.KEY,NEW.USERNAME,NEW.INFO,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_LOCK_UPDATE_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_LOCK DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_LOCK_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_LOCK (
+
+						  ID,KEY,USERNAME,INFO,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.KEY,OLD.USERNAME,OLD.INFO,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_LOCK_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_LOCK_DELETE_TRG ON PUBLIC.TBL_LOCK;
+
+CREATE TRIGGER TBL_LOCK_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_LOCK
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_LOCK_DELETE_TRG();
+
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_USER_SETTINGS (
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.USERNAME,NEW.SETTING_TYPE,NEW.VALUE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_INSERT_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_USER_SETTINGS (
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.USERNAME,NEW.SETTING_TYPE,NEW.VALUE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_UPDATE_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_USER_SETTINGS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_USER_SETTINGS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_USER_SETTINGS (
+
+						  ID,USERNAME,SETTING_TYPE,VALUE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.USERNAME,OLD.SETTING_TYPE,OLD.VALUE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_USER_SETTINGS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_USER_SETTINGS_DELETE_TRG ON PUBLIC.TBL_USER_SETTINGS;
+
+CREATE TRIGGER TBL_USER_SETTINGS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_USER_SETTINGS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_USER_SETTINGS_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_USER_DEPARTMENT (
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_INSERT_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_USER_DEPARTMENT (
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_UPDATE_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_USER_DEPARTMENT DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_USER_DEPARTMENT (
+
+						  ID,NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_USER_DEPARTMENT_DELETE_TRG ON PUBLIC.REF_USER_DEPARTMENT;
+
+CREATE TRIGGER REF_USER_DEPARTMENT_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_USER_DEPARTMENT
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_USER_DEPARTMENT_DELETE_TRG();
+
+
+-- PUBLIC.HREF_COST_CENTER INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HHREF_COST_CENTER (
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.HID,NEW.HACTION,NEW.HDATE,NEW.HUSER,NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_INSERT_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_INSERT_TRG();
+
+
+
+-- PUBLIC.HREF_COST_CENTER UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HHREF_COST_CENTER (
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.HID,NEW.HACTION,NEW.HDATE,NEW.HUSER,NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_UPDATE_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_UPDATE_TRG();
+
+
+
+-- PUBLIC.HREF_COST_CENTER DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.HREF_COST_CENTER_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HHREF_COST_CENTER (
+
+						  HID,HACTION,HDATE,HUSER,ID,NAME,DESCRIPTION,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.HID,OLD.HACTION,OLD.HDATE,OLD.HUSER,OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.HREF_COST_CENTER_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS HREF_COST_CENTER_DELETE_TRG ON PUBLIC.HREF_COST_CENTER;
+
+CREATE TRIGGER HREF_COST_CENTER_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.HREF_COST_CENTER
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.HREF_COST_CENTER_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH (
+
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_BRANCH_INSERT_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH (
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_UPDATE_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_BRANCH (
+						  ID,NAME,DESCRIPTION,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.COLOR_CODE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_DELETE_TRG ON PUBLIC.REF_BRANCH;
+
+CREATE TRIGGER REF_BRANCH_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_BRANCH
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_DELETE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH_LEVEL (
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_INSERT_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_BRANCH_LEVEL (
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_UPDATE_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_BRANCH_LEVEL DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_BRANCH_LEVEL (
+
+						  ID,NAME,DESCRIPTION,FK_REF_BRANCH,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.DESCRIPTION,OLD.FK_REF_BRANCH,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_BRANCH_LEVEL_DELETE_TRG ON PUBLIC.REF_BRANCH_LEVEL;
+
+CREATE TRIGGER REF_BRANCH_LEVEL_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_BRANCH_LEVEL
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_BRANCH_LEVEL_DELETE_TRG();
+
+
+
+
+
+-- PUBLIC.REF_GM_STATUS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_GM_STATUS (
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.NAME,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_INSERT_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_INSERT_TRG();
+
+
+
+-- PUBLIC.REF_GM_STATUS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HREF_GM_STATUS (
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.NAME,NEW.COLOR_CODE,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_UPDATE_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_UPDATE_TRG();
+
+
+
+-- PUBLIC.REF_GM_STATUS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.REF_GM_STATUS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HREF_GM_STATUS (
+
+						  ID,NAME,COLOR_CODE,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.NAME,OLD.COLOR_CODE,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.REF_GM_STATUS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS REF_GM_STATUS_DELETE_TRG ON PUBLIC.REF_GM_STATUS;
+
+CREATE TRIGGER REF_GM_STATUS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.REF_GM_STATUS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.REF_GM_STATUS_DELETE_TRG();
+
+
+
+
+
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_GRIDMEASURE (
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.ID_DESCRIPTIVE,NEW.TITLE,NEW.AFFECTED_RESOURCE,NEW.REMARK,NEW.EMAIL_ADDRESSES,NEW.FK_REF_GM_STATUS,NEW.SWITCHING_OBJECT,NEW.COST_CENTER,NEW.APPROVAL_BY,NEW.AREA_OF_SWITCHING,NEW.APPOINTMENT_REPETITION,NEW.APPOINTMENT_STARTDATE,NEW.APPOINTMENT_NUMBEROF,NEW.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,NEW.ENDTIME_GRIDMEASURE,NEW.TIME_OF_REALLOCATION,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.FK_REF_BRANCH_LEVEL,NEW.CREATE_USER,NEW.CREATE_USER_DEPARTMENT,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_USER_DEPARTMENT,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_INSERT_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_GRIDMEASURE (
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.ID_DESCRIPTIVE,NEW.TITLE,NEW.AFFECTED_RESOURCE,NEW.REMARK,NEW.EMAIL_ADDRESSES,NEW.FK_REF_GM_STATUS,NEW.SWITCHING_OBJECT,NEW.COST_CENTER,NEW.APPROVAL_BY,NEW.AREA_OF_SWITCHING,NEW.APPOINTMENT_REPETITION,NEW.APPOINTMENT_STARTDATE,NEW.APPOINTMENT_NUMBEROF,NEW.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,NEW.ENDTIME_GRIDMEASURE,NEW.TIME_OF_REALLOCATION,NEW.DESCRIPTION,NEW.FK_REF_BRANCH,NEW.FK_REF_BRANCH_LEVEL,NEW.CREATE_USER,NEW.CREATE_USER_DEPARTMENT,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_USER_DEPARTMENT,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_UPDATE_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_GRIDMEASURE DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_GRIDMEASURE_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_GRIDMEASURE (
+
+						  ID,ID_DESCRIPTIVE,TITLE,AFFECTED_RESOURCE,REMARK,EMAIL_ADDRESSES,FK_REF_GM_STATUS,SWITCHING_OBJECT,COST_CENTER,APPROVAL_BY,AREA_OF_SWITCHING,APPOINTMENT_REPETITION,APPOINTMENT_STARTDATE,APPOINTMENT_NUMBEROF,PLANNED_STARTTIME_FIRST_SINGLEMEASURE,ENDTIME_GRIDMEASURE,TIME_OF_REALLOCATION,DESCRIPTION,FK_REF_BRANCH,FK_REF_BRANCH_LEVEL,CREATE_USER,CREATE_USER_DEPARTMENT,CREATE_DATE,MOD_USER,MOD_USER_DEPARTMENT,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.ID_DESCRIPTIVE,OLD.TITLE,OLD.AFFECTED_RESOURCE,OLD.REMARK,OLD.EMAIL_ADDRESSES,OLD.FK_REF_GM_STATUS,OLD.SWITCHING_OBJECT,OLD.COST_CENTER,OLD.APPROVAL_BY,OLD.AREA_OF_SWITCHING,OLD.APPOINTMENT_REPETITION,OLD.APPOINTMENT_STARTDATE,OLD.APPOINTMENT_NUMBEROF,OLD.PLANNED_STARTTIME_FIRST_SINGLEMEASURE,OLD.ENDTIME_GRIDMEASURE,OLD.TIME_OF_REALLOCATION,OLD.DESCRIPTION,OLD.FK_REF_BRANCH,OLD.FK_REF_BRANCH_LEVEL,OLD.CREATE_USER,OLD.CREATE_USER_DEPARTMENT,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_USER_DEPARTMENT,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_GRIDMEASURE_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_GRIDMEASURE_DELETE_TRG ON PUBLIC.TBL_GRIDMEASURE;
+
+CREATE TRIGGER TBL_GRIDMEASURE_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_GRIDMEASURE
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_GRIDMEASURE_DELETE_TRG();
+
+
+-- PUBLIC.TBL_DOCUMENTS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_DOCUMENTS (
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.DOCUMENT_NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_INSERT_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_DOCUMENTS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_DOCUMENTS (
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.DOCUMENT_NAME,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_UPDATE_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_DOCUMENTS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_DOCUMENTS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_DOCUMENTS (
+
+						  ID,DOCUMENT_NAME,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.DOCUMENT_NAME,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_DOCUMENTS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_DOCUMENTS_DELETE_TRG ON PUBLIC.TBL_DOCUMENTS;
+
+CREATE TRIGGER TBL_DOCUMENTS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_DOCUMENTS_DELETE_TRG();
+
+
+
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				 (
+
+						  NEW.ID,NEW.FK_TBL_MEASURE,NEW.FK_TBL_DOCUMENTS,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+
+                          1,
+						  current_timestamp,
+					      NEW.CREATE_USER );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG()
+  OWNER TO PLGM_SERVICE;
+
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_INSERT_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_INSERT_TRG
+  BEFORE INSERT
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 			    (
+	                      NEW.ID,NEW.FK_TBL_MEASURE,NEW.FK_TBL_DOCUMENTS,NEW.CREATE_USER,NEW.CREATE_DATE,NEW.MOD_USER,NEW.MOD_DATE,
+                          2,
+						  current_timestamp,
+					      NEW.MOD_USER
+					    );
+
+        RETURN NEW;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_UPDATE_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_UPDATE_TRG
+  BEFORE UPDATE
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_MEASURE_DOCUMENTS DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG()
+  RETURNS trigger AS
+$BODY$
+    BEGIN
+    IF TG_OP = 'DELETE' THEN
+	INSERT INTO HTBL_MEASURE_DOCUMENTS (
+
+						  ID,FK_TBL_MEASURE,FK_TBL_DOCUMENTS,CREATE_USER,CREATE_DATE,MOD_USER,MOD_DATE,
+
+						  HACTION,
+						  HDATE,
+						  HUSER
+						 )
+	VALUES 				(
+						  OLD.ID,OLD.FK_TBL_MEASURE,OLD.FK_TBL_DOCUMENTS,OLD.CREATE_USER,OLD.CREATE_DATE,OLD.MOD_USER,OLD.MOD_DATE,
+
+                          3,
+						  current_timestamp,
+					      OLD.MOD_USER );
+	END IF;
+
+        RETURN OLD;
+    END;
+$BODY$
+  LANGUAGE plpgsql VOLATILE
+  COST 100;
+ALTER FUNCTION PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG()
+  OWNER TO PLGM_SERVICE;
+
+DROP TRIGGER IF EXISTS TBL_MEASURE_DOCUMENTS_DELETE_TRG ON PUBLIC.TBL_MEASURE_DOCUMENTS;
+
+CREATE TRIGGER TBL_MEASURE_DOCUMENTS_DELETE_TRG
+  BEFORE DELETE
+  ON PUBLIC.TBL_MEASURE_DOCUMENTS
+  FOR EACH ROW
+  EXECUTE PROCEDURE PUBLIC.TBL_MEASURE_DOCUMENTS_DELETE_TRG();
diff --git a/db/migrations/V0_45__CREATE_PLGM_DB.sql b/db/migrations/V0_45__CREATE_PLGM_DB.sql
new file mode 100644
index 0000000..793fde4
--- /dev/null
+++ b/db/migrations/V0_45__CREATE_PLGM_DB.sql
@@ -0,0 +1,3381 @@
+
+--Field COLOR_CODE added in Table REF_GM_STATUS, HREF_GM_STATUS, Insert-, Delete-, and Update-Triggers
+
+-- ---------------------------------------------
+-- DROPS
+-- ---------------------------------------------
+DROP TABLE IF EXISTS public.TBL_STEPS;
+DROP SEQUENCE IF EXISTS public.TBL_STEPS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_SINGLE_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS public.TBL_SINGLE_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_LOCK CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_LOCK_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_USER_SETTINGS CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_USER_SETTINGS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_COST_CENTER CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_COST_CENTER_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_GRIDMEASURE CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_GRIDMEASURE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH_LEVEL CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_LEVEL_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_GM_STATUS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_GM_STATUS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.tbl_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_measure_documents CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_measure_documents_id_seq;
+
+DROP TABLE IF EXISTS public.tbl_id_counter CASCADE;
+DROP SEQUENCE IF EXISTS public.tbl_id_counter_id_seq;
+
+DROP TABLE IF EXISTS public.REF_TERRITORY CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_TERRITORY_ID_SEQ;
+
+
+DROP INDEX IF EXISTS public.huser_index;
+
+-- ---------------------------------------------
+-- TABLE REF_TERRITORY
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_TERRITORY_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_TERRITORY
+(
+  id integer NOT NULL DEFAULT nextval('REF_TERRITORY_ID_SEQ'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_TERRITORY_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_TERRITORY
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_TERRITORY TO plgm_service;
+
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Nord', 'Region Nord', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('Ost', 'Region Ost', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.REF_TERRITORY(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('SUED', 'Region SUED', 'testuser','12.04.2018','testuser','12.04.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_LOCK
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.TBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.TBL_LOCK_ID_SEQ
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_lock
+(
+  id integer NOT NULL DEFAULT nextval('TBL_LOCK_ID_SEQ'::regclass),
+  key integer NOT NULL, -- Id from tbl_gridmeasure
+  username character varying(50) NOT NULL,
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_lock_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_lock
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_lock TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_lock_unique_key ON public.tbl_lock (key ASC, info ASC );
+
+-- ---------------------------------------------
+-- TABLE TBL_USER_SETTINGS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_user_settings_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_user_settings_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_user_settings
+(
+  id integer NOT NULL DEFAULT nextval('tbl_user_settings_id_seq'::regclass),
+  username character varying(50) NOT NULL,
+  setting_type character varying(50),
+  value character varying(4096),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_user_settings_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_user_settings
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_user_settings TO plgm_service;
+
+CREATE UNIQUE INDEX tbl_user_set_unique_key ON public.tbl_user_settings (username ASC, setting_type ASC );
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_ID_COUNTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_id_counter_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_id_counter_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_id_counter
+(
+  id integer NOT NULL DEFAULT nextval('tbl_id_counter_id_seq'::regclass),
+  counter integer NOT NULL,
+  counter_type character varying(256),
+  info character varying(256),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_id_counter_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_id_counter
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_id_counter TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_COST_CENTER
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.REF_COST_CENTER_ID_SEQ
+   INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.REF_COST_CENTER_ID_SEQ
+  OWNER TO plgm_service;
+
+
+CREATE TABLE public.REF_COST_CENTER
+(
+  id integer NOT NULL DEFAULT nextval('REF_COST_CENTER_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT REF_COST_CENTER_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_COST_CENTER
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.REF_COST_CENTER TO plgm_service;
+
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-155', 'Kostenstelle der Abteilung abc', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-004', 'Kostenstelle der Abteilung xyz', 'testuser','12.04.2018','testuser','12.04.2018');
+INSERT INTO public.ref_cost_center(
+            name, description, create_user, create_date, mod_user, mod_date)
+    VALUES ('K-222', 'Kostenstelle der Abteilung hij', 'testuser','12.04.2018','testuser','12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_BRANCH
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_BRANCH
+(
+  ID integer NOT NULL DEFAULT nextval('REF_BRANCH_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  DESCRIPTION character varying(255),
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone  NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_BRANCH_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_BRANCH TO PLGM_SERVICE;
+
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('S', 'Strom', '#fc6042','testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('G', 'Gas', '#fdea64', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('F', 'Fernwärme', '#2cc990', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.ref_branch(name, description, color_code, create_user, create_date, mod_user, mod_date)
+    VALUES ('W', 'Wasser', '#2c82c9', 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+-- ---------------------------------------------
+-- TABLE REF_BRANCH_LEVEL
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_branch_level_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.ref_branch_level_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.ref_branch_level
+(
+  id integer NOT NULL DEFAULT nextval('ref_branch_level_id_seq'::regclass),
+  name character varying(50) NOT NULL,
+  description character varying(255),
+  fk_ref_branch integer NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT ref_branch_level_pkey PRIMARY KEY (id),
+  CONSTRAINT FK_REF_BRANCH_LEVEL__REF_BRANCH FOREIGN KEY (FK_REF_BRANCH)
+      REFERENCES public.REF_BRANCH (ID) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.ref_branch_level
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.ref_branch_level TO plgm_service;
+
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level1', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level2', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Strom Level3', 'eine Beschreibung', 1, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level1', 'eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Gas Level2', 'noch eine Beschreibung', 2, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+INSERT INTO public.REF_BRANCH_LEVEL(
+            name, description, fk_ref_branch, create_user, create_date, mod_user, mod_date)
+    VALUES ('Fernwärme Level3', 'und noch eine Beschreibung', 3, 'testuser', '12.04.2018', 'testuser', '12.04.2018');
+
+-- ---------------------------------------------
+-- TABLE REF_GM_STATUS
+-- ---------------------------------------------
+CREATE SEQUENCE public.REF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.REF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.REF_GM_STATUS
+(
+  ID integer NOT NULL DEFAULT nextval('REF_GM_STATUS_ID_SEQ'::regclass),
+  NAME character varying(50) NOT NULL,
+  COLOR_CODE character varying(20),
+  CREATE_USER character varying(100) NOT NULL,
+  CREATE_DATE timestamp without time zone NOT NULL,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT REF_GM_STATUS_PKEY PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE public.REF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_GM_STATUS TO PLGM_SERVICE;
+
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (0,'Neu','system', '#79b61c', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (1,'Beantragt','system', '#6db12d', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (2,'Storniert','system', '#990000', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (3,'Zur Genehmigung','system', '#60ab3f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (4,'Genehmigt','system', '#54a650', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (5,'Angefordert','system', '#379979', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (6,'Freigegeben','system', '#1c8d9f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (7,'Schalten aktiv','system', '#1c8d9f', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (8,'In Arbeit','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (9,'Arbeit beendet','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (10,'Maßnahme beendet','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (11,'Geschlossen','system', '#0281c4', '09.04.2018','system','09.04.2018');
+INSERT INTO
+  public.REF_GM_STATUS(id, name, create_user, color_code, create_date, mod_user, mod_date)
+VALUES
+  (12,'Abgelehnt','system', '#990000', '17.06.2018','system','17.06.2018');
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_GRIDMEASURE
+-- ---------------------------------------------
+-- REQUESTER_NAME COLUMN DELETED--
+CREATE SEQUENCE public.TBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE public.TBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE public.tbl_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_gridmeasure_id_seq'::regclass),
+  id_descriptive character varying(50),
+  title character varying(256),
+  affected_resource character varying(256),
+  remark character varying(1024),
+  email_addresses character varying(1024),
+  fk_ref_gm_status integer,
+  switching_object character varying(256),
+  cost_center character varying(50),
+  approval_by character varying(256),
+  area_of_switching character varying(256),
+  appointment_repetition character varying(100),
+  appointment_startdate timestamp without time zone,
+  appointment_numberof integer,
+  planned_starttime_first_singlemeasure timestamp without time zone,
+  endtime_gridmeasure timestamp without time zone,
+  time_of_reallocation character varying(100),
+  description character varying(1024),
+  fk_ref_branch integer,
+  fk_ref_branch_level integer,
+  create_user character varying(100) NOT NULL,
+  create_user_department character varying(100),
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_user_department character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_gridmeasure__gm_status FOREIGN KEY (fk_ref_gm_status)
+      REFERENCES public.ref_gm_status (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch FOREIGN KEY (fk_ref_branch)
+      REFERENCES public.ref_branch (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION,
+  CONSTRAINT fk_gridmeasure__branch_level FOREIGN KEY (fk_ref_branch_level)
+      REFERENCES public.ref_branch_level (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_gridmeasure TO plgm_service;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_1', 'Kabel erneuern', 'Kabel', 'Kabel defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 0,
+            'Kabel', 'K-155',
+            'otto', 'Frankfurt', 'einmalig', '2018-06-14 15:15:00',
+            7, '2018-06-10 16:30:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Das Kabel austauschen', 1,
+            1, 'otto', 'Abteilung abc', '2018-06-09 15:00:00',
+            'otto', 'Abteilung abc', '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_2', 'Lampe erneuern', 'Lampe', 'Lampe defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 1,
+            'Lampe', 'K-004',
+            'jasper', 'Mannheim', 'einmalig', '2018-06-16 15:15:00',
+            3, '2018-06-12 16:30:00',
+            '2018-06-20 16:00:00', 'in zwei Tagen', 'Die Lampe austauschen', 2,
+            1, 'jasper', 'Abteilung cde', '2018-06-11 15:00:00',
+            'jasper', 'Abteilung cde', '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_3', 'Transformator erneuern', 'Transformator', 'Transformator defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 2,
+            'Transformator', 'K-222',
+            'hugo', 'Murr', 'täglich', '2018-06-17 15:15:00',
+            6, '2018-06-13 16:30:00',
+            '2018-06-21 16:00:00', 'in 8 Tagen', 'Den Transformator austauschen', 4,
+            1, 'hugo', 'Abteilung xyz', '2018-06-12 15:00:00',
+            'otto', 'Abteilung abc', '2018-06-17 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_4', 'Transformator ersetzen', 'Transformator', 'Transformator kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 3,
+            'Transformator', 'K-155',
+            'otto', 'Stuttgart', 'einmalig', '2018-06-18 15:15:00',
+            3, '2018-06-14 16:30:00',
+            '2018-06-22 16:00:00', 'in 9 Tagen', 'Den Transformator austauschen', 3,
+            1, 'otto', 'Abteilung abc', '2018-06-13 15:00:00',
+            'otto', 'Abteilung syx', '2018-06-18 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_5', 'Gas Station', 'Station', 'Station defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 4,
+            'Station', 'K-004',
+            'otto', 'Ludwigsburg', 'wöchentlich', '2018-07-14 15:15:00',
+            1, '2018-07-10 16:30:00',
+            '2018-07-18 16:00:00', 'in zwei Wochen', 'Die Gas Station untersuchen', 2,
+            1, 'otto', 'Abteilung lmn', '2018-07-09 15:00:00',
+            'otto', 'Abteilung lmn', '2018-07-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_6', 'Stuhl mit drei Beinen', 'Stuhl', 'Stuhl kaputt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 5,
+            'Stuhl', 'K-155',
+            'otto', 'Hamburg', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-08 16:30:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Stuhl austauschen', 4,
+            1, 'claudio', 'Abteilung lmn', '2018-06-07 15:00:00',
+            'claudio', 'Abteilung lmn', '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_7', 'Kabel vergrößern', 'Kabel', 'Kabel zu kurz', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 6,
+            'Kabel', 'K-222',
+            'dagmar', 'Steinheim', 'einmalig', '2018-08-14 15:15:00',
+            27, '2018-08-10 16:30:00',
+            '2018-08-18 16:00:00', 'in zwei Wochen', 'Das Kabel vergrößern', 3,
+            1, 'claudio', 'Abteilung lmn', '2018-08-09 15:00:00',
+            'bruno', 'Abteilung lmn', '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_8', 'Transformator austauschen', 'Transformator', 'Transformator 160 Grads', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 7,
+            'Transformator', 'K-155',
+            'dagmar', 'Murr', 'täglich', '2018-06-14 15:15:00',
+            6, '2018-06-10 16:30:00',
+            '2018-06-18 16:00:00', 'in zwei Tagen', 'Den Transformator austauschen', 1,
+            1, 'dagmar', 'Abteilung opq', '2018-06-09 15:00:00',
+            'dagmar', 'Abteilung opq', '2018-06-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_9', 'Alles kaputt', 'Alles', 'Alles defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 8,
+            'Alles', 'K-222',
+            'otto', 'Berlin', 'einmalig', '2018-06-15 15:15:00',
+            2, '2018-06-11 16:30:00',
+            '2018-06-19 16:00:00', 'in zwei Jahren', 'Alles wegwerfen', 2,
+            3, 'bruno', 'Abteilung opq', '2018-06-10 15:00:00',
+            'claudio', 'Abteilung opq', '2018-06-15 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_10', 'Schalter erneuern', 'Schalter', 'Schalter defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 9,
+            'Schalter', 'K-004',
+            'hugo', 'Kassel', 'einmalig', '2018-08-14 15:15:00',
+            9, '2018-08-10 16:30:00',
+            '2018-08-18 16:00:00', 'in 6 Tagen', 'Den Schalter austauschen', 1,
+            1, 'dagmar', 'Abteilung opq', '2018-08-09 15:00:00',
+            'otto', 'Abteilung opq', '2018-08-14 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_11', 'Rechner austauschen', 'Rechner', 'Rechner defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 10,
+            'Rechner', 'K-155',
+            'claudio', 'Murr', 'einmalig', '2018-06-12 15:15:00',
+            3, '2018-06-08 16:30:00',
+            '2018-06-16 16:00:00', 'in zwei Tagen', 'Den Rechner austauschen', 4,
+            1, 'hugo', 'Abteilung opq', '2018-06-07 15:00:00',
+            'otto', 'Abteilung opq', '2018-06-12 15:15:00');
+
+INSERT INTO public.tbl_gridmeasure(
+            id_descriptive, title, affected_resource, remark, email_addresses, fk_ref_gm_status,
+            switching_object, cost_center,
+            approval_by, area_of_switching, appointment_repetition, appointment_startdate,
+            appointment_numberof, planned_starttime_first_singlemeasure,
+            endtime_gridmeasure, time_of_reallocation, description, fk_ref_branch,
+            fk_ref_branch_level, create_user, create_user_department, create_date,
+            mod_user, mod_user_department, mod_date)
+    VALUES ('2018_12', 'Maschine untersuchen', 'Maschine', 'Maschine defekt', 'mailingListRecipient@test.de; mailingList2Recipient@test.de', 11,
+            'Maschine', 'K-004',
+            'otto', 'Ludwigsburg', 'einmalig', '2018-06-20 15:15:00',
+            5, '2018-06-16 16:30:00',
+            '2018-06-24 16:00:00', 'in 8 Tagen', 'Die Maschine austauschen', 1,
+            1, 'bruno', 'Abteilung opq', '2018-06-15 15:00:00',
+            'bruno', 'Abteilung opq', '2018-06-20 15:15:00');
+
+
+
+
+-- ---------------------------------------------
+-- TABLE TBL_SINGLE_GRIDMEASURE
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_single_gridmeasure_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_single_gridmeasure_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_single_gridmeasure
+(
+  id integer NOT NULL DEFAULT nextval('tbl_single_gridmeasure_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  title character varying(256),
+  switching_object character varying(256),
+  cim_id character varying(256),
+  cim_name character varying(256),
+  cim_description character varying(1024),
+  planned_starttime_singlemeasure timestamp without time zone,
+  planned_endtime_singlemeasure timestamp without time zone,
+  description character varying(1024),
+  responsible_onsite_name character varying(256),
+  responsible_onsite_department character varying(256),
+  network_control character varying(256),
+  fk_tbl_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_single_gridmeasure_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_single_gridmeasure__gridmeasure FOREIGN KEY (fk_tbl_gridmeasure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_single_gridmeasure
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_single_gridmeasure TO plgm_service;
+
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department, fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe ausschalten', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung','Otto','Abteilung abc', 1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Kabel kürzen', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung def',1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (3, 'Transformator tauschen', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung ghi',1, 'Otto', '01.07.2018', 'Otto',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Lampe erneuern', 'Lampe', '2', 'cim', 'cim Beschreibung',
+            '2018-06-12 16:30:00', '2018-06-13 14:00:00',
+            'Beschreibung', 'Otto','Abteilung jkl',2, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-13 16:30:00', '2018-06-14 14:00:00',
+            'Beschreibung', 'Otto','Abteilung mno',3, 'Hugo', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-14 16:30:00', '2018-06-15 14:00:00',
+            'Beschreibung', 'Otto','Abteilung pqr',4, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Gas', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung stu',5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Gas 2', 'Gas', '2', 'cim', 'cim Beschreibung',
+            '2018-07-10 16:30:00', '2018-07-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung vwx',5, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Stuhl', 'Stuhl', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 'Otto','Abteilung yz',6, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Kabel', 'Kabel', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',7, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Transformator', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Transformator 2', 'Transformator', '2', 'cim', 'cim Beschreibung',
+            '2018-06-10 16:30:00', '2018-06-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',8, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Alles', 'Alles', '2', 'cim', 'cim Beschreibung',
+            '2018-06-11 16:30:00', '2018-06-12 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',9, 'Otto', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Schalter', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (2, 'Schalter 2', 'Schalter', '2', 'cim', 'cim Beschreibung',
+            '2018-08-10 16:30:00', '2018-08-11 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',10, 'Otto', '01.07.2018', 'Hugo',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Rechner', 'Rechner', '2', 'cim', 'cim Beschreibung',
+            '2018-06-08 16:30:00', '2018-06-09 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',11, 'Jasper', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+INSERT INTO public.tbl_single_gridmeasure(
+            sortorder, title, switching_object, cim_id, cim_name, cim_description,
+            planned_starttime_singlemeasure, planned_endtime_singlemeasure,
+            description, responsible_onsite_name, responsible_onsite_department,fk_tbl_gridmeasure, create_user, create_date, mod_user,
+            mod_date)
+    VALUES (1, 'Maschine', 'Maschine', '2', 'cim', 'cim Beschreibung',
+            '2018-06-16 16:30:00', '2018-06-17 14:00:00',
+            'Beschreibung', 'Otto','Abteilung abc',12, 'Hugo', '01.07.2018', 'Jasper',
+            '01.07.2018');
+
+
+-- ---------------------------------------------
+-- TABLE TBL_STEPS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_steps_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_steps_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_steps
+(
+  id integer NOT NULL DEFAULT nextval('tbl_steps_id_seq'::regclass),
+  sortorder integer NOT NULL,
+  switching_object character varying(256),
+  type character varying(256),
+  present_time character varying(256),
+  present_state character varying(256),
+  target_state character varying(256),
+  operator character varying(256),
+  fk_tbl_single_gridmeasure integer NOT NULL,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_steps_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_steps__single_gridmeasure FOREIGN KEY (fk_tbl_single_gridmeasure)
+      REFERENCES public.tbl_single_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_steps
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_steps TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE REF_VERSION
+-- ---------------------------------------------
+
+DROP TABLE IF EXISTS public.REF_VERSION;
+
+CREATE TABLE public.REF_VERSION
+(
+  id integer NOT NULL,
+  version character varying(100) NOT NULL,
+  CONSTRAINT ref_version_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.REF_VERSION
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE public.REF_VERSION TO PLGM_SERVICE;
+
+INSERT INTO REF_VERSION VALUES (1, '0.0.1_PG');
+
+-- ---------------------------------------------
+-- TABLE TBL_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_documents_id_seq'::regclass),
+  document_name character varying(260),
+  document bytea,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_documents_pkey PRIMARY KEY (id)
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_documents TO plgm_service;
+
+
+-- ---------------------------------------------
+-- TABLE TBL_MEASURE_DOCUMENTS
+-- ---------------------------------------------
+
+CREATE SEQUENCE public.tbl_measure_documents_id_seq
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+ALTER TABLE public.tbl_measure_documents_id_seq
+  OWNER TO plgm_service;
+
+CREATE TABLE public.tbl_measure_documents
+(
+  id integer NOT NULL DEFAULT nextval('tbl_measure_documents_id_seq'::regclass),
+  fk_tbl_measure integer,
+  fk_tbl_documents integer,
+  create_user character varying(100) NOT NULL,
+  create_date timestamp without time zone NOT NULL,
+  mod_user character varying(100),
+  mod_date timestamp without time zone,
+  CONSTRAINT tbl_measure_documents_pkey PRIMARY KEY (id),
+  CONSTRAINT fk_tbl_measure_documents_measure FOREIGN KEY (fk_tbl_measure)
+      REFERENCES public.tbl_gridmeasure (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE CASCADE,
+  CONSTRAINT fk_tbl_measure_documents_documents FOREIGN KEY (fk_tbl_documents)
+      REFERENCES public.tbl_documents (id) MATCH SIMPLE
+      ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (
+  OIDS=FALSE
+);
+ALTER TABLE public.tbl_measure_documents
+  OWNER TO plgm_service;
+GRANT ALL ON TABLE public.tbl_measure_documents TO plgm_service;
+
+
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- HISTORY-TABLES
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+-- PUBLIC.HREF_TERRITORY Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_TERRITORY;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_TERRITORY_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_TERRITORY_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_TERRITORY_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_TERRITORY
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_TERRITORY_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_TERRITORY_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_TERRITORY
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_TERRITORY TO PLGM_SERVICE;
+
+
+
+-- PUBLIC.HTBL_LOCK Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_LOCK;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_LOCK_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_LOCK_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_LOCK_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_LOCK
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_LOCK_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  KEY integer,
+  USERNAME character varying (50),
+  INFO character varying (256),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_LOCK_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_LOCK
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_LOCK TO PLGM_SERVICE;
+
+
+
+
+-- PUBLIC.HTBL_USER_SETTINGS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_USER_SETTINGS;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_USER_SETTINGS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_USER_SETTINGS
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_USER_SETTINGS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  USERNAME character varying (50),
+  SETTING_TYPE character varying (50),
+  VALUE character varying(4096),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_USER_SETTINGS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_USER_SETTINGS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_USER_SETTINGS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_COST_CENTER Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_COST_CENTER;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_COST_CENTER_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_COST_CENTER
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_COST_CENTER_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_COST_CENTER_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_COST_CENTER
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_COST_CENTER TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  COLOR_CODE character varying (20),
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH TO PLGM_SERVICE;
+
+-- PUBLIC.HREF_BRANCH_LEVEL Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_BRANCH_LEVEL
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_BRANCH_LEVEL_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying (50),
+  DESCRIPTION character varying (255),
+  FK_REF_BRANCH integer,
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_BRANCH_LEVEL_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_BRANCH_LEVEL
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_BRANCH_LEVEL TO PLGM_SERVICE;
+
+
+-- PUBLIC.HREF_GM_STATUS Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HREF_GM_STATUS;
+DROP SEQUENCE IF EXISTS PUBLIC.HREF_GM_STATUS_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HREF_GM_STATUS
+(
+  HID integer NOT NULL DEFAULT nextval('HREF_GM_STATUS_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  NAME character varying(50),
+  COLOR_CODE character varying(20),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HREF_GM_STATUS_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HREF_GM_STATUS
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HREF_GM_STATUS TO PLGM_SERVICE;
+
+
+-- PUBLIC.HTBL_GRIDMEASURE Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+-- REQUESTER_NAME COLUMN DELETED--
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_GRIDMEASURE;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_GRIDMEASURE_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  INCREMENT 1
+  MINVALUE 1
+  MAXVALUE 9223372036854775807
+  START 1
+  CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE_ID_SEQ
+  OWNER TO PLGM_SERVICE;
+
+CREATE TABLE PUBLIC.HTBL_GRIDMEASURE
+(
+  HID integer NOT NULL DEFAULT nextval('HTBL_GRIDMEASURE_ID_SEQ'::regclass),
+  HACTION integer NOT NULL,
+  HDATE timestamp without time zone NOT NULL,
+  HUSER character varying(100),
+
+  ID integer,
+  ID_DESCRIPTIVE character varying (50),
+  TITLE character varying (256),
+  AFFECTED_RESOURCE character varying (256),
+  REMARK character varying (1024),
+  EMAIL_ADDRESSES character varying(1024),
+  FK_REF_GM_STATUS integer,
+  SWITCHING_OBJECT character varying (256),
+  COST_CENTER character varying (50),
+  APPROVAL_BY character varying (256),
+  AREA_OF_SWITCHING character varying (256),
+  APPOINTMENT_REPETITION character varying (100),
+  APPOINTMENT_STARTDATE timestamp without time zone,
+  APPOINTMENT_NUMBEROF integer,
+  PLANNED_STARTTIME_FIRST_SINGLEMEASURE timestamp without time zone,
+  ENDTIME_GRIDMEASURE timestamp without time zone,
+  TIME_OF_REALLOCATION character varying (100),
+  DESCRIPTION character varying (1024),
+  FK_REF_BRANCH integer,
+  FK_REF_BRANCH_LEVEL integer,
+  CREATE_USER_DEPARTMENT character varying (100),
+  MOD_USER_DEPARTMENT character varying (100),
+
+  CREATE_USER character varying(100),
+  CREATE_DATE timestamp without time zone,
+  MOD_USER character varying(100),
+  MOD_DATE timestamp without time zone,
+  CONSTRAINT HTBL_GRIDMEASURE_PKEY PRIMARY KEY (HID)
+)
+WITH (
+  OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_GRIDMEASURE
+  OWNER TO PLGM_SERVICE;
+GRANT ALL ON TABLE PUBLIC.HTBL_GRIDMEASURE TO PLGM_SERVICE;
+
+CREATE INDEX HUSER_INDEX ON PUBLIC.HTBL_GRIDMEASURE (HUSER);
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'otto',12,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'otto',12,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'otto',12,3, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'otto',12,4, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'otto',12,5, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'otto',12,6, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'otto',12,7, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'otto',12,8, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:09:00', 'otto',12,9, 'admin', '2018-06-11 14:09:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:10:00', 'otto',12,10, 'admin', '2018-06-11 14:10:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:11:00', 'otto',12,11, 'admin', '2018-06-11 14:11:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:55:00', 'admin',13,0, 'admin', '2018-07-01 14:55:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:56:00', 'admin',13,1, 'admin', '2018-07-01 14:56:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,3, 'admin', '2018-07-01 14:57:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-07-01 14:57:00', 'admin',13,12, 'admin', '2018-07-01 14:57:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:00:00', 'admin',11,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:01:00', 'admin',11,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:02:00', 'admin',11,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:03:00', 'admin',11,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:04:00', 'admin',11,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:05:00', 'admin',11,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:06:00', 'admin',11,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:07:00', 'admin',11,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:08:00', 'admin',11,9, 'admin', '2018-06-11 14:08:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (1, '2018-06-11 14:09:00', 'admin',11,10, 'admin', '2018-06-11 14:09:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',10,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',10,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',10,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',10,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',10,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',10,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',10,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',10,8, 'admin', '2018-06-11 14:07:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:08:00', 'admin',10,9, 'admin', '2018-06-11 14:08:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',9,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',9,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',9,3, 'admin', '2018-06-11 14:02:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:03:00', 'admin',9,4, 'admin', '2018-06-11 14:03:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:04:00', 'admin',9,5, 'admin', '2018-06-11 14:04:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:05:00', 'admin',9,6, 'admin', '2018-06-11 14:05:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:06:00', 'admin',9,7, 'admin', '2018-06-11 14:06:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:07:00', 'admin',9,8, 'admin', '2018-06-11 14:07:00');
+
+
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:00:00', 'admin',8,0, 'admin', '2018-06-11 14:00:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:01:00', 'admin',8,1, 'admin', '2018-06-11 14:01:00');
+INSERT INTO public.htbl_gridmeasure(haction, hdate, huser, id, fk_ref_gm_status, mod_user, mod_date)
+VALUES (2, '2018-06-11 14:02:00', 'admin',8,3,