From b66352fb059e77dbc0511bfabda9562d7c90e336 Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Fri, 14 Dec 2018 09:14:12 +0100 Subject: [PATCH] refactor VARCHAR to NVARCHAR, update datatype documentation --- others/db_changes/readme.adoc | 3 +- others/db_changes/struct/contractChanges.xml | 7 -- others/db_changes/struct/create_address.xml | 22 ++--- others/db_changes/struct/create_comm.xml | 6 +- others/db_changes/struct/create_contract.xml | 6 +- .../db_changes/struct/create_countryinfo.xml | 8 +- others/db_changes/struct/create_history.xml | 6 +- others/db_changes/struct/create_offer.xml | 4 +- others/db_changes/struct/create_offeritem.xml | 8 +- others/db_changes/struct/create_org.xml | 4 +- others/db_changes/struct/create_pers.xml | 16 +-- others/db_changes/struct/create_prod2prod.xml | 4 +- others/db_changes/struct/create_product.xml | 8 +- .../db_changes/struct/create_productprice.xml | 6 +- others/db_changes/struct/create_relation.xml | 4 +- .../db_changes/struct/create_salesproject.xml | 8 +- .../create_salesproject_classification.xml | 6 +- .../create_salesproject_competition.xml | 4 +- .../struct/create_salesproject_cycle.xml | 4 +- .../struct/create_salesproject_forecast.xml | 6 +- .../struct/create_salesproject_member.xml | 4 +- .../struct/create_salesproject_source.xml | 4 +- others/db_changes/struct/create_stock.xml | 6 +- .../db_changes/struct/create_timetracking.xml | 4 +- others/db_changes/whichDatatype.adoc | 97 ++++++++++++++++++- 25 files changed, 168 insertions(+), 87 deletions(-) delete mode 100644 others/db_changes/struct/contractChanges.xml diff --git a/others/db_changes/readme.adoc b/others/db_changes/readme.adoc index 0a3669f7ce..0eb0f310d1 100644 --- a/others/db_changes/readme.adoc +++ b/others/db_changes/readme.adoc @@ -73,8 +73,7 @@ Therefore it's easy to use and you can start immediately. == FAQ [qanda] What about unicode-columns like `NVARCHAR` or `NCLOB`?:: - Simply define them in your changesets; This is something which is not completely verified: - Maybe columns like `NCLOB` cause problems in some DBMS like _MS SQL Server_ + Simply define them in your changesets. They are prefered over non-unicode-datatypes What if i switch between branches and want to switch between different database-states?:: This is something that needs to be defined. Possible ways: rollback or recreate your database entirely Is it possible to write an update-changeset where I can use a preparedStatement in the where-clause?:: diff --git a/others/db_changes/struct/contractChanges.xml b/others/db_changes/struct/contractChanges.xml deleted file mode 100644 index f7f2e2c301..0000000000 --- a/others/db_changes/struct/contractChanges.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.1" encoding="UTF-8" standalone="no"?> -<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> - <changeSet author="m.schroeger" id="eae40a20-2a4a-4a96-99f6-b66fb9f5e6c9"> - <addUniqueConstraint tableName="CONTRACT" columnNames="CONTRACTCODE" constraintName="unique_CONTRACT_CONTRACTCODE"/> - - </changeSet> -</databaseChangeLog> \ No newline at end of file diff --git a/others/db_changes/struct/create_address.xml b/others/db_changes/struct/create_address.xml index 3444b2f8c9..9ec6e0e9ad 100644 --- a/others/db_changes/struct/create_address.xml +++ b/others/db_changes/struct/create_address.xml @@ -10,23 +10,23 @@ <constraints nullable="false"/> </column> <column name="ADDR_TYPE" type="SMALLINT"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> - <column name="ADDRESS" type="VARCHAR(50)"/> - <column name="ADDRESSADDITION" type="VARCHAR(60)"/> - <column name="ADDRIDENTIFIER" type="VARCHAR(60)"/> - <column name="BUILDINGNO" type="VARCHAR(50)"/> - <column name="CITY" type="VARCHAR(50)"/> + <column name="ADDRESS" type="NVARCHAR(50)"/> + <column name="ADDRESSADDITION" type="NVARCHAR(60)"/> + <column name="ADDRIDENTIFIER" type="NVARCHAR(60)"/> + <column name="BUILDINGNO" type="NVARCHAR(50)"/> + <column name="CITY" type="NVARCHAR(50)"/> <column name="COUNTRY" type="CHAR(2)"/> - <column name="DISTRICT" type="VARCHAR(50)"/> - <column name="REGION" type="VARCHAR(50)"/> + <column name="DISTRICT" type="NVARCHAR(50)"/> + <column name="REGION" type="NVARCHAR(50)"/> <column name="RELATION_ID" type="CHAR(36)"> <constraints nullable="false"/> </column> - <column name="STATE" type="VARCHAR(50)"/> - <column name="ZIP" type="VARCHAR(50)"/> + <column name="STATE" type="NVARCHAR(50)"/> + <column name="ZIP" type="NVARCHAR(50)"/> </createTable> <addColumn tableName="RELATION"> diff --git a/others/db_changes/struct/create_comm.xml b/others/db_changes/struct/create_comm.xml index ce1a745f3f..0e98076aee 100644 --- a/others/db_changes/struct/create_comm.xml +++ b/others/db_changes/struct/create_comm.xml @@ -5,7 +5,7 @@ <column name="COMMID" type="CHAR(36)"> <constraints primaryKey="true" primaryKeyName="PK_COMM_COMMID"/> </column> - <column name="ADDR" type="VARCHAR(255)"/> + <column name="ADDR" type="NVARCHAR(255)"/> <column name="MEDIUM_ID" type="INTEGER"/> <column name="RELATION_ID" type="CHAR(36)"/> <column name="STANDARD" type="TINYINT"> @@ -15,8 +15,8 @@ <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> </createTable> diff --git a/others/db_changes/struct/create_contract.xml b/others/db_changes/struct/create_contract.xml index 6844b7e21f..b6eaabc5ac 100644 --- a/others/db_changes/struct/create_contract.xml +++ b/others/db_changes/struct/create_contract.xml @@ -2,7 +2,7 @@ <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> <changeSet author="m.schroeger" id="fdf350de-cff9-4be1-bcbe-61ec9a46c9f0"> <createTable tableName="CONTRACT"> - <column name="CONTRACTCODE" type="VARCHAR(30)"> + <column name="CONTRACTCODE" type="NVARCHAR(30)"> <constraints nullable="false" unique="true" uniqueConstraintName="UNIQUE_CONTRACT_CONTRACTCODE"/> </column> <column name="CONTRACTDUE" type="TIMESTAMP"/> @@ -13,8 +13,8 @@ </column> <column name="CONTRACTSTATUS" type="INTEGER"/> <column name="CONTRACTTYPE" type="INTEGER"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_countryinfo.xml b/others/db_changes/struct/create_countryinfo.xml index 83b6922f41..eb467867be 100644 --- a/others/db_changes/struct/create_countryinfo.xml +++ b/others/db_changes/struct/create_countryinfo.xml @@ -8,11 +8,11 @@ <column name="ISO3" type="CHAR(3)"> <constraints nullable="false"/> </column> - <column name="NAME_LATIN" type="VARCHAR(100)"/> + <column name="NAME_LATIN" type="NVARCHAR(100)"/> <column name="NAME_NATIVE" type="NVARCHAR(100)"/> - <column name="ADDR_FORMAT" type="VARCHAR(50)"/> - <column name="REQUIRED_FIELDS" type="VARCHAR(50)"/> - <column name="ZIP_REGEX" type="VARCHAR(2000)"/> + <column name="ADDR_FORMAT" type="NVARCHAR(50)"/> + <column name="REQUIRED_FIELDS" type="NVARCHAR(50)"/> + <column name="ZIP_REGEX" type="NVARCHAR(2000)"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> diff --git a/others/db_changes/struct/create_history.xml b/others/db_changes/struct/create_history.xml index 5a648df0cb..1bb222b3e2 100644 --- a/others/db_changes/struct/create_history.xml +++ b/others/db_changes/struct/create_history.xml @@ -2,7 +2,7 @@ <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> <changeSet author="d.lechner" id="1528461798137-1"> <createTable tableName="HISTORY"> - <column name="SUBJECT" type="VARCHAR(254)"/> + <column name="SUBJECT" type="NVARCHAR(254)"/> <column name="INFO" type="NCLOB"/> <column name="MEDIUM" type="INTEGER"/> <column name="DIRECTION" type="CHAR(1)"/> @@ -10,10 +10,10 @@ <column name="HISTORYID" type="CHAR(36)"> <constraints primaryKey="true" primaryKeyName="PK_HISTORY_HISTORYID"/> </column> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> + <column name="USER_EDIT" type="NVARCHAR(50)"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> diff --git a/others/db_changes/struct/create_offer.xml b/others/db_changes/struct/create_offer.xml index a0a379cefc..de77d4e25e 100644 --- a/others/db_changes/struct/create_offer.xml +++ b/others/db_changes/struct/create_offer.xml @@ -25,8 +25,8 @@ <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> </createTable> diff --git a/others/db_changes/struct/create_offeritem.xml b/others/db_changes/struct/create_offeritem.xml index ee141f069a..4e2a246e03 100644 --- a/others/db_changes/struct/create_offeritem.xml +++ b/others/db_changes/struct/create_offeritem.xml @@ -19,18 +19,18 @@ <constraints nullable="false" foreignKeyName="FK_OFFERITEM_PRODUCT_ID" references="PRODUCT(PRODUCTID)"/> </column> <column name="VAT" type="NUMERIC(14,2)"/> - <column name="ITEMNAME" type="VARCHAR(250)"/> + <column name="ITEMNAME" type="NVARCHAR(250)"/> <column name="OPTIONAL" type="TINYINT"> <constraints nullable="false"/> </column> <column name="DISCOUNT" type="NUMERIC(14,2)"/> - <column name="ITEMPOSITION" type="VARCHAR(10)"/> + <column name="ITEMPOSITION" type="NVARCHAR(10)"/> <column name="DATE_EDIT" type="TIMESTAMP"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> </createTable> diff --git a/others/db_changes/struct/create_org.xml b/others/db_changes/struct/create_org.xml index 8622d415d0..1cb5a20821 100644 --- a/others/db_changes/struct/create_org.xml +++ b/others/db_changes/struct/create_org.xml @@ -16,10 +16,10 @@ <column name="STRENGTH" type="INTEGER"/> <column name="WEAKNESS" type="INTEGER"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> + <column name="USER_EDIT" type="NVARCHAR(50)"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> diff --git a/others/db_changes/struct/create_pers.xml b/others/db_changes/struct/create_pers.xml index 4ee0fc967d..6943d73ad9 100644 --- a/others/db_changes/struct/create_pers.xml +++ b/others/db_changes/struct/create_pers.xml @@ -8,17 +8,17 @@ <column name="DATE_EDIT" type="TIMESTAMP"/> <column name="DATE_NEW" type="TIMESTAMP"/> <column name="DATEOFBIRTH" type="DATE"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"/> - <column name="FIRSTNAME" type="VARCHAR(50)"/> - <column name="MIDDLENAME" type="VARCHAR(50)"/> - <column name="LASTNAME" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"/> + <column name="FIRSTNAME" type="NVARCHAR(50)"/> + <column name="MIDDLENAME" type="NVARCHAR(50)"/> + <column name="LASTNAME" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="GENDER" type="CHAR(1)"/> - <column name="SALUTATION" type="VARCHAR(16)"/> - <column name="TITLE" type="VARCHAR(50)"/> - <column name="TITLESUFFIX" type="VARCHAR(50)"/> + <column name="SALUTATION" type="NVARCHAR(16)"/> + <column name="TITLE" type="NVARCHAR(50)"/> + <column name="TITLESUFFIX" type="NVARCHAR(50)"/> </createTable> <createIndex indexName="IDX_PERS" tableName="PERS"> <column name="FIRSTNAME"/> diff --git a/others/db_changes/struct/create_prod2prod.xml b/others/db_changes/struct/create_prod2prod.xml index a52b1bda72..8dd66b17a3 100644 --- a/others/db_changes/struct/create_prod2prod.xml +++ b/others/db_changes/struct/create_prod2prod.xml @@ -22,8 +22,8 @@ <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> </createTable> diff --git a/others/db_changes/struct/create_product.xml b/others/db_changes/struct/create_product.xml index 73153b0db2..7066b39170 100644 --- a/others/db_changes/struct/create_product.xml +++ b/others/db_changes/struct/create_product.xml @@ -9,10 +9,10 @@ <column name="GROUPCODEID" type="INTEGER"/> <column name="MINSTOCK" type="INTEGER"/> <column name="RELATION_ID" type="CHAR(36)"/> - <column name="PRODUCTCODE" type="VARCHAR(50)"> + <column name="PRODUCTCODE" type="NVARCHAR(50)"> <constraints nullable="false" unique="true" uniqueConstraintName="UNIQUE_PRODUCT_PRODUCTCODE"/> </column> - <column name="PRODUCTNAME" type="VARCHAR(50)"/> + <column name="PRODUCTNAME" type="NVARCHAR(50)"/> <column name="STATUS" type="INTEGER"/> <column name="UNIT" type="INTEGER"/> <column name="STANDARD" type="INTEGER"/> @@ -20,8 +20,8 @@ <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> </createTable> diff --git a/others/db_changes/struct/create_productprice.xml b/others/db_changes/struct/create_productprice.xml index 662969bf89..626c98b68d 100644 --- a/others/db_changes/struct/create_productprice.xml +++ b/others/db_changes/struct/create_productprice.xml @@ -19,13 +19,13 @@ <constraints nullable="false"/> </column> <column name="PRICELIST" type="INTEGER"/> - <column name="BUYSELL" type="VARCHAR(5)"/> + <column name="BUYSELL" type="NVARCHAR(5)"/> <column name="DATE_EDIT" type="TIMESTAMP"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> </createTable> diff --git a/others/db_changes/struct/create_relation.xml b/others/db_changes/struct/create_relation.xml index cc007b2196..33a4bc63da 100644 --- a/others/db_changes/struct/create_relation.xml +++ b/others/db_changes/struct/create_relation.xml @@ -10,10 +10,10 @@ <column name="RELATIONID" type="CHAR(36)"> <constraints primaryKey="true" primaryKeyName="PK_RELATION_RELATIONID"/> </column> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> + <column name="USER_EDIT" type="NVARCHAR(50)"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> diff --git a/others/db_changes/struct/create_salesproject.xml b/others/db_changes/struct/create_salesproject.xml index fa50bd40ff..614658b91e 100644 --- a/others/db_changes/struct/create_salesproject.xml +++ b/others/db_changes/struct/create_salesproject.xml @@ -6,7 +6,7 @@ <column name="PROJECTCODE" type="INTEGER"> <constraints nullable="false" unique="true" uniqueConstraintName="UNIQUE_SALESPROJECT_PROJECTCODE" /> </column> - <column name="PROJECTTITLE" type="VARCHAR(30)"/> + <column name="PROJECTTITLE" type="NVARCHAR(30)"/> <column name="RELATION_ID" type="CHAR(36)"> <constraints nullable="false"/> </column> @@ -16,7 +16,7 @@ <column name="VOLUME" type="NUMERIC(14,2)"/> <column name="STARTDATE" type="TIMESTAMP"/> <column name="ENDDATE" type="TIMESTAMP"/> - <column name="ESTIMATION" type="VARCHAR(50)"/> + <column name="ESTIMATION" type="NVARCHAR(50)"/> <column name="ESTIMATIONVALUE" type="INTEGER"/> <column name="PROBABILITY" type="INTEGER"/> @@ -24,8 +24,8 @@ <constraints primaryKey="true" primaryKeyName="PK_SALESPROJECT_SALESPROJECTID"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_salesproject_classification.xml b/others/db_changes/struct/create_salesproject_classification.xml index 76c83bb8f8..0c5062330c 100644 --- a/others/db_changes/struct/create_salesproject_classification.xml +++ b/others/db_changes/struct/create_salesproject_classification.xml @@ -10,12 +10,12 @@ </column> <column name="CLASS" type="INTEGER"/> - <column name="TYPE" type="VARCHAR(50)"/> + <column name="TYPE" type="NVARCHAR(50)"/> <column name="VALUE" type="INTEGER"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_salesproject_competition.xml b/others/db_changes/struct/create_salesproject_competition.xml index 7f362d063c..86a854e776 100644 --- a/others/db_changes/struct/create_salesproject_competition.xml +++ b/others/db_changes/struct/create_salesproject_competition.xml @@ -16,8 +16,8 @@ <column name="REASON" type="INTEGER"/> <column name="STATUS" type="INTEGER"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_salesproject_cycle.xml b/others/db_changes/struct/create_salesproject_cycle.xml index 73db00ee25..cb64ce0857 100644 --- a/others/db_changes/struct/create_salesproject_cycle.xml +++ b/others/db_changes/struct/create_salesproject_cycle.xml @@ -15,8 +15,8 @@ <column name="DATE_START" type="TIMESTAMP"/> <column name="DATE_END" type="TIMESTAMP"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_salesproject_forecast.xml b/others/db_changes/struct/create_salesproject_forecast.xml index 8f86a3b2d9..299a4e16ae 100644 --- a/others/db_changes/struct/create_salesproject_forecast.xml +++ b/others/db_changes/struct/create_salesproject_forecast.xml @@ -15,12 +15,12 @@ <column name="GROUPCODE" type="INTEGER"/> <column name="INFO" type="NCLOB"/> <column name="DATE_START" type="TIMESTAMP"/> - <column name="TYPE" type="VARCHAR(10)"/> + <column name="TYPE" type="NVARCHAR(10)"/> <column name="VOLUME" type="INTEGER"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_salesproject_member.xml b/others/db_changes/struct/create_salesproject_member.xml index 29973e3117..12d1cc07a6 100644 --- a/others/db_changes/struct/create_salesproject_member.xml +++ b/others/db_changes/struct/create_salesproject_member.xml @@ -14,8 +14,8 @@ <column name="RELATIONSHIP" type="INTEGER"/> <column name="SALESPROJECT_ROLE" type="INTEGER"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_salesproject_source.xml b/others/db_changes/struct/create_salesproject_source.xml index 60403186ef..7ac4385615 100644 --- a/others/db_changes/struct/create_salesproject_source.xml +++ b/others/db_changes/struct/create_salesproject_source.xml @@ -13,8 +13,8 @@ </column> <column name="SOURCE" type="INTEGER"/> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> <column name="DATE_NEW" type="TIMESTAMP"> diff --git a/others/db_changes/struct/create_stock.xml b/others/db_changes/struct/create_stock.xml index b5f0f60044..fdcbac4766 100644 --- a/others/db_changes/struct/create_stock.xml +++ b/others/db_changes/struct/create_stock.xml @@ -9,7 +9,7 @@ <constraints nullable="false"/> </column> <column name="QUANTITY" type="NUMERIC(14,2)"/> - <column name="REFNUMBER" type="VARCHAR(50)"/> + <column name="REFNUMBER" type="NVARCHAR(50)"/> <column name="PRODUCT_ID" type="CHAR(36)"> <constraints nullable="false" foreignKeyName="FK_STOCK_PRODUCT_ID" references="PRODUCT(PRODUCTID)"/> </column> @@ -19,8 +19,8 @@ <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_EDIT" type="NVARCHAR(50)"/> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> </createTable> diff --git a/others/db_changes/struct/create_timetracking.xml b/others/db_changes/struct/create_timetracking.xml index 6947e705fd..6a8cc243d8 100644 --- a/others/db_changes/struct/create_timetracking.xml +++ b/others/db_changes/struct/create_timetracking.xml @@ -23,10 +23,10 @@ <constraints nullable="false"/> </column> - <column name="USER_NEW" type="VARCHAR(50)"> + <column name="USER_NEW" type="NVARCHAR(50)"> <constraints nullable="false"/> </column> - <column name="USER_EDIT" type="VARCHAR(50)"/> + <column name="USER_EDIT" type="NVARCHAR(50)"/> <column name="DATE_NEW" type="TIMESTAMP"> <constraints nullable="false"/> </column> diff --git a/others/db_changes/whichDatatype.adoc b/others/db_changes/whichDatatype.adoc index 7ba7cd96c3..f71cdce5fc 100644 --- a/others/db_changes/whichDatatype.adoc +++ b/others/db_changes/whichDatatype.adoc @@ -4,11 +4,100 @@ Overview over datatypes This is a simple overview about when to to use which datatype. == Boolean == -Datatype: -tinyint - -Usage: +=== Datatype === +---- +TINYINT +---- +=== Usage === 0 => false 1 => true Add nullable="false" constraint, because for boolean null makes no sense and complicates searches and validations. + +== Text == +Text should be saved as Unicode. For this prefix the datatype with a 'N' (there are some exceptions lik the UUID) + +=== Big text === +For informations, descriptions, ... +---- +NCLOB +---- + +=== Small / Normal text === +For Names, ... + +You have to define the maximum length. +---- +NVARCHAR(50) +---- + +=== Fixed size text === +If you are sure that the length is always fixed and will not change. + +You have to define the length. +---- +NCHAR(5) +---- + +=== UUID's, standardized codes === +For them unicode is mostly not needed. Only use unicode here if you are sure, it is needed. + +For UUID's, standardized codes (language codes), ... + +You have to define the length. +---- +CHAR(5) +---- + +UUID needs length 36: +---- +CHAR(36) +---- + +=== Decimal numbers === +If precision and fixed decimals (Nachkommastellen) are needed, use DECIMAL. +For prices, ... +---- +DECIMAL(10, 2) +---- + +Else you can use double. +---- +DOUBLE +---- + +=== Integer numbers === +In normal cases just use INTEGER + +If you know that very big integers or only very small Integers are needed, you can also use + +Byte count may not be the same on all databases. + +8 Byte + +---- +BIGINT +---- + +4 Byte + +---- +INTEGER +---- + +2 Byte + +---- +SMALLINT +---- + +1 Byte + +---- +TINYINT +---- + +=== Binary data === +---- +BLOB +---- \ No newline at end of file -- GitLab