magento 1 vs magento 2 database structure

21

Upload: ubertheme

Post on 13-Apr-2017

318 views

Category:

Software


6 download

TRANSCRIPT

Page 1: Magento 1 vs Magento 2 Database Structure
Page 2: Magento 1 vs Magento 2 Database Structure

The Ultimate Comparison

Magento 1 vs. Magento 2 Database Structure

Page 3: Magento 1 vs Magento 2 Database Structure

1. The ‘core_website’ table was replaced with ‘store_website’ (The structure was changed)

2. The ‘core_store’ table was replaced with ‘store’ (The structure was not changed)

3. The ‘core_store_group’ table was replaced with ‘store_group’ (The structure was not changed)

1 - Websites, Stores, Store Views

Page 4: Magento 1 vs Magento 2 Database Structure

1. A new field ‘is_required_in_admin_store’ was added to the ‘catalog_eav_attribute’ table

2. Two new fields ‘attribute_group_code’ & ‘tab_group_code’ were added to the ‘eav_attribute_group’ table

3. The product attribute ‘msrp_enabled’ was replaced with ‘msrp’. Magento 2 deleted 2 core attributes ‘group_price’, ‘msrp_enabled’ and the ‘group_price’ data was converted to ‘tier_price’

4. The category attribute ‘thumbnail’ was deleted

2 - Core Product Attributes, Custom Product Attributes

Page 5: Magento 1 vs Magento 2 Database Structure

1. Structure of tables’ changes:-- The ‘entity_type_id’ field was deleted-- Some FOREIGN KEYs were changed

2. The ‘core_url_rewrite’ table was changed to ‘url_rewrite’ and structure was changed.

3 - Categories

Page 6: Magento 1 vs Magento 2 Database Structure

1. Have more than 44 related tables

2. The structure of tables was changed:-- The enity_type_id field was deleted-- Some FOREING KEYs were changed

3. Product Images: A new field ‘enity_id’ was added to the ‘catalog_product_entity_media_gallery_value’ table

4. The catalog_product_index_tier_price table changes:-- The value_id, all_groups, qty, value fields were deleted-- The min_price field was added

5. Stock:+ The ‘website_id’ field was added to the ‘cataloginventory_stock’, ‘cataloginventory_stock_item’ tables+ The ‘core_url_rewrite’ table was changed to ‘url_rewrite’ (structure was changed)

4 - Products

Page 7: Magento 1 vs Magento 2 Database Structure

1. The ‘customer_entity’, ‘customer_address_entity ‘tables removed the ‘entity_type_id’, ‘attribute_set_id’ fields

2. The ‘customer_address_entity_datetime’, ‘customer_address_entity_decimal’, ‘customer_address_entity_int’, ‘customer_address_entity_text’, ‘customer_address_entity_varchar’, ‘customer_entity_datetime’, ‘customer_entity_decimal’, ‘customer_entity_int’, ‘customer_entity_text’, ‘customer_entity_varchar’ tables removed the ‘entity_type_id’ field

3. The ‘customer_eav_attribute’ table:-- The ‘is_used_for_customer_segment’ field was deleted-- Data model value was changed. For instance, the customer/attribute_data_postcode was replaced with Magento\\Customer\\Model\\Attribute\\Data\\Postcode

5 - Customers

Page 8: Magento 1 vs Magento 2 Database Structure

4. EAV of customer data structure was changed, some attributes were moved to the main table:-- Some new fields ‘created_in’, ‘firstname’, ‘middlename’, ‘lastname’, ‘password_hash’, ‘rp_token’, ‘rp_token_created_at’, ‘prefix’, ‘suffix’, ‘dob’, ‘default_billing’, ‘default_shipping’, ‘taxvat’, ‘confirmation’, ‘gender’ were added to the ‘customer_entity’ table

5. EAV of customer_address_entity data structure was changed, some attributes were moved from the children tables to the main table `customer_address_entity`:-- Country_id, firstname, lastname, middlename, street, telephone, city, fax, company, country_id, postcode, prefix, region, region_id, suffix, vat_id, vat_is_valid, vat_request_date, vat_request_id, vat_request_success

5 - Customers (cont’)

Page 9: Magento 1 vs Magento 2 Database Structure

6. Magento CE 2.x changed the method of hashing passwords from md5() to sha256(). Magento 2 still supports the option md5() providing that the string ‘:0’ must be appended to the end of ‘password_hash’

Magento 2 also supports CLI command to upgrade all password_hash using md5() to sha256(): php -f bin/magento customer:hash:upgrade

5 - Customers (cont’)

Page 10: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

1. Sales Orders tables changes:-- The ‘sales_flat_order table’ was replaced with ‘sales_order’ (the structure was changed)-- The ‘sales_flat_order_address’ was replaced with ‘sales_order_address’ (the structure was changed)-- The ‘sales_flat_order_grid’ was replaced with ‘sales_order_grid’-- The ‘sales_flat_order_item’ was replaced with ‘sales_order_item’ (the structure was changed)-- The ‘sales_flat_order_status_history’ was replaced with ‘sales_order_status_history’-- The ‘sales_order_status_state’ (the structure was changed)-- The ‘sales_order_tax_item’ (the structure was changed)

Page 11: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

2. Max length changes in the `sales_order` table:+ ‘store_name’, ‘shipping_method’, ‘x_forwarded_for’ have new max length 32 chars.+ ‘applied_rule_ids has new max length chars 128+ ‘weight’ has new max length 12

