Description
In this article, we're going to take the following card_product database table and describe it using GenRocket's DDL JSON Schema. This card_product table provides a good example because it utilizes most of the features of GenRocket's DDL JSON Schema.
Card Product Table
Below is an ER Diagram view of the card_product table that will be described in GenRocket's DDL JSON Schama.
GenRocket DDL JSON Schema for Card Product Table
[{ "name": "transaction", "columns": [ { "name": "id", "type": { "datatype": "bigint", "maxLength": "20", "nullable": false, "format": "" }, "metadata": { "hint": "Card Product Id", "observedCharacters": "", "maxValue": "", "minValue": "" } }, { "name": "pin", "type": { "datatype": "int", "maxLength": "10", "nullable": true }, "metadata": { "observedCharacters": "", "maxValue": "", "minValue": "" } }, { "name": "name_on_card", "type": { "name_on_card": "varchar", "maxLength": "50", "nullable": false, "format": "" }, "metadata": { "hint": "Name On Card", "observedCharacters": "A..Z,a..z", "maxValue": "", "minValue": "" } }, { "name": "card_number", "type": { "datatype": "varchar", "maxLength": "16", "nullable": false, "format": "" }, "metadata": { "hint": "Card Number", "observedCharacters": "123456789", "maxValue": "", "minValue": "" } }, { "name": "security_code", "type": { "datatype": "int", "maxLength": "10", "nullable": false, "format": "" }, "metadata": { "hint": "Security Code", "observedCharacters": "", "maxValue": "8999999999", "minValue": "1000000000" } }, { "name": "enable", "type": { "datatype": "tinyint", "maxLength": "1", "nullable": false, "format": "" }, "metadata": { "hint": "", "observedCharacters": "", "maxValue": "" } }, { "name": "date_issued", "type": { "datatype": "date", "maxLength": "", "nullable": false, "format": "yyyy-MM-dd HH:mm:ss" }, "metadata": { "hint": "Issued", "observedCharacters": "", "maxValue": "", "minValue": "" } }, { "name": "date_expired", "type": { "datatype": "date", "maxLength": "", "nullable": false, "format": "yyyy-MM-dd HH:mm:ss" }, "metadata": { "hint": "Expired", "observedCharacters": "", "maxValue": "", "minValue": "" } }, { "name": "date_activated", "type": { "datatype": "date", "maxLength": "", "nullable": true, "format": "yyyy-MM-dd HH:mm:ss" }, "metadata": { "hint": "Activated", "observedCharacters": "", "maxValue": "", "minValue": "" } }, { "name": "date_deactivated", "type": { "hint": "Deactivated", "maxLength": "", "nullable": true, "format": "yyyy-MM-dd HH:mm:ss" }, "metadata": { "datatype": "int", "observedCharacters": "", "maxValue": "", "minValue": "" } } ], "primaryKey": [{"column": "id"}], "foreignKeys": [ { "column": "card_type_id", "name": "card_type", "foreignColumn": "id" }, { "column": "customer_account_id", "name": "customer_account", "foreignColumn":"id" } ] }]