Neo4j.rb WARNING: The constraint option is no longer supported? - neo4j.rb

How to fix this warning (WARNING: The constraint option is no longer supported (Defined on StayPal for user_id)
I am using
Neo4j.rb > 8
neo4j > 3
Following
http://neo4jrb.readthedocs.io/en/8.0.x/ActiveNode.html
using property :user_id, constraint: :unique
How to add uniqness?

Defining constraints on models for auto-creation isn’t supported as of 8.0 of the neo4j gem. See this section of the upgrade guide: http://neo4jrb.readthedocs.io/en/8.0.x/UpgradeGuide.html#indexes-and-constraints

Related

CakePHP 3 new ORM MySQL keyword errors [duplicate]

I'm using Cakephp 3 using sqlserver as datasource server. I am sure there's no problem with my database connection.. as home.ctp prompts that I am connected to my database.. and I'm as well using migrations plugin to create my tables.. it seems like there is no problem working with these tools. but after I bake my MVC, I only got page full of errors..
for example
$bin\cake bake all tests
there are no errors I found and MVC are in its specific folder, testController.php, testTable, etc.
and in browsers
localhost:8765\tests
but all I got is page of different errors.. Im seeing
Error: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'desc'.
SELECT * FROM (SELECT Tests.id AS [Tests__id], Tests.desc AS [Tests__desc], (ROW_NUMBER() OVER (ORDER BY (SELECT NULL))) AS [_cake_page_rownum_] FROM tests Tests) _cake_paging_ WHERE _cake_paging_._cake_page_rownum_ <= :c0
and more errors on the left side.
I assume this is because of controllers with wrong queries or queries generated by bake is for mysql only. I just wanna know how to deal with this. is there a setting I forgot to do? please advice. I am new to Cakephp, and English is not my native language, sorry if I can't explain my question properly. thanks in advance.
As already mentioned by Vishal Gajjar in the comments, you are using the reserved keyword desc for your column name, hence the error, it's not bakes fault, it's yours.
In order to be able to use such reserved words, the column name needs to be quoted properly, however CakePHP 3 doesn't auto-quote by default anymore, as it's an expensive operation.
If you insist on using reserved words, enable identifier quoting via the quoteIdentifiers option in your app.php config, or enable it manually using the autoQuoting() (enableAutoQuoting() as of CakePHP 3.4) method of the DB driver.
See also
Cookbook > Database Access & ORM > Database Basics > Identifier Quoting
Cookbook > 3.x Migration Guide > New ORM Upgrade Guide > Identifier Quoting Disabled by Default
API > \Cake\Database\Driver::autoQuoting()
API > \Cake\Database\Driver::enableAutoQuoting()
You can use this code before problematic query:
$this->Tests->connection()->driver()->autoQuoting(true);
and when you are finished you can turn auto quoting off:
$this->Tests->connection()->driver()->autoQuoting(false);
So bad performance would be only on problematic query.
Use this :
SELECT * FROM (SELECT Tests.id AS [Tests__id], Tests.[desc] AS [Tests__desc],
(ROW_NUMBER() OVER (ORDER BY (SELECT NULL))) AS [_cake_page_rownum_] FROM tests Tests) _cake_paging_
WHERE _cake_paging_._cake_page_rownum_ <= :c0
If you do use a keyword, use it in square braces [ ]

“unknown table status: TABLE_TYPE” and related messy stuff over mysql phpmyadmin 4.4.14 (X.A.M.P.P. 5.6.14-0-VC11, Windows 7 x64)

Already existent related question topics are useless, since it's a different (or even older -3.40-) version. So .patches don't even fit in files described in other posts around the web.
In addition to unknown table status these notices also appear every time I click over a non empty table:
Notice in .\libraries\tbl_info.inc.php#78
Undefined index: Rows
Backtrace
.\libraries\Menu.class.php#221: include(.\libraries\tbl_info.inc.php)
.\libraries\Menu.class.php#85: PMA_Menu->_getBreadcrumbs()
.\libraries\Response.class.php#308: PMA_Menu->getHash()
.\libraries\Response.class.php#388: PMA_Response->_ajaxResponse()
PMA_Response::response()
Notice in .\libraries\tbl_info.inc.php#80
Undefined index: Name
Backtrace
.\libraries\Menu.class.php#221: include(.\libraries\tbl_info.inc.php)
.\libraries\Menu.class.php#85: PMA_Menu->_getBreadcrumbs()
.\libraries\Response.class.php#308: PMA_Menu->getHash()
.\libraries\Response.class.php#388: PMA_Response->_ajaxResponse()
PMA_Response::response()
Notice in .\libraries\tbl_info.inc.php#78
Undefined index: Rows
Backtrace
.\libraries\Menu.class.php#221: include(.\libraries\tbl_info.inc.php)
.\libraries\Menu.class.php#72: PMA_Menu->_getBreadcrumbs()
.\libraries\Response.class.php#315: PMA_Menu->getDisplay()
.\libraries\Response.class.php#388: PMA_Response->_ajaxResponse()
PMA_Response::response()
Notice in .\libraries\tbl_info.inc.php#80
Undefined index: Name
Backtrace
.\libraries\Menu.class.php#221: include(.\libraries\tbl_info.inc.php)
.\libraries\Menu.class.php#72: PMA_Menu->_getBreadcrumbs()
.\libraries\Response.class.php#315: PMA_Menu->getDisplay()
.\libraries\Response.class.php#388: PMA_Response->_ajaxResponse()
PMA_Response::response()
Any suggestion to avoid this annoying behaviour would be appreciated.
Thanks in advance.
This is an outdated phpMyAdmin version. The latest stable version is 4.5.1. In the latest XAMPP (https://www.apachefriends.org/blog/new_xampp_20151019.html) they mention updating phpMyAdmin to 4.5.0.2.

Entity Framework converts StartsWith to MySQL's Locate, MySQL's Locate doesn't use index

I'm using Entity Framework with MySQL, and my Linq Query:
db.Persons.Where(x => x.Surname.StartsWith("Zyw")).ToList();
..is producing the SQL:
SELECT PersonId, Forename, Surname
FROM Person
WHERE (LOCATE('Zyw', Surname)) = 1
...and it would seem that this doesn't make use of the index on Surname.
If LOCATE is replaced with the equivalent LIKE, the query speedily returns the required results. As it is it takes all afternoon.
Why is Entity Framework and its connecting drivers opting for this wierd LOCATE function / how can I make it use LIKE instead / why is MySQL making a poor index decision for the LOCATE function / how can I make it better?
Update:
I'm afraid I was guilty of over simplifying my code for this post, the Linq producing the error is in fact:
var target = "Zyw";
db.Persons.Where(x => x.Surname.StartsWith(target)).ToList();
If target term is hard coded, the SQL generated does indeed use LIKE, but with a variable term the SQL changes to use LOCATE.
This is all using the latest generally available MySQL for Windows as delivered by MySQL Installer 5.6.15.
Update:
A couple more notes to go with the bounty; am using:
Visual Studio 2010
EntityFramework 6.0.2
MySQL Installer 5.6.15,
which in turn gives:
MySql.Data 6.7.4
MySql.Data.Entities 6.7.4
The Entity Framework code is generated database first style.
I've also tried it with the latest connector from Nuget (MySql.Data 6.8.3) and the problem is still there.
It's likely your problem is caused by:
You are using an older connector with the bug.
You have a special case (using a variable to hold the .Contains search) described as a bug here
Does your case fall into any of those?
This looks like a regression of MySQL bug #64935 to me.
I can confirm that, using the same builds of EF6 and MySQL Connector, I'm getting the same SQL generated too:
context.stoppoints.Where(sp => sp.derivedName.StartsWith(stopName));
...logs as:
SELECT
`Extent1`.`primaryCode`,
...
`Extent1`.`stop_timezone`
FROM `stoppoints` AS `Extent1`
WHERE (LOCATE(#p__linq__0, `Extent1`.`derivedName`)) = 1
Entity Framework: 6.0.2
MySQL Connector.Net: 6.8.3
I have reported this as a MySQL bug regression.

ActiveRecord::StatementInvalid: Mysql2::Error when using association name in .where method instead of foreign key

We just updated our Rails App from 3.0.13 to 3.2.6 and have encountered a minor problem when using the .where method of the Active Record Query Interface with mysql2.
What used to work before:
client = Client.first
User.where(:client => client)
now leads to:
ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column
'users.client' in 'where clause': SELECT users.* FROM users WHERE
users.client = 1
But when explicitly using the column name of the foreign key, it seems to work just fine:
client = Client.first
User.where(:client_id => client.id)
#=> Relation of users with the given client_id
The associations have not changed (users belong to client, client has many users). This now seems to be the problem with every association of this kind.
Do we now really have to change all these where queries so that they use the foreign_key or is there any other way?
rails version:
gem "rails", "~> 3.2.6"
mysql2 version:
gem "mysql2", "~> 0.3.11"
We just found out that this functionality was provided by a gem called meta_where, which is deprecated in Rails 3.1+.
There is an alternative, squeel, which unfortunately doesn't provide the exact same syntax. (Or we just haven't found out yet...)
Investigating now...
Thanks #zsquare for pointing out.

Upgraded to the latest EF (4.1) from CTP - how do we override underscores generated in foreign keys

We recently upgraded our EF implementation from the CTP to the latest release of EF (4.1). We are now seeing an issue in that the foreign keys that are generated are now generated with an _ where previously there was none. As we have a couple of references to the previously generated names we find that our code is choking on the new format. Is there a way to override this behavior and generate foreign keys without the _?
You cannot override the behavior globally but you can override it for each generated foreign key.
Suppose that you have entity A with FK to B. You can use this fluent mapping to control naming of FK in the database:
modelBuilder.Entity<A>()
.HasRequired(a => a.B)
.WithMany(b => b.As)
.Map(m => m.MapKey("YourKeyName"));
This example expects A with required navigation property to B (FK is not nullable) and B with collection navigation property As containing all related A instances.