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

SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT SVP0 does not exist #15

Open
anlamas opened this issue Feb 24, 2021 · 1 comment
Assignees
Labels
status:to be verified Needs to be reproduced and validated.

Comments

@anlamas
Copy link

anlamas commented Feb 24, 2021

I've switched from mysql 5.7 to 8 version and there is an error. While mysql 5.7 has no error.
I'm trying to migrate generated migration.

mysql Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

<?php

namespace Migration;

use Spiral\Migrations\Migration;

class OrmDefault3467f871b43924c6812739e5bf58a3d7 extends Migration
{
    protected const DATABASE = 'default';

    public function up(): void
    {
        $this->table('users')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('name', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('company_name', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('email', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('password', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('backend', 'boolean', [
                'nullable' => false,
                'default'  => false
            ])
            ->addColumn('super_user', 'boolean', [
                'nullable' => false,
                'default'  => false
            ])
            ->addColumn('remember_token', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('phone', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->setPrimaryKeys(["id"])
            ->create();

        $this->table('categories')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('parent_id', 'bigInteger', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('lft', 'integer', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('rgt', 'integer', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('depth', 'integer', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('image_id', 'bigInteger', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addIndex(["parent_id"], [
                'name'   => 'categories_index_parent_id_6035f3284ee0c',
                'unique' => false
            ])
            ->addForeignKey(["parent_id"], 'categories', ["id"], [
                'name'   => 'categories_foreign_parent_id_6035f3284ee12',
                'delete' => 'CASCADE',
                'update' => 'CASCADE'
            ])
            ->setPrimaryKeys(["id"])
            ->create();

        $this->table('roots')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('slug', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('title', 'text', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('config', 'text', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addIndex(["slug"], [
                'name'   => 'roots_index_slug_6035f3285030b',
                'unique' => true
            ])
            ->setPrimaryKeys(["id"])
            ->create();

        $this->table('posts')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('user_id', 'bigInteger', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('category_id', 'bigInteger', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('root_id', 'bigInteger', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('meta', 'text', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('newsletter_enabled', 'boolean', [
                'nullable' => false,
                'default'  => false
            ])
            ->addColumn('publish_from', 'datetime', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('publish_till', 'datetime', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('deleted_at', 'datetime', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('display_date', 'datetime', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addIndex(["user_id"], [
                'name'   => 'posts_index_user_id_6035f3284e0e5',
                'unique' => false
            ])
            ->addIndex(["category_id"], [
                'name'   => 'posts_index_category_id_6035f3284e24d',
                'unique' => false
            ])
            ->addIndex(["root_id"], [
                'name'   => 'posts_index_root_id_6035f3284e276',
                'unique' => false
            ])
            ->addForeignKey(["user_id"], 'users', ["id"], [
                'name'   => 'posts_foreign_user_id_6035f3284e0f6',
                'delete' => 'CASCADE',
                'update' => 'CASCADE'
            ])
            ->addForeignKey(["category_id"], 'categories', ["id"], [
                'name'   => 'posts_foreign_category_id_6035f3284e254',
                'delete' => 'CASCADE',
                'update' => 'CASCADE'
            ])
            ->addForeignKey(["root_id"], 'roots', ["id"], [
                'name'   => 'posts_foreign_root_id_6035f3284e27c',
                'delete' => 'CASCADE',
                'update' => 'CASCADE'
            ])
            ->setPrimaryKeys(["id"])
            ->create();

        $this->table('product_categories')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('parent_id', 'bigInteger', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('lft', 'integer', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('rgt', 'integer', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('depth', 'integer', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('slug', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('typeshow', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('yaml', 'boolean', [
                'nullable' => false,
                'default'  => true
            ])
            ->addColumn('yml_pulscen', 'boolean', [
                'nullable' => false,
                'default'  => false
            ])
            ->addColumn('feed', 'boolean', [
                'nullable' => false,
                'default'  => false
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('status', 'boolean', [
                'nullable' => false,
                'default'  => true
            ])
            ->addColumn('yml_pulscen_sh', 'boolean', [
                'nullable' => false,
                'default'  => false
            ])
            ->addIndex(["parent_id"], [
                'name'   => 'product_categories_index_parent_id_6035f3284ea1d',
                'unique' => false
            ])
            ->addIndex(["slug"], [
                'name'   => 'product_categories_index_slug_6035f3285078b',
                'unique' => true
            ])
            ->addIndex(["status"], [
                'name'   => 'product_categories_index_status_6035f32850792',
                'unique' => false
            ])
            ->addForeignKey(["parent_id"], 'product_categories', ["id"], [
                'name'   => 'product_categories_foreign_parent_id_6035f3284ea22',
                'delete' => 'CASCADE',
                'update' => 'CASCADE'
            ])
            ->setPrimaryKeys(["id"])
            ->create();

        $this->table('product_category_nodes')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('product_category_id', 'bigInteger', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('language_id', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('title', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('content', 'longText', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('seo_title', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('seo_description', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('seo_keywords', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addIndex(["product_category_id"], [
                'name'   => 'product_category_nodes_index_product_category_id_6035f3284e2fc',
                'unique' => false
            ])
            ->addIndex(["product_category_id", "language_id"], [
                'name'   => '8d0bc3ff7fb66e467d724726766e1215',
                'unique' => true
            ])
            ->addForeignKey(["product_category_id"], 'product_categories', ["id"], [
                'name'   => 'product_category_nodes_foreign_product_category_id_6035f3284e301',
                'delete' => 'CASCADE',
                'update' => 'CASCADE'
            ])
            ->setPrimaryKeys(["id"])
            ->create();

        $this->table('tags')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('slug', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('status', 'boolean', [
                'nullable' => false,
                'default'  => true
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('parent_id', 'bigInteger', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('parent_role', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 32
            ])
            ->addIndex(["parent_id", "parent_role"], [
                'name'   => 'tags_index_parent_id_parent_role_6035f3284e2ed',
                'unique' => false
            ])
            ->addIndex(["status"], [
                'name'   => 'tags_index_status_6035f328509e9',
                'unique' => false
            ])
            ->addIndex(["slug"], [
                'name'   => 'tags_index_slug_6035f328509ef',
                'unique' => false
            ])
            ->setPrimaryKeys(["id"])
            ->create();

        $this->table('tag_nodes')
            ->addColumn('id', 'bigPrimary', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('tag_id', 'bigInteger', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('language_id', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('title', 'string', [
                'nullable' => false,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('content', 'longText', [
                'nullable' => true,
                'default'  => null
            ])
            ->addColumn('created_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('updated_at', 'datetime', [
                'nullable' => false,
                'default'  => null
            ])
            ->addColumn('seo_title', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('seo_description', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addColumn('seo_keywords', 'string', [
                'nullable' => true,
                'default'  => null,
                'size'     => 255
            ])
            ->addIndex(["tag_id"], [
                'name'   => 'tag_nodes_index_tag_id_6035f3284e321',
                'unique' => false
            ])
            ->addIndex(["tag_id", "language_id"], [
                'name'   => 'tag_nodes_index_tag_id_language_id_6035f3284f526',
                'unique' => true
            ])
            ->addForeignKey(["tag_id"], 'tags', ["id"], [
                'name'   => 'tag_nodes_foreign_tag_id_6035f3284e326',
                'delete' => 'CASCADE',
                'update' => 'CASCADE'
            ])
            ->setPrimaryKeys(["id"])
            ->create();
    }

    public function down(): void
    {
        $this->table('tag_nodes')->drop();

        $this->table('tags')->drop();

        $this->table('product_category_nodes')->drop();

        $this->table('product_categories')->drop();

        $this->table('posts')->drop();

        $this->table('roots')->drop();

        $this->table('categories')->drop();

        $this->table('users')->drop();
    }
}

[Spiral\Migrations\Exception\MigrationException]
Error in the migration (0_default_create_posts_create_product_category_nodes_create_tag_nodes_create_special_offer_nodes_create_special_offers_create_fi (2021-02-24 06:33:12)) occurred: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT SVP0 does not existin /home/user/work/demo/vendor/spiral/migrations/src/Migrator.php:173

Exception Trace:
 Spiral\Migrations\Migrator->run() at /home/user/work/demo/vendor/spiral/migrations/src/Migrator.php:173
 Spiral\Migrations\Migrator->run() at /home/user/work/demo/vendor/spiral/framework/src/Framework/Command/Migrate/MigrateCommand.php:36
 Spiral\Command\Migrate\MigrateCommand->perform() at n/a:n/a
 ReflectionMethod->invokeArgs() at /home/user/work/demo/vendor/spiral/framework/src/Console/src/Command.php:78
 Spiral\Console\Command->execute() at /home/user/work/demo/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /home/user/work/demo/vendor/symfony/console/Application.php:971
 Symfony\Component\Console\Application->doRunCommand() at /home/user/work/demo/vendor/symfony/console/Application.php:290
 Symfony\Component\Console\Application->doRun() at /home/user/work/demo/vendor/spiral/framework/src/Console/src/Console.php:110
 Spiral\Console\Console->Spiral\Console\{closure}() at /home/user/work/demo/vendor/spiral/framework/src/Core/src/ContainerScope.php:50
 Spiral\Core\ContainerScope::runScope() at /home/user/work/demo/vendor/spiral/framework/src/Console/src/Console.php:111
 Spiral\Console\Console->run() at /home/user/work/demo/vendor/spiral/framework/src/Console/src/Console.php:77
 Spiral\Console\Console->Spiral\Console\{closure}() at /home/user/work/demo/vendor/spiral/framework/src/Core/src/ContainerScope.php:50
 Spiral\Core\ContainerScope::runScope() at /home/user/work/demo/vendor/spiral/framework/src/Console/src/Console.php:81
 Spiral\Console\Console->start() at /home/user/work/demo/vendor/spiral/framework/src/Framework/Console/ConsoleDispatcher.php:83
 Spiral\Console\ConsoleDispatcher->serve() at /home/user/work/demo/vendor/spiral/framework/src/Core/src/ContainerScope.php:50
 Spiral\Core\ContainerScope::runScope() at /home/user/work/demo/vendor/spiral/framework/src/Core/src/Container.php:265
 Spiral\Core\Container->runScope() at /home/user/work/demo/vendor/spiral/framework/src/Boot/src/AbstractKernel.php:104
 Spiral\Boot\AbstractKernel->serve() at /home/user/work/demo/app.php:36

@anlamas
Copy link
Author

anlamas commented Feb 24, 2021

Sorry, i forgot about switching php version from 7.4 to 8.0
So, i get this error with mysql8 php8.0
There is no error with mysql8 php7.4

@roxblnfk roxblnfk added this to Cycle Jan 4, 2022
@roxblnfk roxblnfk moved this to Backlog in Cycle Jan 4, 2022
@roxblnfk roxblnfk added status:to be verified Needs to be reproduced and validated. type:bug Bug and removed type:bug Bug labels Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated.
Projects
Status: Backlog
Development

No branches or pull requests

3 participants