Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Data lost from tables on rebuild

[SOLVED] Data lost from tables on rebuild 09 Feb 2012 02:40 #1213

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
i run in sand box
i visit admin and public demo sites
i edit edit / add data on either admin or public site
i then make changes in builder
i run in sandbox
i get an error at last step restore data set
the error relating to table structure or data - (see below)
i click retry fails it fails again at restore data set
clicking retry - continues to fail at last step

clicking cancel - returns to builder

clicking - run in sand box again
rebuild process completes without error

The dialogue box displays [sand box site] or [sandbox administrator] links

the data is lost from some tables but not all

build - restore dataset errors

Duplicate entry '1' for key 'PRIMARY' SQL=INSERT INTO `[PREFIX]demo....

Table '[DATABASE].[PREFIX]"my demonumber"_"mytable_name" doesn't exist

The first - run in sandbox
the backup is created
at this point
Table Exists
data records exist

restore fails for what ever reason the first time...
leaving the following conditions
the table exists
table data is empty
- (error thrown by restore operation stops the write data operation)

by restarting the run in sandbox a second time
-the restore succeeds the second time because
-the backup will now contain the
existing table
with no data records

restore dataset completes without issue

Thanks in advance
Last Edit: 11 Feb 2012 08:06 by BTB300. Reason: Fixed
The administrator has disabled public write access.

[SOLVED] Data lost from tables on rebuild 09 Feb 2012 13:22 #1218

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
ok think i found part if not the solution

in the database tables i created a field called item_ID this had the yellow star against it (the main field for the table)

the values in this field were duplicated

the field contained similar values
item_id
0
2
4
0
1
3
0

removed the duplicates and it seems to work and retain the data

can some one explain the use of the star in the data base fields - does the placement of this set the field as the primary key?

if the star sets the field as as the primary key how do we created an auto incremented field so that this field would always remain unique

can we create calculated fields such as ID=max(ID)+1 ?

i notice that there is a field call ID in the table we can not access it - cant we assign the star to the it

Thanks in advance
The administrator has disabled public write access.

[SOLVED] Data lost from tables on rebuild 09 Feb 2012 14:30 #1219

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
after some more testing

it indicates that the table i just added a record to doesnot exist

and have lots of these errors
Duplicate entry '1' for key 'PRIMARY' SQL=INSERT INTO `[PREFIX]demo....
The administrator has disabled public write access.

[SOLVED] Data lost from tables on rebuild 11 Feb 2012 08:09 #1233

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
Appears that the above issue can be resolved by renaming aliases in the problem table
The administrator has disabled public write access.

Re: [SOLVED] Data lost from tables on rebuild 12 Feb 2012 13:50 #1244

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Thank you very much for enquiring.

I now have much more information to go in.

I will dig.

Karma +2
Coding is now a piece of cake
The administrator has disabled public write access.

Re: [SOLVED] Data lost from tables on rebuild 12 Feb 2012 14:14 #1246

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
The yellow star is not the table key.
Table key is always 'id' in your component.

The yellow star defines the default label field for your table.
Very few used.

For instance when you set-up a menu item to a singular item of your component, you can choose it in a modal picker.
Here, the only column of the list is that with the yellow star.

It is the only place it is used for the moment.
Maybe can be used more in others functionalities.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: [SOLVED] Data lost from tables on rebuild 12 Feb 2012 22:40 #1247

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
THANKS FOR RESPONSE
if it helps i offer the additional details

- it hapens when you change the table alias
- data is lost from the child table
- data remains as expected
- it only happens when you have tables with parent table--> foreign key --> child table

i can confirm this as i had two tables losing data
both tables with data loss had parent table--> foreign key --> child table relationships
it was always the child table that lost data

such as orders --> fk --> order items
orders data retained
order item data lost

- as i suggested before (i do not know the backend of builder i am only guessing)
- you build component and publish to sandbox
- you input some data in sand box
- in builder you change a table alias
(please note i only changd table alias once)
- you build and publish again
- the back up has the old table alias
- the restore backup fails when creating the table
- leaving the table non existant
- cancel build

- restart build a second time
- create build again
- one would think that the code would have a create table if not exists
- the table no longer exists
- the new table is written
- build completes ok
The administrator has disabled public write access.

Re: [SOLVED] Data lost I CAN DUPLICATE PROBLEM 12 Feb 2012 23:23 #1248

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
HERES THE SQL ERROR
Table '[DATABASE].[PREFIX]demo2480_orders' doesn't exist SQL=INSERT INTO `[PREFIX]demo2480_orders` (`id`, `params`, `order_ref`, `order_description`) VALUES (1,'',123,'TEST ORDER1'),(2,'',1234,'TEST ORDER2'),(3,'',456,'Test Order 3');
Table '[DATABASE].[PREFIX]demo2480_orders' doesn't exist SQL=INSERT INTO `[PREFIX]demo2480_orders` (`id`, `params`, `order_ref`, `order_description`) VALUES (1,'',123,'TEST ORDER1'),(2,'',1234,'TEST ORDER2'),(3,'',456,'Test Order 3');
Duplicate entry '1' for key 'PRIMARY' SQL=INSERT INTO `[PREFIX]demo2480_orderdetails` (`id`, `params`, `qty`, `item_des`, `orders_fk`) VALUES (1,'',1,'Ordered item 1',1),(2,'',4,'ordered item 2',1),(3,'',2,'Ordered item 3',2),(4,'',7,'ordered item 4',2),(5,'',345,'ordered item 7',0);

THIS TIME THE ERROR IS AGAINST THE PARENT TABLE

*****IT IS THE ALIASES and how they are updated when changed*****
*****IT CAN EFFECT BOTH PARENT AND CHILDREN TABLES*******

CAUSES DATA LOSS ON RESTORE DATA IF...
if you change the table alias and then save (dont use refresh alias button see below)

Here is an example
the default alias values were used that reflected the table name
- data entry,backup and restore operations are confirmed to work properly
- Default values DO NOT cause data loss

but here is how i can get it to loose data
I just added "alias" to the end of the default table and item aliases
- you could change it to "anythingyoulike" and it would still fail

Collection Items Entry point (view)

Table title :Orders............................Item title : Orders item........................Is Front-end default: yes
Table alias : ordersalias...................Item alias : ordersitemalias................Is Back-end default: yes


IT DOES NOT CAUSE THE ISSUE OF DATA LOSS IF...
* if you change the table alias through the refresh - auto complete alias button
Last Edit: 12 Feb 2012 23:35 by BTB300.
The administrator has disabled public write access.

Re: [SOLVED] Data lost I CAN DUPLICATE PROBLEM 13 Feb 2012 16:05 #1278

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Duplicate entries should not raise anymore, but for the rest, still inquiring.

I tried the test you did and do not fail.

Sometime is strange.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: [SOLVED] Data lost I CAN DUPLICATE PROBLEM 14 Feb 2012 16:54 #1309

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 415
  • Thank you received: 132
  • Karma: 47
also noticed If you change the table name in the left column it doesn't change the Table title in the item table on the right hand tab, BUT if you change the table title in the right hand tab it will change the table name in the left hand column. changing the table title in the right tab using the auto generate button also puts an "s" on the end of your table if your table name in the left hand column is a singular name

Have seen this cause some data issues as well especially when working with an existing table that had a singular name could not figure out why I lost a link until I found the extra "s" on the end of the table that should not have been there


Hope this helps
Last Edit: 14 Feb 2012 16:57 by BTB300.
The administrator has disabled public write access.
Time to create page: 0.075 seconds

Get Started