3. The `sales_order_item` table changes:+ Magento 2 changed the method to save value of the `weee_tax_applied` field to database: serialize() -> json_encode()+ ‘weight’, ‘row_weight’ have new max length value 12 chars

Page 12: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

4. Sales Quote:-- The ‘sales_flat_quote’ was replaced with ‘quote’ (the structure was changed)-- ‘sales_flat_quote_address’ was replaced with ‘quote_address’ (the structure was changed)-- ‘sales_flat_quote_address_item’ was replaced with ‘quote_address_item’ (the structure was changed)-- ‘sales_flat_quote_item’ was replaced with ‘quote_item’ (the structure was changed)-- ‘sales_flat_quote_item_option’ was replaced with ‘quote_item_option’-- ‘sales_flat_quote_payment’ was replaced with ‘quote_payment’ (the structure was changed)-- ‘sales_flat_quote_shipping_rate’ was replaced with ‘quote_shipping_rate’-- In the `quote_address ` table:+ ‘region’, ‘shipping_method’, ‘city’ have new max length 40 chars+ ‘firstname’, ‘lastname’, ‘postcode’, ‘telephone’, ‘fax’ have new max length 20 chars+ ‘country_id’ has new max length 30 chars+ ‘weight’ has new max length 12 chars+ ‘address_type’ has new max length 10 chars

Page 13: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

5. Sales Payments:-- ‘sales_flat_order_payment’ was replaced with ‘sales_order_payment’ (the structure was changed)-- The `sales_order_payment` table has some fields ‘po_number’, ‘cc_number_enc’ with max length 32 chars

6. Sales Invoices:-- ‘sales_flat_invoice’ was replaced with ‘sales_invoice’ (the structure was changed)-- ‘sales_flat_invoice_comment’ was replaced with ‘sales_invoice_comment’-- ‘sales_flat_invoice_grid’ was replaced with ‘sales_invoice_grid’ (the structure was changed)-- ‘sales_flat_invoice_item’ was replaced with ‘sales_invoice_item’ (the structure was changed)

Page 14: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

7. Sales Shipments-- ‘sales_flat_shipment’ was replaced with ‘sales_shipment’-- ‘sales_flat_shipment_comment’ was replaced with ‘sales_shipment_comment’-- ‘sales_flat_shipment_grid’ was replaced with ‘sales_shipment_grid’ (the structure was changed)-- ‘sales_flat_shipment_item’ was replaced with ‘sales_shipment_item’-- ‘sales_flat_shipment_track’ was replaced with ‘sales_shipment_track’

8. In the `sales_invoice_item` table, Magento 2 changed the method to save value of the `weee_tax_applied` field to database: serialize() -> json_encode() function.

9. In the `sales_shipment_item` table, the `weight` field has max length 12 chars

Page 15: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

10. Sales Credit Memo: Name of tables was changed (the string “_flat” was deleted)-- The `sales_creditmemo_grid` table: some new fields and value are required in Magento 2 like ‘updated_at’, ‘customer_name’-- In the `sales_creditmemo_item` table, Magento 2 changed the method to save the value of `weee_tax_applied` field to database: serialize() -> json_encode() function.

Page 16: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

11. Sales Rules: Sales Rules Models Class Name changes:-- The ‘salesrule/rule_condition_product_found’ was replaced with ‘Magento\SalesRule\Model\Rule\Condition\Product\Found’-- The ‘salesrule/rule_condition_product_subselect’ was replaced with ‘Magento\SalesRule\Model\Rule\Condition\Product\Subselect’-- The ‘salesrule/rule_condition_product_combine’ was replaced with ‘Magento\SalesRule\Model\Rule\Condition\Product\Combine’-- The ‘salesrule/rule_condition_product’ was replaced with ‘Magento\SalesRule\Model\Rule\Condition\Product’-- The ‘salesrule/rule_condition_combine’ was replaced with ‘Magento\SalesRule\Model\Rule\Condition\Combine’-- The ‘salesrule/rule_condition_address’ was replaced with ‘Magento\SalesRule\Model\Rule\Condition\Address’

Page 17: Magento 1 vs Magento 2 Database Structure

6 - (Sale) Orders, Quote, Invoices, Payments, Shipments, Bestseller info, Rules & Coupons

12. Magento 2 added new tables for sales data ‘sales_sequence_meta’ and ‘sequece_tables’ (default table in a clean Magento installation). Magento 2 will automatically generate ‘Sequence_tables’ related to ‘sales_sequence_meta’ (for instance: “sequence_invoice_0, sequence_order_0…)

Page 18: Magento 1 vs Magento 2 Database Structure

7 - Catalog Rules

Catalog Rule Model Class Name changes:-- The ‘catalogrule/rule_condition_combine’ was replaced with ‘Magento\CatalogRule\Model\Rule\Condition\Combine’-- The ‘catalogrule/rule_condition_product’ was replaced with ‘Magento\CatalogRule\Model\Rule\Condition\Product’-- The ‘catalogrule/rule_action_collection’ was replaced with ‘Magento\CatalogRule\Model\Rule\Action\Collection’

Page 19: Magento 1 vs Magento 2 Database Structure

View graphic in full size:

[Infographic] Magento 1 vs Magento 2 Database Structure

https://www.ubertheme.com/magento2/infographic-magento-1-vs-magento-2-database-structure/

Page 21: Magento 1 vs Magento 2 Database Structure

You might be interested in our new Magento 2 releases. For more details, head over to www.ubertheme.com

or reach us via info (at) ubertheme.com