diff --git a/app.rb b/app.rb index 21dc6590..6175a3f6 100644 --- a/app.rb +++ b/app.rb @@ -279,7 +279,7 @@ post '/site_files/upload' do current_site.update site_changed: true end - current_site.update updated_at: Time.now + current_site.update changed_count: 1+current_site.changed_count, updated_at: Time.now flash[:success] = "Successfully uploaded file #{sanitized_filename}." redirect '/dashboard' @@ -349,7 +349,7 @@ post '/site_files/save/:filename' do |filename| current_site.update site_changed: true end - current_site.update updated_at: Time.now + current_site.update changed_count: 1+current_site.changed_count, updated_at: Time.now 'ok' end diff --git a/migrations/016_site_updated_count.rb b/migrations/016_site_updated_count.rb new file mode 100644 index 00000000..4ba7c0bb --- /dev/null +++ b/migrations/016_site_updated_count.rb @@ -0,0 +1,11 @@ +Sequel.migration do + up { + DB.add_column :sites, :changed_count, :integer, default: 0 + DB.add_index :sites, :changed_count + } + + down { + DB.drop_column :sites, :changed_count + DB.drop_index :sites, :changed_count + } +end \ No newline at end of file