Edwin wants to create a new in-memory SQLite database that contains the instructors and courses tables and set up a one-to-many relationship between them.
The instructors table should have the following columns:
| instructors | |
|---|---|
id |
INTEGER, PK |
created_at |
DATETIME |
updated_at |
DATETIME |
deleted_at |
DATETIME |
first_name |
TEXT |
last_name |
TEXT |
email |
TEXT |
And the courses table should have the following columns:
| courses | |
|---|---|
id |
INTEGER, PK |
created_at |
DATETIME |
updated_at |
DATETIME |
deleted_at |
DATETIME |
code |
INTEGER |
title |
TEXT |
instructor_id |
INTEGER FK(instructors) |
Your task is to help Edwin write the required code to declare the Instructor and Course models, using the gorm.Model struct, and setting up a one-to-many relationship between them.
This problem uses the reflect package and the hidden function
checkModels() to check if you correctly declared the Instructor and Course models and set up a one-to-many relationship between them.