Skip to content

Instantly share code, notes, and snippets.

@aaronschachter
Last active August 29, 2015 13:56
Show Gist options
  • Save aaronschachter/9291760 to your computer and use it in GitHub Desktop.
Save aaronschachter/9291760 to your computer and use it in GitHub Desktop.
Partners funtime
Deleted field_partners field
Cleared cache
SELECT *
FROM field_collection_item
WHERE field_name='field_partners'
52 rows
SELECT * FROM field_collection_item_revision rev
JOIN field_collection_item item on item.item_id = rev.item_id
WHERE field_name='field_partners'
142 rows
SELECT * FROM field_config
WHERE field_name='field_partners'
2 rows
SELECT * FROM field_config_instance
WHERE field_name='field_partners'
2 rows
Doing features-revert with dosomething_campaign and dosomething_taxonomy with missing field_partners stuff.
After features-revert, all queries return the same # of results.
DELETE FROM field_config
WHERE field_name='field_partners';
2 rows deleted
DELETE FROM field_config_instance
WHERE field_name='field_partners';
2 rows deleted
drush cc all
DELETE FROM
field_collection_item_revision
WHERE item_id IN (
SELECT item_id FROM field_collection_item WHERE field_name='field_partners'
)
142 rows deleted
DELETE FROM
field_collection_item
WHERE field_name = 'field_partners'
52 rows deleted
drush cc all
Warning: Unknown: GC cache entry '/vagrant/html/modules/file/file.install' (dev=21 ino=40985) was on gc-list for 3871 seconds in Unknown on line 0 Warning: Unknown: GC cache entry '/vagrant/html/modules/image/image.install' (dev=21 ino=69196) was on gc-list for 3871 seconds in Unknown on line 0 Warning: Unknown: GC cache entry '/vagrant/html/modules/taxonomy/taxonomy.install' (dev=21 ino=69161) was on gc-list for 3871 seconds in Unknown on line 0 Warning: Unknown: GC cache entry '/vagrant/html/modules/field/modules/text/text.install' (dev=21 ino=69099) was on gc-list for 3871 seconds in Unknown on line 0 Warning: Unknown: GC cache entry '/vagrant/html/includes/database/mysql/schema.inc' (dev=21 ino=40221) was on gc-list for 3871 seconds in Unknown on line 0 Warning: Unknown: GC cache entry '/vagrant/html/includes/database/schema.inc' (dev=21 ino=40203) was on gc-list for 3871 seconds in Unknown on line 0 Warning: Unknown: GC cache entry '/vagrant/html/includes/install.inc' (dev=21 ino=40192) was on gc-list for 3871 seconds in Unknown on line 0
What is GC cache?
Also note that here http://drupal.stackexchange.com/questions/46085/programatically-remove-a-field-from-a-node
While calling field_delete_field() and field_purge_batch() works, it keeps records in field_config_instance and field_config. Why is that? – berkes Oct 9 '12 at 13:46
Running
SELECT TABLE_SCHEMA, TABLE_NAME
FROM information_schema.tables
WHERE TABLE_NAME LIKE '%deleted%'
returns 5 tables.
@aaronschachter
Copy link
Author

new pull from stage, on the remove_partners branch. Has both partners and partners_fc tables. maybe reverting and just trying to remove the thing will work (not trying to add partners_fc like in the partners_fix branch)

drush -y fra
The following modules will be reverted: dosomething_taxonomy, dosomething_image, dosomething_campaign, dosomething_static_content
Do you really want to continue? (y/n): y
Reverted dosomething_taxonomy.user_permission. [ok]
Reverted dosomething_image.image. [ok]
Reverted dosomething_campaign.variable. [ok]
Reverted dosomething_static_content.user_permission. [ok]
Reverted dosomething_static_content.variable. [ok]
vagrant@dev:/vagrant/html$

Ok that looks promising

Refreshing tables. still have field_partners and field_partners_fc and all 10 tables

Lets go for the gold here and try to drush field-delete field_partners

vagrant@dev:/vagrant/html$ drush field-delete field_partners
Do you want to delete the field_partners field? (y/n): y
WD php: DatabaseSchemaObjectExistsException: Cannot rename [error]
field_data_field_partners to field_deleted_data_87: table field_deleted_data_87
already exists. in DatabaseSchema_mysql->renameTable() (line 307 of
/vagrant/html/includes/database/mysql/schema.inc).
Cannot modify header information - headers already sent by (output started at [warning]
/opt/drush-6.2.0/includes/output.inc:38) bootstrap.inc:1217
DatabaseSchemaObjectExistsException: Cannot rename field_data_field_partners to field_deleted_data_87: table field_deleted_data_87 already exists. in DatabaseSchema_mysql->renameTable() (line 307 of /vagrant/html/includes/database/mysql/schema.inc).
Drush command terminated abnormally due to an unrecoverable error.

Ok. So that's the kicker. It looks like Features is taking care of the deletion, yet its not actually changing the field_partners table name to field_deleted whatever. So.. to research, is this a feature things or a field collection thing?

@aaronschachter
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment