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

can we remove drop table statements from db:dump command? #1094

Closed
ioweb-gr opened this issue Jan 19, 2023 · 3 comments
Closed

can we remove drop table statements from db:dump command? #1094

ioweb-gr opened this issue Jan 19, 2023 · 3 comments
Labels

Comments

@ioweb-gr
Copy link

Your Question

I am experimenting with the db:dump command and I was wondering if it's possible to create a dump for a specific table without the drop table statement.

For example

n98-magerun2.phar db:dump --include catalog_category_product

will add this statement

DROP TABLE IF EXISTS `catalog_category_product`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `catalog_category_product` (
  `entity_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Entity ID',
  `category_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Category ID',
  `product_id` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Product ID',
  `position` int(11) NOT NULL DEFAULT 0 COMMENT 'Position',
  PRIMARY KEY (`entity_id`,`category_id`,`product_id`),
  UNIQUE KEY `CATALOG_CATEGORY_PRODUCT_CATEGORY_ID_PRODUCT_ID` (`category_id`,`product_id`),
  KEY `CATALOG_CATEGORY_PRODUCT_PRODUCT_ID` (`product_id`),
  CONSTRAINT `CAT_CTGR_PRD_CTGR_ID_CAT_CTGR_ENTT_ENTT_ID` FOREIGN KEY (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`) ON DELETE CASCADE,
  CONSTRAINT `CAT_CTGR_PRD_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=35847771 DEFAULT CHARSET=utf8 COMMENT='Catalog Product To Category Linkage Table';
/*!40101 SET character_set_client = @saved_cs_client */;

I would like to avoid dropping the table and only insert the rows

  • Source File:
  • Line(s):
  • Question:
@cmuench
Copy link
Member

cmuench commented Jan 20, 2023

@ioweb-gr it's currently not implemented. This command is only a wrapper of mysqldump.
I checked the options and it should be possible by adding --no-create-info option.
So we could extend our command with the same option.

@cmuench
Copy link
Member

cmuench commented Jan 20, 2023

@ioweb-gr A quick workaround...
You can use the --only-command option to print the mysqldump command and then add the --no-create-info manually to it.

@ioweb-gr
Copy link
Author

@cmuench Cool thank you :) I'll try modifying the command

@cmuench cmuench closed this as completed Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants