1

I have to write insert query for Magento 2 cms_block table, for ex:- cms_block table, what should i write for the column created_in , updated_in , creation_time , update_time

row_id  block_id  created_in  updated_in   title   identifier   content   
  254      254        1       2147483647  Designer  designer  "<p><span></span></p>"    

creation_time          update_time          is_active
2018-08-21 00:21:47   2018-09-18 01:00:07       1

These are the entries which are already there in cms_block, I have to create a msyql script insert queries so that i can run it on mysql console. What does created_in = 1 mean? similarly what is updated_in= 2147483647 mean looking at their data types they are bigint(20) unsigned. for creation_time and update_time i will use timestamp, but what to use for created_in and updated_in in my sql query.

And if there is another approach to achieve that, I looked on this link:- Magento 2: How to insert data into custom table in model file?

But my requirement is to run insert query on the MySQL terminal for Magento 2, and for that, I don't the meaning of two columns created_in, updated_in and if that's epoc time then how to do that in MySQL query

UPDATE WHEN I MANUALLY INSERT VALUE FOR ALL COLUMNS , following error occurs

ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`webster`.`cms_block`, CONSTRAINT `CMS_BLOCK_BLOCK_ID_SEQUENCE_CMS_BLOCK_SEQUENCE_VALUE` FOREIGN KEY (`block_id`) REFERENCES `sequence_cms_block` (`sequence_value`) ON DELETE CASCADE)
0

created_in and updated_in are used for scheduled updates (EE-only feature)

https://devdocs.magento.com/guides/v2.3/mrg/ee/CmsStaging.html

creation_time and update_time have a default value (which is the current time) that will be set by mysql if you don't provide anything specific.

  • it gives me error in block_id column, ERROR 1364 (HY000): Field 'block_id' doesn't have a default value, row_id and block_id 'id' are same, how can i know what value to insert in block_id – suman Jan 8 at 16:22
  • and it also throw error for created_in and updated_in , ERROR 1364 (HY000): Field 'created_in' doesn't have a default value – suman Jan 8 at 16:45
  • you have to give values for both. created_in is useally 1 and block id is the block id – Philipp Sander Jan 9 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.