Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foreign key doesnt create in mysql #347

Closed
frontend-3 opened this issue Dec 5, 2013 · 4 comments
Closed

foreign key doesnt create in mysql #347

frontend-3 opened this issue Dec 5, 2013 · 4 comments

Comments

@frontend-3
Copy link

Foreign key doesnt create in mysql

@frontend-3
Copy link
Author

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

@dgsan
Copy link
Contributor

dgsan commented Dec 5, 2013

jugglingdb/mysql-adapter#14

So far as I know relations test does pass currently, though: https://github.com/1602/jugglingdb/blob/master/test/relations.test.js.

@1602
Copy link
Owner

1602 commented Dec 13, 2013

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
)

@1602 1602 closed this as completed Dec 13, 2013
@frontend-3
Copy link
Author

Not created foreign key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants