Remove old and unused migrations. #1

This commit is contained in:
David Sedeño 2023-10-19 20:17:11 +02:00
parent b39ad619c5
commit f56551dddf
7 changed files with 0 additions and 170 deletions

View file

@ -1,14 +0,0 @@
# frozen_string_literal: true
class CreateTargets < ActiveRecord::Migration
def change
create_table :targets do |t|
t.integer :conference_id
t.integer :campaign_id
t.date :due_date
t.integer :target_count
t.string :unit
t.timestamps
end
end
end

View file

@ -1,52 +0,0 @@
# frozen_string_literal: true
class CreateVisits < ActiveRecord::Migration
def change
create_table :visits do |t|
t.uuid :visitor_id
# the rest are recommended but optional
# simply remove the columns you don't want
# standard
t.string :ip
t.text :user_agent
t.text :referrer
t.text :landing_page
# user
t.integer :user_id
# add t.string :user_type if polymorphic
# traffic source
t.string :referring_domain
t.string :search_keyword
# technology
t.string :browser
t.string :os
t.string :device_type
# location
t.string :country
t.string :region
t.string :city
# utm parameters
t.string :utm_source
t.string :utm_medium
t.string :utm_term
t.string :utm_content
t.string :utm_campaign
# native apps
# t.string :platform
# t.string :app_version
# t.string :os_version
t.timestamp :started_at
end
add_index :visits, [:user_id]
end
end

View file

@ -1,19 +0,0 @@
# frozen_string_literal: true
class CreateAhoyEvents < ActiveRecord::Migration
def change
create_table :ahoy_events do |t|
t.uuid :visit_id
# user
t.integer :user_id
# add t.string :user_type if polymorphic
t.string :name
t.text :properties
t.timestamp :time
end
add_index :ahoy_events, :visit_id
add_index :ahoy_events, :user_id
add_index :ahoy_events, :time
end
end

View file

@ -1,52 +0,0 @@
# frozen_string_literal: true
class UndoWrongMigration20140801080705AddUsersToEvents < ActiveRecord::Migration
class TempEvent < ActiveRecord::Base
self.table_name = 'events'
end
class TempUser < ActiveRecord::Base
self.table_name = 'users'
end
class TempEventUser < ActiveRecord::Base
self.table_name = 'event_users'
belongs_to :temp_event
belongs_to :temp_user
end
class Version < ActiveRecord::Base
self.table_name = 'versions'
end
def up
if ActiveRecord::Migrator.get_all_versions.include? 20140801080705
user_deleted = TempUser.find_by(email: 'deleted@localhost.osem')
TempEvent.all.each do |event|
whodunnit = Version.find_by(item_type: 'Event', item_id: event.id, event: 'create').whodunnit
original_user = TempUser.find_by(id: whodunnit)
if original_user.blank?
original_submitter = user_deleted
else
original_submitter = original_user
end
# Substitute submitter record
submitter = TempEventUser.find_by(event_id: event.id, event_role: 'submitter')
submitter.user_id = original_submitter.id
submitter.save!
# Substitute speaker record
speaker = TempEventUser.find_by(event_id: event.id, event_role: 'speaker')
speaker.user_id = original_submitter.id
speaker.save!
end
end
end
def down
raise ActiveRecord::IrreversibleMigration.new('Cannot reverse migration.')
end
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
class ChangeVisitIdTypeOfAhoyEventsToInteger < ActiveRecord::Migration[5.0]
def change
change_column :ahoy_events, :visit_id, :integer, limit: nil
end
end

View file

@ -1,11 +0,0 @@
# frozen_string_literal: true
class CreateAhoyVisitsAndEvents < ActiveRecord::Migration[5.0]
def change
add_column :visits, :visit_token, :string
add_column :visits, :visitor_token, :string
add_index :visits, [:visit_token], unique: true
add_index :ahoy_events, [:name, :time]
end
end

View file

@ -1,15 +0,0 @@
class DropAhoyEvents < ActiveRecord::Migration[5.0]
def up
remove_index :visits, [:visit_token]
remove_index :ahoy_events, [:name, :time]
drop_table :targets
drop_table :campaigns
drop_table :visits
drop_table :ahoy_events
end
def down
raise ActiveRecord::IrreversibleMigration
end
end