Closed devinschumacher closed 5 months ago
@devinschumacher Not very clear to me... What is the version you are testing with?
if I pass you SQL file to the CLI (version 3.2.0):
sql2dbml --version
3.2.0
I have this result:
Table "group" {
"id" BIGINT [not null]
"url" BIGINT [not null]
"platform_id" BIGINT [not null]
"project_id" BIGINT [not null]
"status" VARCHAR(255) [not null]
"column_6" BIGINT [not null]
}
Table "amazon_store" {
"id" BIGINT [not null]
"store" BIGINT [not null]
"primary_owner" VARCHAR(255) [not null]
}
Table "video_post" {
"id" BIGINT [not null]
"post_id" BIGINT [not null]
"thumbnail" VARCHAR(255) [not null]
"tags" VARCHAR(500) [not null]
"description" VARCHAR(5000) [not null]
"product_cards" TEXT [not null]
"playlists" TEXT [not null]
"monetization" BOOLEAN [not null]
"status" VARCHAR(255) [not null]
"visibility" VARCHAR(255) [not null]
"srt" TEXT [not null]
"type" VARCHAR(255) [not null]
"youtube_id" BIGINT [not null]
"task_owner" VARCHAR(255) [not null]
"url_other_channel" VARCHAR(255) [not null]
"status_check_copyright" VARCHAR(255) [not null]
"copyright_channel" VARCHAR(255) [not null]
"copyright_visibility" VARCHAR(255) [not null]
"copyright_monetization" VARCHAR(255) [not null]
}
Table "platform" {
"id" BIGINT [not null]
"name" VARCHAR(255) [not null]
}
Table "topic" {
"id" BIGINT [not null]
"name" VARCHAR(255) [not null]
}
Table "project" {
"id" BIGINT [not null]
"name" BIGINT [not null]
}
Table "email" {
"id" BIGINT [not null]
"email_address" VARCHAR(255) [not null]
"password" VARCHAR(255) [not null]
"recovery_email" VARCHAR(255) [not null]
"recovery_email_password" VARCHAR(255) [not null]
"two_factor_type" VARCHAR(255) [not null]
"status" VARCHAR(255) [not null]
}
Table "keyword" {
"id" BIGINT [not null]
"name" VARCHAR(255) [not null]
"plural" VARCHAR(256) [not null]
}
Table "amazon_tag" {
"id" BIGINT [not null]
"tag" VARCHAR(100) [not null]
"status" VARCHAR(255) [not null, note: 'not sure we need this bc maybe is supposed to be a calculated field?']
"fk_amazon_store" SMALLINT [not null]
}
Table "posts_topics" {
"id" BIGINT [not null]
"post_id" BIGINT [not null]
"topic_id" BIGINT [not null]
}
Table "article_post" {
"id" BIGINT [not null]
"post_id" BIGINT [not null]
"body" TEXT [not null]
}
Table "profiles" {
"id" BIGINT [not null]
"url" BIGINT [not null]
"username" BIGINT [not null]
"status" VARCHAR(255) [not null]
"status_checked" DATE [not null]
"password" BIGINT [not null]
"email_id" BIGINT [not null]
"platform_id" BIGINT [not null]
"api_key" VARCHAR(1000) [not null]
"auth_token" VARCHAR(1000) [not null]
"source" VARCHAR(255) [not null, note: 'who built the thing']
}
Table "post" {
"id" BIGINT [not null]
"url" VARCHAR(500) [not null]
"title" VARCHAR(500) [not null]
"keyword_id" BIGINT [not null]
"publish_date" DATE [not null]
"platform_id" BIGINT [not null]
"profile_id" BIGINT [not null]
"status" VARCHAR(255) [not null]
"status_updated" DATE [not null]
"ahrefs_kw" INTEGER [not null]
"ahrefs_traffic" INTEGER [not null]
"ahrefs_rd" INTEGER [not null]
"ahrefs_updated" DATE [not null]
"shortlink" VARCHAR(255) [not null]
"amazon_tag_id" BIGINT [not null]
"group_id" BIGINT [not null]
}
Ref "profiles_email_id_foreign":"email"."id" < "profiles"."email_id"
Ref "profiles_platform_id_foreign":"platform"."id" < "profiles"."platform_id"
Ref "video_post_post_id_foreign":"post"."id" < "video_post"."post_id"
Ref "post_amazon_tag_id_foreign":"amazon_tag"."id" < "post"."amazon_tag_id"
Ref "post_profile_id_foreign":"profiles"."id" < "post"."profile_id"
Ref "group_project_id_foreign":"project"."id" < "group"."project_id"
Ref "posts_topics_post_id_foreign":"post"."id" < "posts_topics"."post_id"
Ref "posts_topics_topic_id_foreign":"topic"."id" < "posts_topics"."topic_id"
Ref "post_group_id_foreign":"group"."id" < "post"."group_id"
Ref "article_post_post_id_foreign":"post"."id" < "article_post"."post_id"
Ref "amazon_tag_fk_amazon_store_foreign":"amazon_store"."id" < "amazon_tag"."fk_amazon_store"
Ref "group_platform_id_foreign":"platform"."id" < "group"."platform_id"
Ref "post_keyword_id_foreign":"keyword"."id" < "post"."keyword_id"
Ref "post_platform_id_foreign":"platform"."id" < "post"."platform_id"
=> Do you have another kind of result?
Hi @devinschumacher,
As @pierresouchay have already mentioned, you're probably using a old dbml CLI version. Yours SQL should import just fine on the newest version. To upgrade your CLI to the lastest version, you can use this command: npm i -g @dbml/cli
.
Thanks
@NQPhuc im probably using the old version? i literally installed the CLI yesterday from the instructions on your docs.
Hi @devinschumacher,
I think the empty log you mention is the error log. In that case, an empty error log indicate that your SQL was successfully converted.
To output the dbml to of a text file you can use this command:
sql2dbml --postgres <path_to_your_sql> -o <out_file_path>
If you omit the -o option, the dbml will be printed on your console and any parsed errors is written into dbml-error.log.
ah okay excellent thank you so much for that! @NQPhuc
trying dbml2sql or sql2dbml through CLI gives me an empty
dbml-error.log
file.no console output.
But when i tried to convert it to DBML with the CLI i just got an empty log file
I tried taking the dbdiagram.io code, and convert that with CLI to sql and got empty
dbml-error.log