k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.4k stars 166 forks source link

Snowflake Autoincrement (or Identity) does not appear in Table page #351

Open awhitford-cip opened 2 years ago

awhitford-cip commented 2 years ago

What happened

When you have a table with an autoincrement (or identity -- which is basically a synonym) column, it is like a Default value clause, but that is not indicated anywhere on the Default value for the column.

create or replace TABLE STRATEGY (
    STRATEGY_ID NUMBER(38,0) NOT NULL autoincrement start 1000 increment 1 COMMENT 'Unique internal key for strategy.',
...
    constraint PK_STRATEGY primary key (STRATEGY_ID),
);

What you expected to happened

It would be nice to see some indication that the Default is an autoincrement, rather than a blank:

image

Anything else we need to know?

If I use a DEFAULT sequence_name.NEXTVAL, then that would show as the default. However, the autoincrement is preferred because it does not change between Continuous Integration runs. (Each Continuous Integration run creates a unique clone to test database changes.)

Environment

k1LoW commented 2 years ago

Thank you for your report!

The default in tbls is not the same as auto increment.

I would be happy to see a MySQL sample to confirm this.

https://github.com/k1LoW/tbls/blob/main/sample/mysql/posts.md

awhitford-cip commented 2 years ago

Understood if you think auto increment is not the same as Default. However, the core issue is that the autoincrement information is lost or unavailable for the Snowflake output. I don't see an "Extra Definition" column for Snowflake.

k1LoW commented 2 years ago

I don't see an "Extra Definition" column for Snowflake.

As you say, Snowflake support is experimental and may be limited compared to other data sources ( Snowflake will remain experimental because it is not possible to build my local environment. ).

If you are able to resolve this, I would encourage you to send a pull request 👍