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

vendor/bin/phinx migrate 数据库迁移报错 #1512

Closed
bingotl opened this issue Jul 26, 2022 · 2 comments
Closed

vendor/bin/phinx migrate 数据库迁移报错 #1512

bingotl opened this issue Jul 26, 2022 · 2 comments

Comments

@bingotl
Copy link

bingotl commented Jul 26, 2022

Environment 环境
Centos7
MySQL 10.1.44-MariaDB
PHP-7.4
Nginx 1.18.0

Commit
new-feat分支

Bug
vendor/bin/phinx migrate执行后报错

== 20220419163350 NodeRemark: migrating
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column 'remark' can't have a default value in /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:193
Stack trace:
#0 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(193): PDO->exec()
#1 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Util/AlterInstructions.php(108): Phinx\Db\Adapter\PdoAdapter->execute()
#2 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(611): Phinx\Db\Util\AlterInstructions->execute()
#3 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(972): Phinx\Db\Adapter\PdoAdapter->executeAlterSteps()
#4 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/AdapterWrapper.php(484): Phinx\Db\Adapter\PdoAdapter->executeActions()
#5 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/TimedOutputAdapter.php(420): Phinx\Db\Adapter\AdapterWrapper->executeActions()
#6 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Plan/Plan.php(151): Phinx\Db\Adapter\TimedOutputAdapter->executeActions()
#7 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(715): Phinx\Db\Plan\Plan->execute()
#8 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(623): Phinx\Db\Table->executeActions()
#9 /www/wwwroot/ssp/databases/migrations/20220419163350_node_remark.php(23): Phinx\Db\Table->update()
#10 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Migration/Manager/Environment.php(108): NodeRemark->change()
#11 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php(385): Phinx\Migration\Manager\Environment->executeMigration()
#12 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php(359): Phinx\Migration\Manager->executeMigration()
#13 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Console/Command/Migrate.php(122): Phinx\Migration\Manager->migrate()
#14 /www/wwwroot/ssp/vendor/symfony/console/Command/Command.php(298): Phinx\Console\Command\Migrate->execute()
#15 /www/wwwroot/ssp/vendor/symfony/console/Application.php(1024): Symfony\Component\Console\Command\Command->run()
#16 /www/wwwroot/ssp/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#17 /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Console/PhinxApplication.php(70): Symfony\Component\Console\Application->doRun()
#18 /www/wwwroot/ssp/vendor/symfony/console/Application.php(171): Phinx\Console\PhinxApplication->doRun()
#19 /www/wwwroot/ssp/vendor/robmorgan/phinx/bin/phinx(27): Symfony\Component\Console\Application->run()
#20 /www/wwwroot/ssp/vendor/bin/phinx(115): include('/www/wwwroot/ss...')
#21 {main}

和issues 1463的错误一样,#1463
已经重装系统重新部署环境,出现一样的问题。

SSPanel-Uim/databases/migrations/20220419163350_node_remark.php
$table->addColumn('remark', 'text', array('comment' => '管理员备注', 'after' => 'status', 'default' => '无'))

删掉以下内容再试试
, 'default' => '无'

text改string再执行试试

上述2个方法都试过,报错如下
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column 'type' can't have a default value in /www/wwwroot/ssp/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:193

@bingotl bingotl changed the title php xcat User createAdmin 数据库迁移报错 vendor/bin/phinx migrate 数据库迁移报错 Jul 26, 2022
@iamsaltedfish
Copy link
Collaborator

谷歌和原issue都能找到解决方法

@bingotl
Copy link
Author

bingotl commented Jul 27, 2022

根据原isuse #1463
删掉以下内容再试试
, 'default' => '无'
text改string再执行试试

上述2个方法都试过了,还是报错。数据库本身MariaDB。我在tg群里搜索这个关键字,sspanel群里都有好几个人提问过这个问题都没有答案。

我也不是小白,dev和metron5分钟就搭建好无任何问题,就是feat这个坑浪费我一下午时间

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

2 participants