Manual insert data into a table

Moderator: crythias

Locked
benjamin1
Znuny newbie
Posts: 14
Joined: 19 Aug 2015, 05:16
Znuny Version: 5.0.13

Manual insert data into a table

Post by benjamin1 »

Hello,

I need to manually insert data back into table dynamic_field_value which was deleted when I archived some tickets:

INSERT into dynamic_field_value (id,field_id,object_id,value_text) values( ,'27','5439','Test')

Can someone advise how I can populate ID column with next available value.

Thanks, Ben
root
Administrator
Posts: 4253
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Manual insert data into a table

Post by root »

There is no need to insert data direct into the table. Use XML-RPC (deprecated), GenericInterface (SOAP/REST) or the Perl API. Never ignore the provided APIs.
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
benjamin1
Znuny newbie
Posts: 14
Joined: 19 Aug 2015, 05:16
Znuny Version: 5.0.13

Re: Manual insert data into a table

Post by benjamin1 »

Is there a way to do it from DB as I am more familiar with SQL than webservice
root
Administrator
Posts: 4253
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Manual insert data into a table

Post by root »

benjamin1 wrote:Is there a way to do it from DB as I am more familiar with SQL than webservice
I can't recommend bypassing the API. What's your exactly use case?
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
benjamin1
Znuny newbie
Posts: 14
Joined: 19 Aug 2015, 05:16
Znuny Version: 5.0.13

Re: Manual insert data into a table

Post by benjamin1 »

Data loss occurred due to use of a 3rd party plugin (DynamicFieldRemoteDB), when we archived tickets the dynamic field value populated using this plugin was lost.

We have extracted lost data from ticket_history table.

We now need to insert data back into dynamic_field_value table
e.g.
INSERT into dynamic_field_value (id,field_id,object_id,value_text) values( ,'27','5439','Test')
root
Administrator
Posts: 4253
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Manual insert data into a table

Post by root »

benjamin1 wrote:Data loss occurred due to use of a 3rd party plugin (DynamicFieldRemoteDB), when we archived tickets the dynamic field value populated using this plugin was lost.
That's the first time that I heard this about this add on. And I guess it has nothing to do with the data loss, because the values are stored in the same table. The addon is used when entering new data and displaying the data. :-/
benjamin1 wrote: We now need to insert data back into dynamic_field_value table
e.g.
INSERT into dynamic_field_value (id,field_id,object_id,value_text) values( ,'27','5439','Test')
For a one time job you can try this, but be sure to delete all caches after this.
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
Locked