Closed maktouch closed 6 months ago
Most databases support having a comment field for each columns. We could extract the comment, and output it to the definition file.
comment
Example:
This schema
CREATE TABLE `customer_metrics` ( `company_id` bigint unsigned NOT NULL, `date` date NOT NULL, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `customer_email` text, `remote_customer_id` varchar(255) NOT NULL, `mrr` decimal(16,4) DEFAULT NULL COMMENT 'Monthly Recurring Revenue in USD', `ltv` decimal(16,4) DEFAULT NULL COMMENT 'Lifetime Value in USD', PRIMARY KEY (`company_id`,`date`), KEY `customer_metrics_date` (`date`), KEY `customer_metrics_company_id` (`company_id`), KEY `customer_metrics_remote_customer_id` (`remote_customer_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
would output this:
export interface CustomerMetrics { company_id: number customer_email: string | null date: Date /** * Lifetime Value in USD */ ltv: Decimal | null /** * Monthly Recuring Revenue in USD */ mrr: Decimal | null remote_customer_id: string updated_at: Generated<Date> }
which would enable this:
This is a great idea! This should definitely be added.
Most databases support having a
comment
field for each columns. We could extract the comment, and output it to the definition file.Example:
This schema
would output this:
which would enable this:
Upvote & Fund