小编hjc*_*r18的帖子

如何使用Phinx更改列的排序规则

我刚刚开始学习Phinx,我需要将列的排序规则更改为latin1_swedish_ci.我没有找到有关如何执行此操作的文档.我假设它类似于:

->addColumn('text_two', 'string', ['collation' => 'latin1_swedish_ci'])
Run Code Online (Sandbox Code Playgroud)

但是,我已经看到一些关于此功能尚未实现的说法.https://github.com/robmorgan/phinx/issues/661

如果有人有办法解决这个问题,那就太好了!

collation phinx

7
推荐指数
1
解决办法
1685
查看次数

使用 Phinx 添加外键

我知道有几篇与此类似的帖子,但他们没有给我我需要的答案。因此,我正在使用 Phinx 并尝试添加外键,但出现以下错误:

General error: 1215 Cannot add foreign key constraint
Run Code Online (Sandbox Code Playgroud)

这是带有外键的 php 文件:

<?php

use Phinx\Migration\AbstractMigration;

class CustomQuotes extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     * …
Run Code Online (Sandbox Code Playgroud)

php mysql phinx

5
推荐指数
1
解决办法
6917
查看次数

标签 统计

phinx ×2

collation ×1

mysql ×1

php ×1