Generated table for enumeration column type
- Dominant language
- Kotlin
- Stars
- 9.3k
- Forks
- 798
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 26
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
```kotlin
enum class AccountType { DEBIT, CREDIT }
object Accounts : Table() {
val type = enumeration("type", AccountType::class)
}
```
We get in the database:
```sql
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
Contributor guide
Research direction
Start by locating the implementation of Kotlin enum columns and the schema-generation entry points for tables, constraints, and inserts. Use the AccountType example to determine how an optional dictionary table should be generated and populated, and verify that the resulting SQL includes the table and foreign-key relationship shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100