From 2b2281707c00ed69ed5361835332819cd66f4b50 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 28 May 2012 14:15:36 +0800 Subject: [PATCH] IDEMPIERE-274 Database seed missing Generate_UUID function --- .../oracle/840_IDEMPIERE-274.sql | 16 ++++++++++++++++ .../postgresql/840_IDEMPIERE-274.sql | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 migration/360lts-release/oracle/840_IDEMPIERE-274.sql create mode 100644 migration/360lts-release/postgresql/840_IDEMPIERE-274.sql diff --git a/migration/360lts-release/oracle/840_IDEMPIERE-274.sql b/migration/360lts-release/oracle/840_IDEMPIERE-274.sql new file mode 100644 index 0000000000..c776d28aea --- /dev/null +++ b/migration/360lts-release/oracle/840_IDEMPIERE-274.sql @@ -0,0 +1,16 @@ +-- May 28, 2012 02:05:39 PM MYT +-- IDEMPIERE-274 Database seed missing Generate_UUID function +create or replace function generate_uuid return varchar as +guid varchar(32); +uuid varchar(36); +begin + guid := lower(sys_guid()); + uuid := substr(guid, 1, 8) || '-' || substr(guid, 9, 4) || '-' || substr(guid, 13, 4) || '-' || substr(guid, 17, 4) || '-' || substr(guid, 21, 12); + return uuid; +end; + +UPDATE AD_System + SET LastMigrationScriptApplied='840_IDEMPIERE-274.sql' +WHERE LastMigrationScriptApplied<'840_IDEMPIERE-274.sql' + OR LastMigrationScriptApplied IS NULL +; diff --git a/migration/360lts-release/postgresql/840_IDEMPIERE-274.sql b/migration/360lts-release/postgresql/840_IDEMPIERE-274.sql new file mode 100644 index 0000000000..4dbc1b8ca5 --- /dev/null +++ b/migration/360lts-release/postgresql/840_IDEMPIERE-274.sql @@ -0,0 +1,18 @@ +-- You must activate the uuid-ossp extension before running this script. +-- For PostgreSQL 9.0 and earlier, run contrib/uuid-ossp.sql to activate the extension. +-- For Postgresql 9.1, run the CREATE EXTENSION "uuid-ossp" sql command t activate the extension. + +-- May 28, 2012 02:05:39 PM MYT +-- IDEMPIERE-274 Database seed missing Generate_UUID function +CREATE OR REPLACE FUNCTION generate_uuid() +RETURNS char(36) AS $$ +BEGIN + return uuid_generate_v4()::char(36); +END; +$$ LANGUAGE plpgsql IMMUTABLE STRICT; + +UPDATE AD_System + SET LastMigrationScriptApplied='840_IDEMPIERE-274.sql' +WHERE LastMigrationScriptApplied<'840_IDEMPIERE-274.sql' + OR LastMigrationScriptApplied IS NULL +;