Created
February 11, 2013 11:31
-
-
Save ksiwonia/4753979 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION update_reportcolumnwidth() RETURNS INTEGER AS | |
' | |
DECLARE | |
tenant RECORD; | |
BEGIN | |
FOR tenant IN SELECT * FROM qcadootenant_tenant LOOP | |
IF EXISTS(SELECT * FROM qcadoosaasplugin_tenantplugin WHERE tenantid = tenant."id" AND pluginidentifier = ''basic'' AND tenantenabled = true LIMIT 1) THEN | |
INSERT INTO basic_reportcolumnwidth(id, identifier, name, width, chartype, parameter_id, tenantid) | |
VALUES ( | |
nextval(''hibernate_sequence'') + 1000, | |
''unit'', | |
''basic.reportColumnWidth.name.value.Unit'', | |
5, | |
''01smallChars'', | |
SELECT id FROM basic_parameter WHERE tenantid = tenant."id" LIMIT 1, | |
tenant."id" | |
); | |
INSERT INTO basic_reportcolumnwidth(id, identifier, name, width, chartype, parameter_id, tenantid) | |
VALUES ( | |
nextval(''hibernate_sequence'') + 1000, | |
''currency'', | |
''basic.reportColumnWidth.name.value.Currency'', | |
3, | |
''02largeChars'', | |
SELECT id FROM basic_parameter WHERE tenantid = tenant."id" LIMIT 1, | |
tenant."id" | |
); | |
INSERT INTO basic_reportcolumnwidth(id, identifier, name, width, chartype, parameter_id, tenantid) | |
VALUES ( | |
nextval(''hibernate_sequence'') + 1000, | |
''number'', | |
''basic.reportColumnWidth.name.value.Number'', | |
15, | |
''02largeChars'', | |
SELECT id FROM basic_parameter WHERE tenantid = tenant."id" LIMIT 1, | |
tenant."id" | |
); | |
INSERT INTO basic_reportcolumnwidth(id, identifier, name, width, chartype, parameter_id, tenantid) | |
VALUES ( | |
nextval(''hibernate_sequence'') + 1000, | |
''lp'', | |
''basic.reportColumnWidth.name.value.Lp'', | |
2, | |
''02largeChars'', | |
SELECT id FROM basic_parameter WHERE tenantid = tenant."id" LIMIT 1, | |
tenant."id" | |
); | |
END IF; | |
END LOOP; | |
RETURN 1; | |
END; | |
' | |
LANGUAGE 'plpgsql'; | |
SELECT * FROM update_reportcolumnwidth(); | |
DROP FUNCTION update_reportcolumnwidth(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment