Index: /branches/release-33/lib/MT/Upgrade.pm
===================================================================
--- /branches/release-33/lib/MT/Upgrade.pm (revision 1583)
+++ /branches/release-33/lib/MT/Upgrade.pm (revision 1731)
@@ -548,4 +548,9 @@
             priority => 5.1,
         },
+        'core_migrate_commenter_auth' => {
+            code => \&migrate_commenter_auth,
+            version_limit => 3.3101,
+            priority => 3.1,
+        },
         'core_deprecate_bitmask_permissions' => {
             code => \&deprecate_bitmask_permissions,
@@ -557,9 +562,4 @@
             version_limit => 4.0002,
             priority => 3.3,
-        },
-        'core_migrate_commenter_auth' => {
-            code => \&migrate_commenter_auth,
-            version_limit => 3.3101,
-            priority => 3.1,
         },
         'core_populate_authored_on' => {
@@ -689,4 +689,8 @@
                 type => 'author',
                 label => 'Adding new feature widget to dashboard...',
+                condition => sub {
+                    my ($user) = @_;
+                    $user->type == MT::Author::AUTHOR(); # AUTHOR records only
+                },
                 code => sub {
                     my ($user) = @_;
@@ -703,5 +707,4 @@
                     }
                     $user->widgets($widget_store);
-                    $user->save;
                 },
             },
@@ -775,5 +778,4 @@
                     }
                     $blog->page_layout($layout);
-                    $blog->save;
                 },
             },
@@ -792,5 +794,4 @@
                     my $basename = MT::Util::make_unique_author_basename($author);
                     $author->basename($basename);
-                    $author->save;
                 },
             },
@@ -806,5 +807,5 @@
             updater       => {
                 type      => 'entry',
-                label     => 'Assigning entry comment and trackback count...',
+                label     => 'Assigning entry comment and TrackBack counts...',
                 condition => sub {
                     require MT::Comment;
@@ -834,4 +835,16 @@
                 # it doesn't have the unnecessary save.
                 code => sub { 1; },
+            },
+        },
+        'core_assign_object_embedded' => {
+            version_limit => 4.0052,
+            priority => 3.2,
+            updater => {
+                type => 'objectasset',
+                label => 'Assigning embedded flag to asset placements...',
+                code => sub {
+                    $_[0]->embedded(1);
+                },
+                sql => 'update mt_objectasset set objectasset_embedded=1',
             },
         },
Index: /branches/release-33/lib/MT/ObjectAsset.pm
===================================================================
--- /branches/release-33/lib/MT/ObjectAsset.pm (revision 1523)
+++ /branches/release-33/lib/MT/ObjectAsset.pm (revision 1731)
@@ -18,10 +18,14 @@
         object_ds => 'string(50) not null',
         asset_id => 'integer not null',
+        embedded => 'boolean',
     },
     indexes => {
-        blog_id => 1,
-        object_id => 1,
+        blog_obj => {
+            columns => ['blog_id', 'object_ds', 'object_id'],
+        },
         asset_id => 1,
-        object_ds => 1,
+    },
+    defaults => {
+        embedded => 0,
     },
     child_of => 'MT::Blog',
Index: /branches/release-33/lib/MT/Entry.pm
===================================================================
--- /branches/release-33/lib/MT/Entry.pm (revision 1618)
+++ /branches/release-33/lib/MT/Entry.pm (revision 1731)
@@ -622,5 +622,6 @@
         object_id => $entry->id,
         blog_id => $entry->blog_id,
-        object_ds => $entry->datasource
+        object_ds => $entry->datasource,
+        embedded => 1,
     });
     my %assets = map { $_->asset_id => $_->id } @assets;
@@ -629,11 +630,11 @@
         my $innards = $2;
 
-        # is asset exists?
-        my $asset = MT->model('asset')->load({ id => $id }) or next;
-
         # reference to an existing asset...
         if (exists $assets{$id}) {
             $assets{$id} = 0;
         } else {
+            # is asset exists?
+            my $asset = MT->model('asset')->load({ id => $id }) or next;
+
             my $map = new MT::ObjectAsset;
             $map->blog_id($entry->blog_id);
@@ -641,4 +642,5 @@
             $map->object_ds($entry->datasource);
             $map->object_id($entry->id);
+            $map->embedded(1);
             $map->save;
             $assets{$id} = 0;
@@ -646,6 +648,7 @@
     }
     if (my @old_maps = grep { $assets{$_->asset_id} } @assets) {
-        my @old_ids = map { $_->id } @old_maps;
-        MT::ObjectAsset->remove( { id => \@old_ids });
+        my @old_ids = map { $_->id } grep { $_->embedded } @old_maps;
+        MT::ObjectAsset->remove( { id => \@old_ids })
+            if @old_ids;
     }
     return 1;
Index: /branches/release-33/build/mt-dists/default.mk
===================================================================
--- /branches/release-33/build/mt-dists/default.mk (revision 1722)
+++ /branches/release-33/build/mt-dists/default.mk (revision 1731)
@@ -2,5 +2,5 @@
 
 PRODUCT_VERSION = 4.15
-SCHEMA_VERSION = 4.0051
+SCHEMA_VERSION = 4.0052
 API_VERSION = 4.15
 
