Closed Gilles-Lengy closed 5 years ago
Hello Gilles, does the error occur after doing a schema update or when?
Before and after. In fact I ran the command to update the schema, but it failed because of the key constrains...
I tried to visit http://localhost/sylius2/web/ but I have this error
Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sylius2.sylius_channel' doesn't exist in C:\wamp64\www\sylius2\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:105 Stack trace: #0 C:\wamp64\www\sylius2\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php(105): PDOStatement->execute(NULL) #1 C:\wamp64\www\sylius2\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php(907): Doctrine\DBAL\Driver\PDOStatement->execute() #2 C:\wamp64\www\sylius2\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\Entity\BasicEntityPersister.php(733): Doctrine\DBAL\Connection->executeQuery('SELECT t0.code ...', Array, Array) #3 C:\wamp64\www\sylius2\vendor\doctrine\orm\lib\Doctrine\ORM\EntityRepository.php(196): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load(Array, NULL, NULL, Array, NULL, 1, NULL) #4 C:\wamp64\www\sylius2\vendor\sylius\sylius\src\Sylius\Bundle\ChannelBundle\Doctrine\ORM\ChannelRepository.php(27): Doctrine\ORM\EntityRepository->findOneBy(Array) #5 C:\w in C:\wamp64\www\sylius2\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\AbstractMySQLDriver.php on line 57
Before I've tried only via the app_dev... I think with this way Sylius use the database sylius2_dev while when accessing directly Sylius tried to access the database sylius2 wich is empty...
Don't know if that can help...
This morning I tried on a fresh install. I had errors when udating the database.
`C:\wamp64\www\sylius3>php bin/console doctrine:schema:update --dump-sql
The following SQL statements will be executed:
CREATE TABLE odiseo_channel (id INT AUTO_INCREMENT NOT NULL, default_locale_id INT NOT NULL, base_currency_id INT NOT NULL, default_tax_zone_id INT DEFAULT NULL, code VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, color VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, enabled TINYINT(1) NOT NULL, hostname VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, theme_name VARCHAR(255) DEFAULT NULL, tax_calculation_strategy VARCHAR(255) NOT NULL, contact_email VARCHAR(255) DEFAULT NULL, skipping_shipping_step_allowed TINYINT(1) NOT NULL, skipping_payment_step_allowed TINYINT(1) NOT NULL, account_verification_required TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_1004A1A977153098 (code), INDEX IDX_1004A1A9743BF776 (default_locale_id), INDEX IDX_1004A1A93101778E (base_currency_id), INDEX IDX_1004A1A9A978C17 (default_tax_zone_id), INDEX IDX_1004A1A9E551C011 (hostname), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;
CREATE TABLE odiseo_product (id INT AUTO_INCREMENT NOT NULL, main_taxon_id INT DEFAULT NULL, vendor_id INT DEFAULT NULL, code VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, enabled TINYINT(1) NOT NULL, variant_selection_method VARCHAR(255) NOT NULL, average_rating DOUBLE PRECISION DEFAULT '0' NOT NULL, UNIQUE INDEX UNIQ_61B72B4377153098 (code), INDEX IDX_61B72B43731E505 (main_taxon_id), INDEX IDX_61B72B43F603EE73 (vendor_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;
CREATE TABLE odiseo_vendor (id INT AUTO_INCREMENT NOT NULL, channel_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, logo_name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_B506F54F989D9B62 (slug), INDEX IDX_B506F54F72F5A1AA (channel_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;
CREATE TABLE odiseo_vendor_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT NOT NULL, description LONGTEXT NOT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_5F5AE1AB2C2AC5D3 (translatable_id), UNIQUE INDEX odiseo_vendor_translation_uniq_trans (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB;
ALTER TABLE odiseo_channel ADD CONSTRAINT FK_1004A1A9743BF776 FOREIGN KEY (default_locale_id) REFERENCES sylius_locale (id);
ALTER TABLE odiseo_channel ADD CONSTRAINT FK_1004A1A93101778E FOREIGN KEY (base_currency_id) REFERENCES sylius_currency (id);
ALTER TABLE odiseo_channel ADD CONSTRAINT FK_1004A1A9A978C17 FOREIGN KEY (default_tax_zone_id) REFERENCES sylius_zone (id) ON DELETE SET NULL;
ALTER TABLE odiseo_product ADD CONSTRAINT FK_61B72B43731E505 FOREIGN KEY (main_taxon_id) REFERENCES sylius_taxon (id);
ALTER TABLE odiseo_product ADD CONSTRAINT FK_61B72B43F603EE73 FOREIGN KEY (vendor_id) REFERENCES odiseo_vendor (id) ON DELETE SET NULL;
ALTER TABLE odiseo_vendor ADD CONSTRAINT FK_B506F54F72F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE;
ALTER TABLE odiseo_vendor_translation ADD CONSTRAINT FK_5F5AE1AB2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES odiseo_vendor (id) ON DELETE CASCADE;
ALTER TABLE sylius_channel_currencies DROP FOREIGN KEY FK_AE491F9372F5A1AA;
ALTER TABLE sylius_channel_currencies ADD CONSTRAINT FK_AE491F9372F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE;
ALTER TABLE sylius_channel_locales DROP FOREIGN KEY FK_786B7A8472F5A1AA;
ALTER TABLE sylius_channel_locales ADD CONSTRAINT FK_786B7A8472F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_channels DROP FOREIGN KEY FK_F9EF269B4584665A;
ALTER TABLE sylius_product_channels DROP FOREIGN KEY FK_F9EF269B72F5A1AA;
ALTER TABLE sylius_product_channels ADD CONSTRAINT FK_F9EF269B4584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_channels ADD CONSTRAINT FK_F9EF269B72F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_options DROP FOREIGN KEY FK_2B5FF0094584665A;
ALTER TABLE sylius_product_options ADD CONSTRAINT FK_2B5FF0094584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_association DROP FOREIGN KEY FK_48E9CDAB4584665A;
ALTER TABLE sylius_product_association ADD CONSTRAINT FK_48E9CDAB4584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_association_product DROP FOREIGN KEY FK_A427B9834584665A;
ALTER TABLE sylius_product_association_product ADD CONSTRAINT FK_A427B9834584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_attribute_value DROP FOREIGN KEY FK_8A053E544584665A;
ALTER TABLE sylius_product_attribute_value ADD CONSTRAINT FK_8A053E544584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_order DROP FOREIGN KEY FK_6196A1F972F5A1AA;
ALTER TABLE sylius_order ADD CONSTRAINT FK_6196A1F972F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id);
ALTER TABLE sylius_payment_method_channels DROP FOREIGN KEY FK_543AC0CC72F5A1AA;
ALTER TABLE sylius_payment_method_channels ADD CONSTRAINT FK_543AC0CC72F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_image DROP FOREIGN KEY FK_88C64B2D7E3C61F9;
ALTER TABLE sylius_product_image ADD CONSTRAINT FK_88C64B2D7E3C61F9 FOREIGN KEY (owner_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_review DROP FOREIGN KEY FK_C7056A994584665A;
ALTER TABLE sylius_product_review ADD CONSTRAINT FK_C7056A994584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_taxon DROP FOREIGN KEY FK_169C6CD94584665A;
ALTER TABLE sylius_product_taxon ADD CONSTRAINT FK_169C6CD94584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_translation DROP FOREIGN KEY FK_105A9082C2AC5D3;
ALTER TABLE sylius_product_translation ADD CONSTRAINT FK_105A9082C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_product_variant DROP FOREIGN KEY FK_A29B5234584665A;
ALTER TABLE sylius_product_variant ADD CONSTRAINT FK_A29B5234584665A FOREIGN KEY (product_id) REFERENCES odiseo_product (id) ON DELETE CASCADE;
ALTER TABLE sylius_promotion_channels DROP FOREIGN KEY FK_1A044F6472F5A1AA;
ALTER TABLE sylius_promotion_channels ADD CONSTRAINT FK_1A044F6472F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE;
ALTER TABLE sylius_shipping_method_channels DROP FOREIGN KEY FK_2D98333572F5A1AA;
ALTER TABLE sylius_shipping_method_channels ADD CONSTRAINT FK_2D98333572F5A1AA FOREIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE;
C:\wamp64\www\sylius3>php bin/console doctrine:schema:update --force
Updating database schema...
In AbstractMySQLDriver.php line 68:
An exception occurred while executing 'ALTER TABLE sylius_channel_currencies ADD CONSTRAINT FK_AE491F9372F5A1AA FOR EIGN KEY (channel_id) REFERENCES odiseo_channel (id) ON DELETE CASCADE':
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fa
ils (sylius3_dev
.#sql-3a0_b4
, CONSTRAINT FK_AE491F9372F5A1AA
FOREIGN KEY (channel_id
) REFERENCES odiseo_ch annel
(id
) ON DELETE CASCADE)
In PDOConnection.php line 109:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fa
ils (sylius3_dev
.#sql-3a0_b4
, CONSTRAINT FK_AE491F9372F5A1AA
FOREIGN KEY (channel_id
) REFERENCES odiseo_ch annel
(id
) ON DELETE CASCADE)
In PDOConnection.php line 107:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fa
ils (sylius3_dev
.#sql-3a0_b4
, CONSTRAINT FK_AE491F9372F5A1AA
FOREIGN KEY (channel_id
) REFERENCES odiseo_ch annel
(id
) ON DELETE CASCADE)`
Now, I don't have any channel and can't create a new one.
UniqueConstraintViolationException
Sorry for how this comment is displayed. I couldn't do it in a better way
Hi @Gilles-Lengy. Can you try to reproduce the error again? We released a new version.
I'm getting this error in console while running bin/console commands:
In FileSystemLocator.php line 118:
Root image path not resolvable "/var/www/html/myproject/app/../web/media/vendor-logo"
I found issue https://github.com/liip/LiipImagineBundle/issues/1017 according to them ^2.0 works fine with symphony 4 but I'm not sure how did I install 1.7-dev. Can you suggest me some fix?
I'm getting this error in console while running bin/console commands:
In FileSystemLocator.php line 118: Root image path not resolvable "/var/www/html/myproject/app/../web/media/vendor-logo"
I found issue liip/LiipImagineBundle#1017 according to them ^2.0 works fine with symphony 4 but I'm not sure how did I install 1.7-dev. Can you suggest me some fix?
Create the directory manually and the error is gone. I remember this happened to me too for some reason.
Yes, you need to create the directory manually. We updated the Readme with that step
After installing this plugin, I've this error
The table exists.
Do you need more informations ?