Difference between revisions of "Database structure"
From iDempiere en
(add schemaspy gui) Tag: visualeditor |
CarlosRuiz (talk | contribs) (Add code to update comments in postgresql) |
||
| Line 5: | Line 5: | ||
| − | This is made by schemaspy,you can made it by yourself,but it has some different, it is group by idempiere domain knowledge | + | This is made by schemaspy,you can made it by yourself,but it has some different, it is group by idempiere domain knowledge. See [[Tables by Module]] |
| + | You can fill the comments on postgresql database executing the following code: | ||
| + | <syntaxhighlight lang="SQL"> | ||
| + | DO $$ | ||
| + | DECLARE | ||
| + | rec RECORD; | ||
| + | cmd varchar; | ||
| + | BEGIN | ||
| + | FOR rec IN | ||
| + | SELECT t.TableName, | ||
| + | CASE WHEN t.IsView='Y' THEN 'VIEW' ELSE 'TABLE' END AS ObjectType, | ||
| + | COALESCE(t.Description,t.Name) AS Description | ||
| + | FROM AD_Table t | ||
| + | WHERE t.IsActive='Y' | ||
| + | ORDER BY 1 | ||
| + | LOOP | ||
| + | cmd := 'COMMENT ON ' || rec.ObjectType || ' ' || rec.TableName || ' IS ''' || | ||
| + | REPLACE(rec.Description,'''', '''''') || ''''; | ||
| + | RAISE NOTICE '%', cmd; | ||
| + | EXECUTE cmd; | ||
| + | END LOOP; | ||
| + | FOR rec IN | ||
| + | SELECT t.TableName, | ||
| + | c.ColumnName, | ||
| + | COALESCE(c.Description,c.Name) AS Description | ||
| + | FROM AD_Table t JOIN AD_Column c ON (c.AD_Table_ID=t.AD_Table_ID) | ||
| + | WHERE t.IsActive='Y' AND c.IsActive='Y' AND c.ColumnSQL IS NULL | ||
| + | ORDER BY 1,2 | ||
| + | LOOP | ||
| + | cmd := 'COMMENT ON COLUMN '|| rec.TableName || '.' || rec.ColumnName || ' IS ''' || | ||
| + | REPLACE(rec.Description,'''', '''''') || ''''; | ||
| + | RAISE NOTICE '%', cmd; | ||
| + | EXECUTE cmd; | ||
| + | END LOOP; | ||
| + | END $$; | ||
| + | </syntaxhighlight> | ||
| − | + | command | |
java -jar schemaspy-6.2.4.jar -t pgsql -dp postgresql-42.7.6.jar -db idempiere -host localhost -port 5432 -u adempiere -p adempiere -s adempiere -noimplied -o D://output | java -jar schemaspy-6.2.4.jar -t pgsql -dp postgresql-42.7.6.jar -db idempiere -host localhost -port 5432 -u adempiere -p adempiere -s adempiere -noimplied -o D://output | ||
Revision as of 14:19, 10 June 2025
See the database structure in
- this SchemaSpy analysis of an iDempiere database generated on 2023-12-24
- this SchemaSpy analysis of an iDempiere database generated on 2019-07-09
- this SchemaSpy analysis of an iDempiere database generated on 2017-12-21. (The generated database structure source code is on GitHub.)
This is made by schemaspy,you can made it by yourself,but it has some different, it is group by idempiere domain knowledge. See Tables by Module
You can fill the comments on postgresql database executing the following code:
DO $$
DECLARE
rec RECORD;
cmd varchar;
BEGIN
FOR rec IN
SELECT t.TableName,
CASE WHEN t.IsView='Y' THEN 'VIEW' ELSE 'TABLE' END AS ObjectType,
COALESCE(t.Description,t.Name) AS Description
FROM AD_Table t
WHERE t.IsActive='Y'
ORDER BY 1
LOOP
cmd := 'COMMENT ON ' || rec.ObjectType || ' ' || rec.TableName || ' IS ''' ||
REPLACE(rec.Description,'''', '''''') || '''';
RAISE NOTICE '%', cmd;
EXECUTE cmd;
END LOOP;
FOR rec IN
SELECT t.TableName,
c.ColumnName,
COALESCE(c.Description,c.Name) AS Description
FROM AD_Table t JOIN AD_Column c ON (c.AD_Table_ID=t.AD_Table_ID)
WHERE t.IsActive='Y' AND c.IsActive='Y' AND c.ColumnSQL IS NULL
ORDER BY 1,2
LOOP
cmd := 'COMMENT ON COLUMN '|| rec.TableName || '.' || rec.ColumnName || ' IS ''' ||
REPLACE(rec.Description,'''', '''''') || '''';
RAISE NOTICE '%', cmd;
EXECUTE cmd;
END LOOP;
END $$;
command
java -jar schemaspy-6.2.4.jar -t pgsql -dp postgresql-42.7.6.jar -db idempiere -host localhost -port 5432 -u adempiere -p adempiere -s adempiere -noimplied -o D://output
