-
-
Notifications
You must be signed in to change notification settings - Fork 70
Description
Hi,
I have a following sql and I want to write a .yml schema file.
CREATE TABLE Programs
(
program_id
int(11) NOT NULL AUTO_INCREMENT,
program_name
varchar(255) DEFAULT NULL,
program_code
varchar(50) DEFAULT NULL,
duration
varchar(50) DEFAULT NULL,
department_id
int(11) DEFAULT NULL,
PRIMARY KEY (program_id
),
UNIQUE KEY program_name
(program_name
),
UNIQUE KEY program_code
(program_code
),
KEY department_id
(department_id
),
CONSTRAINT programs_ibfk_1
FOREIGN KEY (department_id
) REFERENCES departments
(department_id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
How could I do that?
The following creates a table without constraints:
increments: false
table: programs
columns:
program_id:
type: integer
primary: true
autoIncrement: true
program_name:
type: string
length: 255
unique: true
nullable: true
program_code:
type: string
length: 50
unique: true
nullable: true
duration:
type: string
length: 50
nullable: true
department_id:
type: integer
index: true
nullable: true