Open
Description
Generate dictionary table for Enum.
Motivation: for the correctness of the scheme, especially useful for other systems that will also work with the database
enum class AccountType { DEBIT, CREDIT }
object Accounts : Table() {
val type = enumeration("type", AccountType::class)
}
We get in the database:
CREATE TABLE ACCOUNT_TYPE(ID INT, NAME VARCHAR);
ALTER TABLE ACCOUNT ADD CONSTRAINT FX_ACCOUNT_ACCOUNT_TYPE_ID FOREIGN KEY (TYPE) REFERENCES ACCOUNT_TYPE(ID);
INSERT INTO ACCOUNT_TYPE(ID, NAME) VALUES (1, 'DEBIT');
INSERT INTO ACCOUNT_TYPE(ID, NAME) VALUES (2, 'CREDIT');
make optional
Metadata
Metadata
Assignees
Labels
No labels