Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight the foreign key connections when selected #309

Open
mingodad opened this issue Mar 12, 2022 · 22 comments
Open

Highlight the foreign key connections when selected #309

mingodad opened this issue Mar 12, 2022 · 22 comments

Comments

@mingodad
Copy link

mingodad commented Mar 12, 2022

Would be nice if we could highlight the foreign key connections when one of then is selected, something like on the image bellow, to facilitate view then on dense schemas.
wwwsqldesigner-highlith

@ondras
Copy link
Owner

ondras commented Apr 4, 2022

This is a good idea. I am, unfortunately, completely out of time these days (only available for urgent bugfixing). So I would gladly accept a PR here.

@Rad0van
Copy link
Contributor

Rad0van commented Apr 4, 2022

@mingodad - as an original author of foreign key relations highlighting (and as someone not really familiar with JS) I can tell you this is a matter of just few lines. See #291 how easy it was to add highlighting of relations (lines). Just add de/highlighting of rows at the end of relations in SQL.Relation.prototype.highlight and SQL.Relation.prototype.dehighlight.

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

I already gave a look at it but could not find the point to touch, where is the relations stored ?
Can you give some directions here ?
With a bit of help maybe I could implement it.

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

Hello Rad0van I just tested your changes and it does exactly what I was expecting it to do, thank you !
Could you make a pull request so ondras can add it ?

@Rad0van
Copy link
Contributor

Rad0van commented Apr 4, 2022

Hello Rad0van I just tested your changes and it does exactly what I was expecting it to do, thank you ! Could you make a pull request so ondras can add it ?

