tablelandnetwork / studio

Discover, design, deploy, and manage data driven web3 apps on Tableland.
https://studio.tableland.xyz
4 stars 1 forks source link

Handle and display auto incrementing pks properly #284

Closed asutula closed 4 months ago

asutula commented 4 months ago

There is a Tableland quirk where, if you create an Integer column with a primary key constraint, it ends up also with an autoincrement modifier once it is materialized on Tableland. We can't specify the autoincrement part of integer primary key autoincrement in our create statement or else we get a syntax error... But when we ask the validator for information about a table, while importing a table, for example, integer primary key autoincrement is the constraint information that comes back.

This PR correctly deals with this situation for Schema data that is created by Studio and hasn't been deployed to Tableland as well as Scheamas that are imported from existing Tableland tables. It provides informative UI so the user understands what is going on.

Create table definition view when a non-integer column is configured:

Create table definition when an integer column is configured:

Create table definition when an integer column is configured and you mouse over the icon:

Table definition component using an icon to show the PK is auto-increment:

Hover state of table definition component using an icon to show the PK is auto-increment:

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 3, 2024 11:27pm
asutula commented 4 months ago

Oops @joewagner I had commented the PR, but forgot to submit the review. I just did, so you can read my comments now if you're interested at all. Sorry about that.