IDEMPIERE-274 Database seed missing Generate_UUID function

This commit is contained in:
Heng Sin Low 2012-05-28 14:15:36 +08:00
parent 0287d6dd00
commit 2b2281707c
2 changed files with 34 additions and 0 deletions

View File

@ -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
;

View File

@ -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
;