gpt4 book ai didi

mysql - DBIx 迁移无法识别 MySQL

转载 作者:行者123 更新时间:2023-11-30 22:47:28 24 4
gpt4 key购买 nike

我正在尝试使用 MySQL 跟随本教程: https://metacpan.org/pod/DBIx::Class::Migration::Tutorial::FirstMigration

我正在运行它使用附加选项 --database MySQL 声明的命令。

例子:

dbic-migration -I lib/-I local/lib/perl5/--S Database::Main --target_dir share/--database MySQL 准备

dbic-migration -I lib/-I local/lib/perl5/--S Database::Main --target_dir share/--database MySQL 安装

但是在执行安装命令时,它会给我以下输出:

$ dbic-migration -I lib/ -I local/lib/perl5/ --S Database::Main --target_dir share/ --database MySQL install

Since this database is not versioned, we will assume version 1
Reading configurations from share/fixtures/1/conf
Can't opendir($fh, 'share/migrations/SQLite/deploy/1'): No such file or directory at local/lib/perl5/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 109
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at local/lib/perl5/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 116

我的 share 目录如下所示:

└── share
├── database-main.db
├── fixtures
│   └── 1
│   └── conf
│   └── all_tables.json
└── migrations
├── MySQL
│   └── deploy
│   └── 1
│   ├── 001-auto-__VERSION.sql
│   └── 001-auto.sql
├── _common
│   └── deploy
│   └── 1
│   └── 002-demo.pl
└── _source
└── deploy
└── 1
├── 001-auto-__VERSION.yml
└── 001-auto.yml

有人知道为什么当我指定了 MySQL 时它继续寻找 SQLite 目录吗?

最佳答案

Reading the docs ,我怀疑 dbic-migration 正在使用这种模式...

dbic-migration <generic options> <command> <options for that command>

The docs back this up ...

dbic-migration is your main gateway to managing your migrations. When using the tool you will give it one command (such as version above) and any number of option flags (starting with -- or -).

如果你说...

dbic-migration --database MySQL prepare

--database MySQL 将被忽略,因为它不是 dbic-migration 的已知通用选项。

你必须说...

dbic-migration prepare --database MySQL

其中--database MySQL理解为prepare命令的一个选项。

不幸的是,它不会警告您它不理解的选项。

关于mysql - DBIx 迁移无法识别 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29197968/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com