草庐IT

foreign_gem

全部标签

mysql - 需要 Ruby Gem LoadError mysql2/mysql2

我正在尝试在OSX10.8上设置我的Rails服务器,但我无法让我的Rails服务器运行。-目前我正在使用带有mysql5.1的ZendServer。-我还安装了brew和brewmysql。-我使用了:geminstallmysql2----srcdir=/usr/local/mysql/include--with-opt-include=/usr/local/mysql/include服务器已经工作了,但现在,我总是在下面得到这个loadError。我的Gemfile是这样写的:ralphs-macbook-pro:admin-mockupzero$bundleinstallUsi

php - Laravel 5.2 迁移 : Cannot add foreign key of char data type

我正在尝试创建一个char数据类型的可空外键。当我运行迁移命令时。我收到以下错误。我不确定我哪里做错了。[Illuminate\Database\QueryException]SQLSTATE[HY000]:Generalerror:1215Cannotaddforeignkeyconstraint(SQL:altertablelevelsaddconstraintlevels_sample_type_id_foreignforeignkey(sample_type_id)referencessample_types(id))[PDOException]SQLSTATE[HY000]:

mysql - 错误代码 1215 : cannot add foreign key constraint MySQL

我在MySQL中创建数据库时遇到问题。错误代码:“错误代码1215:无法添加外键约束”在我尝试实现更改时弹出。我已经注意了所有必要的事情,但我找不到解决方案。这个错误只发生在我创建初始数据库(确实有效)后添加了一些表之后,所以希望我不会在整个项目中处理这个问题。这是发生错误的代码片段,无法正常工作的外键是引用锦标赛中“id”的“tournament_id”:CREATEDATABASEallin;USEallin;CREATETABLEemployee(phone_numberchar(12)NOTNULL,birth_datedateNOTNULL,tournament_idintN

升级到 Snow Leopard 后的 MySQL gem 问题

刚刚升级到SnowLeopard。经过一番折腾后,我设法启动并运行了MySQL。现在我正在尝试让我的Rails环境正常工作。对于我使用Rails3.0.3和Ruby1.8.7的项目我已经使用以下命令安装了MySQL2gem:sudogeminstallmysql2----with-mysql-config=/usr/local/mysql/bin/mysql_config当我启动railsserver时,出现以下错误:/Users/lee/.rvm/gems/ruby-1.8.7-head/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle:dlope

mysql2 gem、Rails 3.0.3 和 "incompatible character encodings"错误

我正在使用Rails3.0.3,我已经将mysql适配器从ruby​​-mysql更改为mysql2,但现在出现以下错误:incompatiblecharacterencodings:ASCII-8BITandUTF-8我到处都读到过这方面的内容,但我无法设法修复它。application.rb:config.encoding="utf-8"数据库.yml:development:adapter:mysql2encoding:utf8database:rails3_developmentusername:rootpassword:host:localhostgem:specs:abst

mysql - rails mysql 服务器错误 "could not find gem"

当我尝试在新项目上运行“railsserver”时,它返回Couldnotfindgem'mysql2(>=0)X86-mingw32'inanyofthegemsourceslistedinyourGemfile.Run'bundleinstall'toinstallmissinggems.我运行了“bundleinstall”,但我遇到了同样的错误。我已经从xampp包中安装了mysql,但我的friend帮我安装了rails,所以我不确定他是如何配置的。我使用WindowsVista。 最佳答案 尝试geminstallmys

mysql - 捆绑安装 : Failed to build gem native extension

我有gitclonegit://github.com/jalagrange/excel_test_app.git安装bundle时出现以下错误,我的其他应用程序不会发生这种情况。跟随误差Installingmysql2(0.3.6)withnativeextensionsGem::Installer::ExtensionBuildError:ERROR:Failedtobuildgemnativeextension.C:/RailsInstaller/Ruby1.9.3/bin/ruby.exeextconf.rbcheckingforrb_thread_blocking_region

mysql - Django: 1215, 'Cannot add foreign key constraint' on model with only one field

我有一个沙拉模型:classSalad(models.Model):some_field=models.ForeignKey(Profile,on_delete=models.CASCADE,null=True)无论我如何调用类、单个字段、我用什么模型代替Profile,或者我选择的任何on_delete选项。我系统地得到错误:django.db.utils.IntegrityError:(1215,'无法添加外键约束')错误日志:Traceback(mostrecentcalllast):File"C:\Users\Div-o\AppData\Local\Programs\Pytho

MySQL 错误 1452 - 无法添加或更新子行 : a foreign key constraint fails

我查看了其他人关于此主题的问题,但似乎无法找到我的错误来源。任何帮助将不胜感激。我尽可能多地包括可能有助于找到问题的内容:CREATETABLEstocks(idINTAUTO_INCREMENTNOTNULL,user_idINT(11)UNSIGNEDNOTNULL,tickerVARCHAR(20)NOTNULL,nameVARCHAR(20),ratingINT(11),positionENUM("strongbuy","buy","sell","strongsell","neutral"),next_lookDATE,privacyENUM("public","private

MySQL CREATE TABLE & FOREIGN KEY 错误

我不是数据库专家,但我一直在研究这个问题,但似乎无法解决这个问题。我已经阅读了相关的文档页面(http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html),但我看不出我的语法哪里有问题.ERROR1064(42000)atline84:YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear'FOREIGNKEY(user_id)REFE