What do you mean? My changes are merged for more than 2 years already. I thought you wanted highlighting the target row above highlighting the relations (that's what I did). Just pull the current sources from github and you should be ready to go...

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

I'm a bit confused it seems that your changes are already there but it was not doing this with the master branch.
I'm an old version and applied your changes #291 and got it to work for me.

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

I think that I just did that before opening this issue (I mean cloned this repo and tested it there, I'll do it again).

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

I just tested at https://ondras.zarovi.cz/sql/demo/?keyword=default with the schema bellow and it doesn't highlight at all.

<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, https://github.com/ondras/wwwsqldesigner/ -->
<!-- Active URL: http://127.0.0.1:5076/wwwsqldesigner/ -->
<sql>
<datatypes db="sqlite">
	<group label="Affinity">
		<type label="Integer" default="0" length="0" sql="INTEGER" quote="" color="rgb(238,238,170)"/>
		<type label="Varchar" length="1" sql="VARCHAR" re="CHARACTER VARYING" quote="'"/>
		<type label="Text" default="" length="1" sql="TEXT" quote="'" color="rgb(255,200,200)"/>
		<type label="Numeric" default="0" length="0" sql="NUMERIC" quote="" color="rgb(238,238,170)"/>
		<type label="Real" default="0" length="0" sql="REAL" quote="" color="rgb(238,238,170)"/>
		<type label="Boolean" length="0" sql="BOOLEAN" quote="'"/>
		<type label="Timestamp" length="0" sql="TIMESTAMP" quote="'"/>
		<type label="Date" length="0" sql="DATE" quote="'"/>
		<type label="Time" length="0" sql="TIME" quote="'"/>
		<type label="BLOB" length="1" sql="BLOB" quote="'" color="rgb(255,200,200)"/>
		<type label="None" default="" length="0" sql="NONE" quote="" color="rgb(200,255,200)"/>
	</group>
</datatypes><table x="10" y="10" name="__tables_metadata">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="label" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="inherit_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="tooltip" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="is_read_only" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="null_when_blank" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="escape_html" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__escape_html_types" row="id" />
</row>
<row name="is_view" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="default_list_limit" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="with_field_prefix" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="with_sql_where" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="with_order_by" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="edit_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="list_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="extra_html" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the tables</comment>
</table>
<table x="276" y="11" name="__table_metadata_fields">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="is_required" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__fields_metadata" row="id" />
</row>
<row name="is_readonly" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="null_when_empty" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="is_input_only" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="show_on_list" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="show_to_edit" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="accept_for_insert_update" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the fields for tables</comment>
</table>
<table x="571" y="9" name="__table_metadata_edit_links">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="link_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="link_field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="show_text_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="filter_src_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="filter_dest_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="show_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="show_field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="sql" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="no_server_fill" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the link fields for a table

insert or ignore into __table_metadata_edit_links(table_id, field_id, link_table_id, link_field_id, show_table_id, show_field_id, show_text_id)
select table_id, field_id, p.id as link_table_id, fm_id.id as link_field_id,
	p.id as show_table_id, fm_id.id as show_field_id, fm_name.id as show_text_id
from __table_metadata_fields as tf
join __fields_metadata as fm on tf.field_id = fm.id and fm.name = 'create_uid',
(select id from __tables_metadata where name = 'res_partner') as p,
(select id from __fields_metadata where name = 'id') as fm_id,
(select id from __fields_metadata where name = 'name') as fm_name</comment>
</table>
<table x="10" y="504" name="__fields_metadata">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="label" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="inherit_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__fields_metadata" row="id" />
</row>
<row name="length" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="type_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__field_types" row="id" />
</row>
<row name="default_value" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="valid_values" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="input_type" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="tooltip" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="is_required" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="is_read_only" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="is_calculated" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="null_when_blank" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="escape_html" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__escape_html_types" row="id" />
</row>
<row name="collate_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__field_type_collations" row="id" />
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the available fields for this database</comment>
</table>
<table x="227" y="503" name="__table_metadata_filter_tables">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="table_filtered_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="table_filtered_field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="sql" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="544" y="506" name="__escape_html_types">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store the options for html escape</comment>
</table>
<table x="775" y="503" name="__field_types">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="inherit_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__field_types" row="id" />
</row>
<row name="length" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all allowed field types for tables</comment>
</table>
<table x="534" y="739" name="__table_metadata_accept_fields">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the accepted/editable fields for a table</comment>
</table>
<table x="230" y="1001" name="__table_metadata_list_fields">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="field_format" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the list fields for a table</comment>
</table>
<table x="686" y="940" name="__field_type_collations">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="169" y="1216" name="__app_sql_parameters">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="default_value" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="app_sql_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="field_type" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="11" y="1217" name="__app_menu">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="label" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="sequence" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="parent_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="code" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="table_view_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="391" y="1216" name="__app_code">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="path" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="content" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="543" y="1216" name="__app_sql">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="sql" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="base" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="683" y="1216" name="__users">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="username" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="password" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="is_admin" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
</sql>

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

Somehow the changes from Rad0van got lost/overwritten.

@Rad0van
Copy link
Contributor

Rad0van commented Apr 4, 2022

I just tested at https://ondras.zarovi.cz/sql/demo/?keyword=default with the schema bellow and it doesn't highlight at all.

<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, https://github.com/ondras/wwwsqldesigner/ -->
<!-- Active URL: http://127.0.0.1:5076/wwwsqldesigner/ -->
<sql>
<datatypes db="sqlite">
	<group label="Affinity">
		<type label="Integer" default="0" length="0" sql="INTEGER" quote="" color="rgb(238,238,170)"/>
		<type label="Varchar" length="1" sql="VARCHAR" re="CHARACTER VARYING" quote="'"/>
		<type label="Text" default="" length="1" sql="TEXT" quote="'" color="rgb(255,200,200)"/>
		<type label="Numeric" default="0" length="0" sql="NUMERIC" quote="" color="rgb(238,238,170)"/>
		<type label="Real" default="0" length="0" sql="REAL" quote="" color="rgb(238,238,170)"/>
		<type label="Boolean" length="0" sql="BOOLEAN" quote="'"/>
		<type label="Timestamp" length="0" sql="TIMESTAMP" quote="'"/>
		<type label="Date" length="0" sql="DATE" quote="'"/>
		<type label="Time" length="0" sql="TIME" quote="'"/>
		<type label="BLOB" length="1" sql="BLOB" quote="'" color="rgb(255,200,200)"/>
		<type label="None" default="" length="0" sql="NONE" quote="" color="rgb(200,255,200)"/>
	</group>
</datatypes><table x="10" y="10" name="__tables_metadata">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="label" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="inherit_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="tooltip" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="is_read_only" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="null_when_blank" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="escape_html" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__escape_html_types" row="id" />
</row>
<row name="is_view" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="default_list_limit" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="with_field_prefix" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="with_sql_where" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="with_order_by" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="edit_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="list_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="extra_html" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the tables</comment>
</table>
<table x="276" y="11" name="__table_metadata_fields">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="is_required" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__fields_metadata" row="id" />
</row>
<row name="is_readonly" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="null_when_empty" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="is_input_only" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="show_on_list" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="show_to_edit" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="accept_for_insert_update" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the fields for tables</comment>
</table>
<table x="571" y="9" name="__table_metadata_edit_links">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="link_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="link_field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="show_text_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="filter_src_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="filter_dest_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="show_table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="show_field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="sql" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="no_server_fill" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the link fields for a table

insert or ignore into __table_metadata_edit_links(table_id, field_id, link_table_id, link_field_id, show_table_id, show_field_id, show_text_id)
select table_id, field_id, p.id as link_table_id, fm_id.id as link_field_id,
	p.id as show_table_id, fm_id.id as show_field_id, fm_name.id as show_text_id
from __table_metadata_fields as tf
join __fields_metadata as fm on tf.field_id = fm.id and fm.name = 'create_uid',
(select id from __tables_metadata where name = 'res_partner') as p,
(select id from __fields_metadata where name = 'id') as fm_id,
(select id from __fields_metadata where name = 'name') as fm_name</comment>
</table>
<table x="10" y="504" name="__fields_metadata">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="label" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="inherit_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__fields_metadata" row="id" />
</row>
<row name="length" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="type_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__field_types" row="id" />
</row>
<row name="default_value" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="valid_values" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="input_type" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="tooltip" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="is_required" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="is_read_only" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="is_calculated" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="null_when_blank" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<row name="escape_html" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__escape_html_types" row="id" />
</row>
<row name="collate_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__field_type_collations" row="id" />
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the available fields for this database</comment>
</table>
<table x="227" y="503" name="__table_metadata_filter_tables">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="table_filtered_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="table_filtered_field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="sql" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="544" y="506" name="__escape_html_types">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store the options for html escape</comment>
</table>
<table x="775" y="503" name="__field_types">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="inherit_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__field_types" row="id" />
</row>
<row name="length" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all allowed field types for tables</comment>
</table>
<table x="534" y="739" name="__table_metadata_accept_fields">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the accepted/editable fields for a table</comment>
</table>
<table x="230" y="1001" name="__table_metadata_list_fields">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="table_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__tables_metadata" row="id" />
</row>
<row name="field_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
<relation table="__table_metadata_fields" row="field_id" />
</row>
<row name="field_format" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
<comment>Store all the list fields for a table</comment>
</table>
<table x="686" y="940" name="__field_type_collations">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="169" y="1216" name="__app_sql_parameters">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="default_value" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="app_sql_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="field_type" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="11" y="1217" name="__app_menu">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="label" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="sequence" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="parent_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="code" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="table_view_id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="391" y="1216" name="__app_code">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="path" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="content" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="543" y="1216" name="__app_sql">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="sql" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="base" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="683" y="1216" name="__users">
<row name="id" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_version_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_cdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="_mdate_" null="0" autoincrement="0">
<datatype>INTEGER</datatype>
</row>
<row name="notes" null="0" autoincrement="0">
<datatype>TEXT</datatype>
</row>
<row name="username" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="password" null="0" autoincrement="0">
<datatype>VARCHAR</datatype>
</row>
<row name="is_admin" null="0" autoincrement="0">
<datatype>BOOLEAN</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
</sql>

How about you had a look at the sources of that site? It obviously serves older version (@ondras probably doesn't update it there). Just checkout the version from github and use that...

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

It's true I just tested the cloned repo and indeed it does highlight as I was expecting, probably I did the test only on https://ondras.zarovi.cz/sql/demo/ before opening this issue.

Could https://ondras.zarovi.cz/sql/demo/ be updated so other people will no do the same as I did and open an issue that doesn't exist ?

@Rad0van
Copy link
Contributor

Rad0van commented Apr 4, 2022

It's true I just tested the cloned repo and indeed it does highlight as I was expecting, probably I did the test only on https://ondras.zarovi.cz/sql/demo/ before opening this issue.

Could https://ondras.zarovi.cz/sql/demo/ be updated so other people will no do the same as I did and open an issue that doesn't exist ?

You can create PR to highlight also the labels of target rows ;-)

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

Even @ondras forgot about it:

This is a good idea. I am, unfortunately, completely out of time these days (only available for urgent bugfixing). So I would gladly accept a PR here.

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

This is also a good idea: "You can create PR to highlight also the labels of target rows ;-)"

@ondras
Copy link
Owner

ondras commented Apr 4, 2022

Could https://ondras.zarovi.cz/sql/demo/ be updated so other people will no do the same as I did and open an issue that doesn't exist ?

Sorry, my bad. I just updated the website to latest master.

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

And I just tested it with the previous xml/schema and now instead of highlight it turn the links invisible.
But on my machine it does highlight.

@ondras
Copy link
Owner

ondras commented Apr 4, 2022

And I just tested it with the previous xml/schema and now instead of highlight it turn the links invisible.

Right, they have stroke-width: undefined.

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

I mean running locally from the repository it does work but online with the update https://ondras.zarovi.cz/sql/demo/ it turns the links invisible.

@ondras
Copy link
Owner

ondras commented Apr 4, 2022

...probably an incorrect config file.

@ondras
Copy link
Owner

ondras commented Apr 4, 2022

...and it should be working now.

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

I just tested again and indeed it's working as expected now, thank you !

@mingodad
Copy link
Author

mingodad commented Apr 4, 2022

But I needed to open the developer tools and turn off the cache to load the new version otherwise it was using the cached/incorrect one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants