This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 149696 - MySQL travel sample database has no foreign keys
Summary: MySQL travel sample database has no foreign keys
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: MySQL (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-10 01:31 UTC by David Vancouvering
Modified: 2008-10-21 08:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of created keys. (123.87 KB, image/jpeg)
2008-10-16 16:40 UTC, Roman Mostyka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Vancouvering 2008-10-10 01:31:54 UTC
If you create the travel sample using the MySQL support, the resulting database has no foreign keys.  This is because we
don't specify the table type as InnoDB, and the default storage engine for MySQL, MyISAM does not support foreign keys.

This is probably an issue for 'vir' and 'sample' as well.
Comment 1 John Baker 2008-10-15 07:35:44 UTC
Can this be fixed by posting the sample databases on the update center, like Sakila ?

That way the tutorials can work.  I think there's a Hibernate tutorial that isn't working
Comment 2 David Vancouvering 2008-10-15 07:52:06 UTC
If this is breaking tutorials then perhaps this is a P1.  I don't think the right solution is to post the samples to the
UC.  It's an easy fix - just need to use the InnoDB engine.

Roman, what do you think?
Comment 3 John Baker 2008-10-15 07:52:37 UTC
I think what the issue is ... if the storage engine specified in the user's MySQL installation is ISAM then the trip
table has foreign keys for personid and triptypeid

However, if the storage engine is MyISAM then there won't be any foreign keys in the sample databases.
Comment 4 John Baker 2008-10-15 07:55:32 UTC
shucks

I meant to say...

"if the storage engine specified in the user's MySQL installation is InnoDB then the trip
table has foreign keys for personid and triptypeid"

Comment 5 Roman Mostyka 2008-10-15 12:22:59 UTC
I agree that if this breaks tutorial, then it should be P1. Or tutorial shouldn't be available for the customers.
I also agree that it is bad idea to post samples to UC since it looks like step back. And it doesn't help customers to
follow tutorial since after they get plugin from UC they will have the same problem, so anyway this problem should be fixed.
There 2 questions:
1) How difficult to fix this issue and why posting the sample databases on the update center, like Sakila, will help?
2) Does it really break anything?
Comment 6 David Vancouvering 2008-10-15 16:35:22 UTC
Yes, it breaks things, and pushing to the update center wouldn't help without other changes to the db.mysql code base.

It's easy to fix, I'll take care of it today.

Roman, I'll let you make the final call if this is a P1 (I'll make it at P2) and I'll go ahead and push it to main and
you can tell me the process to get it to the RC branch.

Thanks for catching this, John, I didn't know there were issues with tutorials, but it makes sense.  No foreign keys
breaks the codegen code.
Comment 7 Roman Mostyka 2008-10-15 17:09:05 UTC
David, here are the rules for pushing changes into RC branch:
http://wiki.netbeans.org/NB65Rules
But it is a real showstopper if it breaks things, so if we can push only P1, we should make it P1.
By the way, I think this is P1, if it can prevent customers to follow tutorial, since it will look like we supply
product and tutorial which are incompatible.
Comment 8 David Vancouvering 2008-10-15 17:46:00 UTC
Marking as showstopper
Comment 9 David Vancouvering 2008-10-15 17:47:28 UTC
267b66533a99
Comment 10 Quality Engineering 2008-10-16 04:13:34 UTC
Integrated into 'main-golden', will be available in build *200810160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/267b66533a99
User: David Van Couvering <davidvc@netbeans.org>
Log: #149696: MySQL travel sample database has no foreign keys
Comment 11 Roman Mostyka 2008-10-16 16:36:09 UTC
I can't verify this issue because of issue #150416.
But I tried with previous build (200810140201) and tables had foreign keys (see attachment).
Comment 12 Roman Mostyka 2008-10-16 16:40:55 UTC
Created attachment 72011 [details]
Screenshot of created keys.
Comment 13 Roman Mostyka 2008-10-16 16:49:59 UTC
By the way, sakila DB was created with this build without foreign keys.
Comment 14 Roman Mostyka 2008-10-17 12:22:01 UTC
Can somebody look at this issue?
As you can see in my comments I was able to create "sample" DB with foreign keys with build 200810140201 and "sakila"
DB, but without foreign keys.
As you also can see in my comments in the issue #150422, I also was able to create "sakila" DB with MyISAM engine and
again without foreign keys on the build with the fix for this issue.
So can anybody verify this issue or tell me where I'm wrong? As I understand build 200810140201 doesn't contain fix for
this issue, so I shouldn't be able to create DB with foreign keys, but I was successful in this. So probably this issue
isn't valid for me, so anybody else verify this issue if it is valid for him/her?
Comment 15 Roman Mostyka 2008-10-17 13:02:41 UTC
OK, I eventually was able to reproduce this issue with RC1, but everything works fine with IDE built from fresh sources.
Can we add this fix to the RC build?
Comment 16 Roman Mostyka 2008-10-17 13:09:24 UTC
Or add "65fixes1-candidate" status whiteboard if it's too late to have it in RC1. But I think that it will be better to
have the fix in release.
Comment 17 Roman Mostyka 2008-10-17 14:04:42 UTC
Or set target to RC2.
Comment 18 David Vancouvering 2008-10-17 16:57:12 UTC
Hi, Roman, I'm very confused.  I fixed this in the trunk and did all the necessary steps to get this into the RC build,
but I thought it was QEs job to actually integrate into the RC branch.  Are you going to do that?

Also, just to clarify: you can create Sakila with MyISAM because it turns off foreign key checks.  I didn't add that to
the other samples because I was unaware of the issue.

I have in my sandbox a fix that turns off foreign key checks for the other samples, and I am in the process of testing
it, and will check into trunk.  It's a low-risk fix, so if you want you can integrate that into RC branch too.

So to summarize:
- Foreign keys now work with sample databases if you have InnoDB available
- If you don't have InnoDB available, Sakila will work (without foreign keys) but the other samples will fail because
they have foreign key checks turned on
- I am seeing if I can fix the other samples by disabling foreign key checks, and if this works I will check into the trunk
- I believe it is safe to put the disabling foreign key checks fix into the RC build, but I leave it to QE to make the
final call
- Please clarify who is supposed to integrate fixes into the RC branch - I thought it was QE that did this.
Comment 19 David Vancouvering 2008-10-21 06:38:35 UTC
Transplanted to release65 clone as changeset ba17b00c4ec9.  I am running a clean build and test and then will push
tomorrow morning.
Comment 20 David Vancouvering 2008-10-21 06:52:49 UTC
Pushed to release65 branch
Comment 21 Roman Mostyka 2008-10-21 08:17:07 UTC
David, thanks for the transplantation.
We definitely need this fix for the release.
And for the future, QE isn't responsible for any integration, developed by somebody else.
But anyway, now we have this fix for next milestone and this is definitely very good, thanks for the hard work.