Closed frontend-3 closed 10 years ago
var Movie = schema.define('Movie', { title: { type: String, length: 150 }, sinopsis: { type: String, length: 255 }, url_trailer: { type: String, length: 150 }, type: { type: String, length: 30 }, casting: { type: String, length: 255 }, duration: { type: String, length: 10 }, date: { type: Date}, country: { type: String, length: 100 }, director: { type: String, length: 100 }
});
var Movie_detail = schema.define('Movie_detail', { movie_id: { type: Number, dataType: 'int'}, showtime: { type: String, length: 10 }, point_id: { type: Number, dataType: 'int'} });
Movie_detail.belongsTo(Movie, {as: 'movie', foreignKey: 'movie_id'});
schema.automigrate();
Doesnt work
https://github.com/jugglingdb/mysql-adapter/issues/14
So far as I know relations test does pass currently, though: https://github.com/1602/jugglingdb/blob/master/test/relations.test.js.
Not confirmed:
$ node test.js
CREATE TABLE `Movie` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`title` VARCHAR(150) NULL,
`sinopsis` VARCHAR(255) NULL,
`url_trailer` VARCHAR(150) NULL,
`type` VARCHAR(30) NULL,
`casting` VARCHAR(255) NULL,
`duration` VARCHAR(10) NULL,
`date` DATETIME NULL,
`country` VARCHAR(100) NULL,
`director` VARCHAR(100) NULL
)
CREATE TABLE `Movie_detail` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`movie_id` int(11) NULL,
`showtime` VARCHAR(10) NULL,
`point_id` int(11) NULL
)
Not created foreign key
Foreign key doesnt create in mysql