我试图进行迁移,但仍然有同样的错误:
public function up()
{
Schema::create('user_class', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->length(10)->unsigned();
$table->foreign('user_id')->references('id')->on('users');
$table->integer('class_id')->length(10)->unsigned();
$table->foreign('class_id')->references('id')->on('classes');
});
}
public function down()
{
DB::statement('SET FOREIGN_KEY_CHECKS = 0');
Schema::drop('user_class');
DB::statement('SET FOREIGN_KEY_CHECKS = 1');
}
我的数据库迁移是:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>
<!-- other controls in grid -->
<DockPanel Grid.Row="1" Grid.Column="1">
<Grid>
<Rectangle Width="120" Height="80" Fill="LightYellow" Stroke="Orange" StrokeThickness="2" RadiusX="8" RadiusY="8"/>
<Rectangle Width="120" Height="80" Fill="Transparent" Stroke="Orange" StrokeThickness="2" RadiusX="8" RadiusY="8">
<Rectangle.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="15" Color="Orange"/>
</Rectangle.Effect>
<Rectangle.Clip>
<RectangleGeometry Rect="0,0,400,80" RadiusX="8" RadiusY="8"/>
</Rectangle.Clip>
</Rectangle>
<Grid>
<Label Content="Legend:"/>
<BulletDecorator Margin="5,20,0,0" VerticalAlignment="Top" >
<BulletDecorator.Bullet>
<Ellipse Height="8" Width="8" Fill="Blue"/>
</BulletDecorator.Bullet>
<TextBox TextWrapping="Wrap" Background="Transparent" Text="100 : Manager" BorderThickness="0" />
</BulletDecorator>
<BulletDecorator Margin="5,40,0,0" VerticalAlignment="Top" >
<BulletDecorator.Bullet>
<Ellipse Height="8" Width="8" Fill="Blue"/>
</BulletDecorator.Bullet>
<TextBox TextWrapping="Wrap" Background="Transparent" Text="200: Others" BorderThickness="0" />
</BulletDecorator>
</Grid>
</Grid>
</DockPanel>
</Grid>
我认为我有这个错误,因为user_classes先于我的数据库文件然后是类?这可能是我的问题吗?
当我制作:php artisan make:rollback - 这个表:user_class没有从我的phpAdmin中删除...只有这个
答案 0 :(得分:0)
我认为长度方法是问题,我检查了Laravel文档并且它不存在。