Created
November 20, 2024 17:55
-
-
Save sheosi/ee3545a1974b9cacb5f3028d937a15b3 to your computer and use it in GitHub Desktop.
documents.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table "documents" { | |
comment = "Documents" | |
schema = schema.main | |
column "hash" { | |
comment = "An xxhash3 of user_id site_id col_label and doc_label" | |
type = int | |
} | |
column "numeral" { | |
comment = "A disambiguation for hashes" | |
type = int | |
#auto_increment = true | |
} | |
primary_key { | |
columns = [column.hash, column.numeral] | |
} | |
column "label" { | |
comment = "An automatically generated url-safe version of the name" | |
type = text | |
} | |
column "name" { | |
type = text | |
} | |
column "data" { | |
comment = "The document saved in the postcard binary format" | |
type = blob | |
} | |
column "user_id" { | |
type = int | |
} | |
foreign_key "user_id" { | |
columns = [column.user_id] | |
ref_columns = [table.users.column.id] | |
on_delete = CASCADE | |
on_update = NO_ACTION | |
} | |
column "col_hash" { | |
comment = "The hash of the collection this document pertains to" | |
type = int | |
} | |
column "col_numeral" { | |
comment = "The numeral of the collection this document pertains to" | |
type = int | |
} | |
foreign_key "collection" { | |
columns = [column.col_hash, column.col_numeral] | |
ref_columns = [table.collections.column.hash, table.collections.column.numeral] | |
on_delete = CASCADE | |
on_update = NO_ACTION | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment