Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 带数据处理的拉威尔偏移_Php_Mysql_Laravel_Laravel 5_Migration - Fatal编程技术网

Php 带数据处理的拉威尔偏移

Php 带数据处理的拉威尔偏移,php,mysql,laravel,laravel-5,migration,Php,Mysql,Laravel,Laravel 5,Migration,我有一个数据库,其中有3个表需要迁移: 进程:包含有关进程的数据 process_id - Id of the process step_1_data - data about step 1 step_2_data - data about step 2 step_3_data - data about step 3 process_id - Id of the process 文件\u流程:与该流程的文件存在多对多关系 process_id - required foreign key t

我有一个数据库,其中有3个表需要迁移:

进程
:包含有关进程的数据

process_id - Id of the process
step_1_data - data about step 1
step_2_data - data about step 2
step_3_data - data about step 3
process_id - Id of the process
文件\u流程
:与该流程的文件存在多对多关系

process_id - required foreign key to process
file_id - required foreign key to file
file_label - label of the file step
step_id - Id of the step
process_id - required foreign key to process
name - the name of the step (from column of step 1, 2, 3, and file_label)
data - data about step 1, 2, 3 (in different records)
file_id - nullable foreign key to file
文件
:是一个通用文件表

file_id - Id of the file
name - name of the file
... lots of other file data
这就是我想要的:

进程
:包含有关进程的数据

process_id - Id of the process
step_1_data - data about step 1
step_2_data - data about step 2
step_3_data - data about step 3
process_id - Id of the process
步骤
:与该流程的文件存在多对多关系

process_id - required foreign key to process
file_id - required foreign key to file
file_label - label of the file step
step_id - Id of the step
process_id - required foreign key to process
name - the name of the step (from column of step 1, 2, 3, and file_label)
data - data about step 1, 2, 3 (in different records)
file_id - nullable foreign key to file
文件
:是通用文件表(保持不变)

我可以进行迁移,将步骤表更改为包含步骤信息的通用步骤表。但是,我需要对当前流程记录进行一次性迁移,以便根据流程在中的位置生成步骤记录。。。过程:P

原始数据库查询似乎不是一个好的选择,因为我需要根据它们所处的阶段做不同的事情


在Laravel中进行同时包含数据操作和模式操作的迁移的最佳方法是什么?

如果您可以发布您的:(a)表模式;(b) 原始数据的示例;(c) 迁移后的预期结构。虽然我相信,没有任何api来做数据操作。mm似乎不明白。。
文件\u步骤
表是
过程
文件
的中间表(用于
多对多
关系)?此外,请按照@BagusTesa.this help?@HCK的建议进行操作,这是正确的。但是,我想将其重命名为步骤,标签将成为步骤名称。进程表中的步骤数据将被移动到步骤表中。嗯,我认为您至少需要两个表,一个临时保存数据,另一个填充,将所有内容复制到临时表中,然后使用seeder将所有内容放回一起。。我不认为有一个简单的方法..如果你能发布你的:(a)表模式;(b) 原始数据的示例;(c) 迁移后的预期结构。虽然我相信,没有任何api来做数据操作。mm似乎不明白。。
文件\u步骤
表是
过程
文件
的中间表(用于
多对多
关系)?此外,请按照@BagusTesa.this help?@HCK的建议进行操作,这是正确的。但是,我想将其重命名为步骤,标签将成为步骤名称。进程表中的步骤数据将被移动到步骤表中。嗯,我认为您至少需要两个表,一个临时保存数据,另一个填充,将所有内容复制到临时表中,然后使用seeder将所有内容放回一起。。我认为没有简单的办法。。