Questions tagged [database]

Questions related to Magento's MySQL database, for example, the table schema, plain SQL queries or database configuration. For questions about the Magento database access layer, use other tags, like: eav, model, resource-model, collections, install-script. For questions about SQL queries in particular, the SQL tag is appropriate too.

Filter by
Sorted by
Tagged with
5 votes
1 answer
10k views

Query to return customer order history?

I am trying to dump historical customer order data from a legacy ecommerce site that we restored from an AMI. Ideally this would grab customer ID, email, order date, product SKUs ordered, and order ...
Alex's user avatar
  • 53
5 votes
2 answers
2k views

How to add new table in existing module using UpgradeSchema in Magento 2

class UpgradeSchema implements UpgradeSchemaInterface { public function upgrade(SchemaSetupInterface $setup,ModuleContextInterface $context){ $setup->startSetup(); if (...
sudo55's user avatar
  • 994
5 votes
1 answer
533 views

Is my site open to MySQL injection?

As I was updating ready for installing the new patches on a site I have inherited, I found this in my reports: a:5:{i:0;s:313:"SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or ...
Jonathan's user avatar
5 votes
2 answers
5k views

Found this error does not extend \Magento\Framework\DataObject

Facing this error Exception #0 (InvalidArgumentException): Sugarcode\Test\Model\Fee does not extend \Magento\Framework\DataObject Here's my code /home1/dukaania/public_html/testing2/app/code/...
jhon jhon doe's user avatar
5 votes
1 answer
1k views

Magento 2.3 Error on Delete All Test Data from Database

We are in the process of migrating to Magento 2.3, but need to remove all test data from the database and reset all increment ID's back to 1. Having some troubles removing all order information: SET ...
AJK's user avatar
  • 751
5 votes
1 answer
4k views

Magento 2 : Foreign key constraint is incorrectly formed, ALTER TABLE customer_group

After upgrade from magento 2.1.7 to 2.2.3 and am stuck. I have tried everything. In Pdo.php line 235: SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to ...
roger's user avatar
  • 551
5 votes
1 answer
1k views

Can I use a .sql file in my Magento module installer?

I have a large SQL file. Can I use this in my module installer?
Kurdt94's user avatar
  • 149
4 votes
2 answers
2k views

How to purge (delete) credit card numbers stored on Magento 1.9.1.0?

We used the 'Saved CC' payment method in our Magento 1.9.1.0 store and now we would like to delete the credit card numbers for security reasons. What is the easiest procedure to delete all credit card ...
Allysin's user avatar
  • 260
4 votes
3 answers
7k views

Magento product stock alert cron job

I recently discovered my product stock alert e-mails aren't being sent. When I checked the cron_schedule table in my DB, I see the following: Which basically tells me there hasn't been any execution ...
magin's user avatar
  • 515
4 votes
1 answer
6k views

Magento 2 UpgradeData doesn't work

I made a simple module wich create a simple table. This is my module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=".....
Isky's user avatar
  • 145
4 votes
1 answer
100 views

Custom Page Form and db insertion magento 2

I have created a custom Form and try to store details in databse. but the product url field and image url is not saved in db. app/code/Dyode/Pricebeat/Controller/User/Post.php <?php namespace ...
Nismath vi's user avatar
4 votes
1 answer
2k views

Cannot create new module in magento2 - php bin/magento setup:upgrade

I followed exactly this setup: https://github.com/magento/magento2-samples/tree/master/sample-module-minimal and added the registration.php file, and run php bin/magento module:enable Company_Basic, ...
Claudiu Creanga's user avatar
4 votes
0 answers
442 views

How to use LOAD DATA INFILE mysql syntax in magento? [closed]

$write = $resource->getConnection('core_write'); $write->beginTransaction(); $query = "LOAD DATA LOCAL INFILE '" . $partCsvPath . "' " . "INTO TABLE " . $resource->getTableName('...
R T's user avatar
  • 1,347
4 votes
1 answer
3k views

How to get All Column names of table in magento 2

I created a custom form in admin using block(without UI component). So i want to get all columns of my custom table in form block file. Please suggest me.
Alpeshsinh Solanki's user avatar
4 votes
1 answer
9k views

Adding a new eav attribute type "file upload"

I need to have the ability to add a file upload at the admin site and process the files after these have been uploaded. As a first step I like to extend Magento eav attributes with a new custom type "...
mark's user avatar
  • 41
4 votes
3 answers
4k views

Print INSERT Query in saveAction [duplicate]

I have a custom module where my few DB fields are not being saved properly. I can see the values selected in $model->getData(); but it does not reflects in my Database. try { echo '<...
Mark's user avatar
  • 81
4 votes
2 answers
5k views

How do I get the MySQL affected rows using the Magento resource?

$conn = Mage::getSingleton('core/resource')->getConnection('core_write'); $sql = "UPDATE ..."; $result = $conn->query($sql); How do I get the number of affected rows - i.e. mysql_affected_rows(...
sdfor's user avatar
  • 285
4 votes
2 answers
1k views

Huge pdo_mysql.log - turning off logging doesn't stop it from growing

Magento is logging SQL queries even after I turned logging off in /lib/Varien/Db/Adapter/Pdo/Mysql.php. Wondering if there's something I'm missing? These are the spots that are set to false: ...
Bobby Marls's user avatar
4 votes
1 answer
4k views

Importing attributes to a new magento installation

What are the tables I need to dump to be able to import them in a new installation? I need this to avoid reinserting all the custom attributes for every new Magento installation. thanks
Gabriele's user avatar
  • 525
4 votes
1 answer
5k views

What is causing InstallSchema Error Warning: array_key_exists() expects parameter 2 to be array, string given in

I'm trying to create a custom table in my module but I keep getting this error: Warning: array_key_exists() expects parameter 2 to be array, string given in I've been able to step through the code ...
user1704524's user avatar
  • 2,483
4 votes
1 answer
406 views

addColumn() or addAttribute() ? What is the best for performance, migration & usability?

What is the best method of adding new attributes to the sales and/or quote tables in magento via an install script: use: addColumn() or use addAttribute() ? So the main questions are : What is ...
Thomas Seres's user avatar
4 votes
1 answer
360 views

What's the purpose of the unique index on 'value' in 'catalog_product_entity_url_key'?

We're on a heavily modified EE 1.13.0.2 with some 20 store views - some of them sharing the same language - facing a problem with url keys. These are generated and differ per language BUT this doesn'...
pong's user avatar
  • 907
3 votes
3 answers
5k views

Deprecation Notice - Elasticsearch - Magento 2.3.0

I have installed version 2.3.0 of Magento and I have received this notification: Deprecation Notice Catalog Search is currently configured to use the MySQL engine, which has been deprecated. ...
Despotars's user avatar
  • 475
3 votes
1 answer
8k views

How to save form data to multiple tables in database

I have created a form in the admin panel with various fields. Now the fields here doesn't belong to one single table. On the save, I want some values to go into one particular table while others to go ...
Sumit Malik's user avatar
3 votes
3 answers
2k views

How can I remove not existing images in magento 2

How can I remove not existing images from magento. In the database have images but file is not exist. I want deleted this images from database.
Chandresh Chauhan's user avatar
3 votes
4 answers
7k views

using time in special price from/to

I'm trying to set a time in the product special price to/from dates (i.e., special price from 3/20/2013 11am EST to 4/20/2013 10:59am EST), but I cannot get a time to show up or save. When I enter a ...
Laura's user avatar
  • 2,700
3 votes
7 answers
27k views

Magento 2 : Unique constraint violation found when adding product, categories or mega menu items

I have a Magento 2.2.3 installation and I have the theme SM-Maxshop on that. I am not able to add any products, categories or Megamenu items to it. I get an error "Unique constraint violation found" ...
Priyanka's user avatar
3 votes
1 answer
2k views

Magento "INSERT IGNORE INTO"

I'm looking for a "INSERT IGNORE INTO" option with Magento. I've created a custom table, and this table is updated every time an order is successfull (this is working). However, I want it only to ...
esteemedparomomycin's user avatar
3 votes
4 answers
17k views

Magento 2 : Admin url 404 not found

I know there are many answers for this i tried all and not able to do it on my server hosted with godaddy magento latest version I tried this <Directory /var/www/> Options Indexes ...
Shaik's user avatar
  • 181
3 votes
1 answer
3k views

Magento 2 failed database rollback cannot add foreign key constraints

I recently updated from magento v. 2.1.7 to 2.1.9 and then tried to update directly after that to 2.2.1. That failed and when i try to do a rollback (backup created before updating from 2.1.7) that ...
rawley-swe's user avatar
3 votes
1 answer
3k views

Magento: Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance()

I am getting the following error message: Fatal error: Cannot override final method Mage_Core_Model_Abstract::clearInstance() in /var/www/html/app/code/core/Mage/Catalog/Model/Product.php on line ...
user2725391's user avatar
3 votes
1 answer
4k views

How to manually import/migrate orders & customers from Magento1 to Magento 2 database tables?

What is the best way to manually move the orders and customers to Magento 2.2.6 from Magento 1.8.1 without any third part extensions? there are around 100 records only. I was able to migrated all ...
Mage Explorer's user avatar
3 votes
2 answers
1k views

InnoDB on MySQL 5.6 with OSX/CE1.7

I am getting this error Database server does not support the InnoDB storage engine. with MySQL 5.6 on my MAC OSX Maverick mysql> show engines; +--------------------+---------+------------------...
brentwpeterson's user avatar
3 votes
1 answer
7k views

how to retrieve the request body parameters in magento 2.0

Client request url with some POST data. How can I retrieve that variable in magento? I have to retrieve that in JSON format variable and do the operation using those variables.
vijay b's user avatar
  • 362
3 votes
1 answer
6k views

A simple way to re-save all products

I imported a complete magento database. Every product and category is shown as it should in the backend. But, when trying to open a category in the storefront the end-user gets the "there are no ...
Julian's user avatar
  • 373
3 votes
1 answer
6k views

Is it possible to delete the table from the database when uninstall the module?

Can I delete the table from the Magento database when the module is disabled and uninstalled? Because the table was created when the module is installed.
Ankush Chauhan's user avatar
2 votes
1 answer
1k views

Magento 2 - How to manipulate tables directly from php

What classes can I use to directly manipulate Magento database tables? I have created a table in the database and would like to be able to insert/update rows in it directly, without having to define a ...
b_pcakes's user avatar
  • 493
2 votes
3 answers
2k views

Update order total after order place

I created a custom charges on order for some specific products, Unfortunately custom charge was not updated in order total like cash on delivery, Is there any way to update orders totals after order ...
Ram Pratap Singh Gour's user avatar
2 votes
2 answers
3k views

Magento 2: How many products sold Query

For Product A have 100 qty., For Product B i have 200 qty. I would like to check how many products ordered for a particular product. Which table i need to look up & what will be the query to get ...
Jackson's user avatar
  • 9,909
2 votes
2 answers
2k views

SQLSTATE[42S02]: Base table or view not found: 1146

Last night my host experienced what they call "InnoDB engine server is broken". It took awhile but they did a recovery but had some issues with missing tables. I also found out that we didn't have ...
user32527's user avatar
  • 103
2 votes
1 answer
5k views

Magento 2 Add extra data to an order

I'm brand new to Magento 2 programming, although I have a number of years of PHP behind me. I need to store an id from an external system alongside an order that that system creates. I've got the ...
boris_horis's user avatar
2 votes
2 answers
3k views

Is it safe to truncate the catalog_category_product_index table?

That is, will it be re-indexed from scratch? I can not find it in the list of tables that are safe to truncate here. I'm on Magento 1.4.1, although this should apply to other versions as well, ...
workflow's user avatar
  • 135
2 votes
1 answer
730 views

cataloginventory_stock_item.low_stock_date?

Table cataloginventory_stock_item column low_stock_date In our db most of the products have the same exact timestamp. how the event trigger for low stock and how to get the exact date. Actually lot of ...
Pradeep's user avatar
  • 21
2 votes
1 answer
12k views

Fetch data from database custom table

I have created a new table 'custom_table' i need to render the values in a custom template. How to get the values of that table ?
Rajesh Vedhamurthy's user avatar
2 votes
3 answers
11k views

PDO Exception error on index

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in lib/Zend/Db/Adapter/Pdo/Abstract.php:129 I get the following error on my local ...
brentwpeterson's user avatar
2 votes
0 answers
1k views

Magento 2 site crashing after 2 weeks (Believed cron or mysql problem)

I have a magento 2 site working however it keeps crashing randomly after running smoothly for 2 weeks. I reboot my site after the crash and it seems to stay for about a day or so before crashing again....
Greg's user avatar
  • 399
2 votes
3 answers
2k views

Is it safe to truncate the catalog_category_product table?

I was trying to reindex Category Products and I kept getting "There was a problem with reindexing process" error message. When I into SSH and tried 'php indexer.php --reindex catalog_category_product',...
mcpacific's user avatar
2 votes
2 answers
2k views

How do I lock a row after using load()? [duplicate]

Let's say I do the following: $favorite = Mage::getModel('testing/favorites')->load(4); ..... $favorite->save(); How do I make sure the row 4 has been locked and can't be accessed until I call ...
Pat's user avatar
  • 794
2 votes
1 answer
1k views

How do I get my Collection to use a different DB connection?

So I have extended a Magento collection to obtain my own collection only I want to use a different DB connection. What I have attempted to do is define the connection in config.xml like so: <...
user2045's user avatar
  • 831
2 votes
0 answers
2k views

How to Move Products, Attributes, Images, and Customers From One Magento Installation to Another

I have Magento 1.9.2.1 installed and I also installed a test Magento installation in a subdomain. Basically, the theme I have installed on my current Magento installation was designed for an older ...
Lucas's user avatar
  • 309

1 2 3
4
5
7