Archive: ComponentOwl Rails app, DB backups, go redirect script
This commit is contained in:
332
db/migrate/20090713163655_initial_migration.rb
Normal file
332
db/migrate/20090713163655_initial_migration.rb
Normal file
@@ -0,0 +1,332 @@
|
||||
class InitialMigration < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :users do |t|
|
||||
t.string :first_name
|
||||
t.string :last_name
|
||||
t.string :login, :null => false
|
||||
t.string :email, :null => false
|
||||
t.string :crypted_password, :null => false
|
||||
t.string :password_salt, :null => false
|
||||
t.string :persistence_token, :null => false
|
||||
t.string :single_access_token, :null => false
|
||||
t.string :perishable_token, :null => false
|
||||
|
||||
t.integer :login_count, :null => false, :default => 0
|
||||
t.integer :failed_login_count, :null => false, :default => 0
|
||||
t.datetime :last_request_at
|
||||
t.datetime :current_login_at
|
||||
t.datetime :last_login_at
|
||||
t.string :current_login_ip
|
||||
t.string :last_login_ip
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :allowed_values do |t|
|
||||
t.string :type
|
||||
t.string :code
|
||||
t.string :value
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :product_categories do |t|
|
||||
t.string :code
|
||||
t.string :name
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
add_index(:product_categories, :code, :unique => true)
|
||||
|
||||
create_table :products do |t|
|
||||
t.integer :product_category_id
|
||||
t.string :code
|
||||
t.string :internal_code
|
||||
t.string :file
|
||||
t.string :name
|
||||
t.string :label
|
||||
t.boolean :promoted, :default => false
|
||||
t.boolean :homepage, :default => false
|
||||
t.decimal :price, :scale => 2, :precision => 10
|
||||
t.decimal :regular_price, :scale => 2, :precision => 10
|
||||
t.integer :bmtID
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
add_index(:products, :code, :unique => true)
|
||||
add_index(:products, :internal_code, :unique => true)
|
||||
|
||||
create_table :products_promotions, :id => false, :primary_key => [:product_id, :promotion_id] do |t|
|
||||
t.integer :product_id
|
||||
t.integer :promotion_id, :references => :allowed_values
|
||||
end
|
||||
|
||||
create_table :product_descriptions do |t|
|
||||
t.integer :product_description_type_id, :references => :allowed_values
|
||||
t.integer :product_id
|
||||
t.string :title
|
||||
t.text :value
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :product_pages do |t|
|
||||
t.integer :parent_id, :references => :product_pages
|
||||
t.integer :product_id
|
||||
t.boolean :tab, :default => false
|
||||
t.string :code
|
||||
t.string :name
|
||||
t.text :html
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :product_offers do |t|
|
||||
t.integer :product_id
|
||||
t.integer :related_product_id, :references => :products
|
||||
t.integer :bmtID
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.decimal :price, :scale => 2, :precision => 10
|
||||
t.datetime :begins_at
|
||||
t.datetime :expires_at
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :product_editions do |t|
|
||||
t.integer :product_id
|
||||
t.string :code
|
||||
t.string :internal_code
|
||||
t.integer :bmtID
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.decimal :price, :scale => 2, :precision => 10
|
||||
t.decimal :regular_price, :scale => 2, :precision => 10
|
||||
t.boolean :initial, :default => false
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index(:product_editions, :internal_code, :unique => true)
|
||||
|
||||
create_table :product_discounts do |t|
|
||||
t.integer :product_id
|
||||
t.integer :product_edition_id
|
||||
t.string :discount_type
|
||||
t.string :discount_code
|
||||
t.decimal :price, :scale => 2, :precision => 10
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :product_upgrades do |t|
|
||||
t.integer :product_id
|
||||
t.integer :product_edition_id
|
||||
t.string :upgrade_type
|
||||
t.string :bmtID
|
||||
t.decimal :price, :scale => 2, :precision => 10
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :product_url_params do |t|
|
||||
t.integer :product_id
|
||||
t.integer :url_destination_id, :references => :allowed_values
|
||||
t.string :url_param
|
||||
t.boolean :default, :default => false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :releases do |t|
|
||||
t.integer :product_id
|
||||
t.string :version
|
||||
t.integer :build
|
||||
t.text :description
|
||||
t.text :changelog
|
||||
t.date :date
|
||||
t.datetime :postpone_till
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :testimonials do |t|
|
||||
t.integer :product_id
|
||||
t.text :text
|
||||
t.string :author
|
||||
t.boolean :hidden, :default => false
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :testimonial_positions do |t|
|
||||
t.integer :testimonial_id
|
||||
t.integer :testimonial_location_id, :references => :allowed_values
|
||||
t.integer :product_id
|
||||
t.text :extract
|
||||
t.integer :position
|
||||
end
|
||||
|
||||
create_table :product_images do |t|
|
||||
t.integer :product_id
|
||||
t.string :image
|
||||
t.string :alt
|
||||
t.string :label
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :screenshots do |t|
|
||||
t.integer :product_id
|
||||
t.string :image
|
||||
t.string :alt
|
||||
t.string :label
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :product_icons do |t|
|
||||
t.integer :product_id
|
||||
t.string :icon
|
||||
t.integer :size
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :latests do |t|
|
||||
t.string :title
|
||||
t.string :link
|
||||
t.text :body
|
||||
t.date :date
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :faq_categories do |t|
|
||||
t.integer :product_id
|
||||
t.string :url_param
|
||||
t.string :name
|
||||
t.string :description
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :faqs do |t|
|
||||
t.integer :faq_category_id
|
||||
t.string :url_param
|
||||
t.text :question
|
||||
t.text :answer
|
||||
t.boolean :featured, :default => false
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :support_requests do |t|
|
||||
t.integer :support_request_origin_id, :references => :allowed_values
|
||||
t.string :name
|
||||
t.string :email
|
||||
t.integer :product_id
|
||||
t.string :subject
|
||||
t.text :message
|
||||
t.boolean :mail_sent, :default => false
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :volume_discounts do |t|
|
||||
t.integer :from
|
||||
t.integer :to
|
||||
t.integer :discount
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :download_logs do |t|
|
||||
t.integer :product_id
|
||||
t.text :request
|
||||
t.timestamp :created_at
|
||||
end
|
||||
|
||||
create_table :meta_tags do |t|
|
||||
t.string :path
|
||||
t.string :title
|
||||
t.text :keywords
|
||||
t.text :description
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :sitemap_titles do |t|
|
||||
t.string :path
|
||||
t.string :title
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :static_pages do |t|
|
||||
t.string :code
|
||||
t.string :url_param
|
||||
t.string :name
|
||||
t.text :html
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
add_index(:static_pages, :code, :unique => true)
|
||||
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :static_pages
|
||||
drop_table :sitemap_titles
|
||||
drop_table :meta_tags
|
||||
drop_table :download_logs
|
||||
drop_table :volume_discounts
|
||||
drop_table :support_requests
|
||||
drop_table :faqs
|
||||
drop_table :faq_categories
|
||||
drop_table :latests
|
||||
drop_table :product_icons
|
||||
drop_table :product_screenshots
|
||||
drop_table :product_images
|
||||
drop_table :testimonial_positions
|
||||
drop_table :testimonials
|
||||
drop_table :releases
|
||||
drop_table :product_url_params
|
||||
drop_table :product_upgrades
|
||||
drop_table :product_discounts
|
||||
drop_table :product_editions
|
||||
drop_table :product_offers
|
||||
drop_table :product_pages
|
||||
drop_table :product_descriptions
|
||||
drop_table :products_promotions
|
||||
drop_table :products
|
||||
drop_table :product_categories
|
||||
drop_table :allowed_values
|
||||
drop_table :users
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddInternalCodeToProductOffer < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :product_offers, :internal_code, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :product_offers, :internal_code
|
||||
end
|
||||
end
|
||||
15
db/migrate/20100524184938_create_page_includes.rb
Normal file
15
db/migrate/20100524184938_create_page_includes.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class CreatePageIncludes < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :page_includes do |t|
|
||||
t.string :path
|
||||
t.string :description
|
||||
t.text :inklude
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :page_includes
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
class ChangeProductUpgradesRelationships < ActiveRecord::Migration
|
||||
def self.up
|
||||
change_table :product_upgrades do |t|
|
||||
t.remove :product_id
|
||||
t.integer :upgradable_id, :references => nil
|
||||
t.integer :upgradable_to_id, :references => nil
|
||||
t.string :upgradable_type, :default => 'ProductEdition'
|
||||
t.string :upgradable_to_type
|
||||
end
|
||||
ProductUpgrade.update_all(["upgradable_id = product_edition_id"])
|
||||
remove_column :product_upgrades, :product_edition_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
end
|
||||
end
|
||||
59
db/migrate/20100629062929_add_newsletter_engine.rb
Normal file
59
db/migrate/20100629062929_add_newsletter_engine.rb
Normal file
@@ -0,0 +1,59 @@
|
||||
class AddNewsletterEngine < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
||||
create_table :newsletter_allowed_values do |t|
|
||||
t.string :type
|
||||
t.string :code
|
||||
t.string :value
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :contacts do |t|
|
||||
t.string :email
|
||||
t.string :first_name
|
||||
t.string :last_name
|
||||
t.string :country
|
||||
|
||||
t.integer :active_subscriptions, :default => 0
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :subscription_lists do |t|
|
||||
t.integer :subscription_list_type_id, :references => :newsletter_allowed_values
|
||||
t.integer :product_id
|
||||
t.string :name
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :subscriptions do |t|
|
||||
t.integer :subscription_list_id
|
||||
t.integer :contact_id
|
||||
t.datetime :started_at
|
||||
t.datetime :ended_at
|
||||
t.boolean :active, :default => true
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :subscription_list_types_subscription_locations, :id => false, :primary_key => [:subscription_list_type_id, :subscription_location_id] do |t|
|
||||
t.integer :subscription_list_type_id, :references => :newsletter_allowed_values
|
||||
t.integer :subscription_location_id, :references => :newsletter_allowed_values
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :subscription_list_types_subscription_locations
|
||||
drop_table :subscriptions
|
||||
drop_table :subscription_lists
|
||||
drop_table :contacts
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddLocationToSubscription < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :subscriptions, :subscription_location_id, :integer, :references => :newsletter_allowed_values
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :subscriptions, :subscription_location_id
|
||||
end
|
||||
end
|
||||
39
db/migrate/20100728060310_upload_column_to_paperclip.rb
Normal file
39
db/migrate/20100728060310_upload_column_to_paperclip.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
class UploadColumnToPaperclip < ActiveRecord::Migration
|
||||
include UploadColumnMigration
|
||||
|
||||
def self.up
|
||||
|
||||
add_paperclip_fields :products, :setup_file
|
||||
Product.reset_column_information
|
||||
Product.all.each do |product|
|
||||
populate_paperclip_from_upload_column(product, File.join(Rails.root, "public", "files", "downloads"), product[:file], 'setup_file')
|
||||
end
|
||||
|
||||
add_paperclip_fields :product_icons, :icon
|
||||
ProductIcon.reset_column_information
|
||||
ProductIcon.all.each do |icon|
|
||||
ext = icon[:icon].split(".").last
|
||||
populate_paperclip_from_upload_column(icon, File.join(Rails.root, "public", "files", "icons"), "#{icon.product.code}_#{icon.size}.#{ext}", 'icon')
|
||||
end
|
||||
|
||||
add_paperclip_fields :screenshots, :image
|
||||
Screenshot.reset_column_information
|
||||
Screenshot.all.each do |screenshot|
|
||||
populate_paperclip_from_upload_column(screenshot, File.join(Rails.root, "public", "files", "images"), screenshot[:image], 'image')
|
||||
end
|
||||
|
||||
add_paperclip_fields :product_images, :image
|
||||
ProductImage.reset_column_information
|
||||
ProductImage.all.each do |product_image|
|
||||
populate_paperclip_from_upload_column(product_image, File.join(Rails.root, "public", "files", "images"), product_image[:image], 'image')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_paperclip_fields :products, :setup_file
|
||||
remove_paperclip_fields :product_icons, :icon
|
||||
remove_paperclip_fields :screenshots, :image
|
||||
remove_paperclip_fields :product_images, :image
|
||||
end
|
||||
end
|
||||
18
db/migrate/20100808085226_setup_files_to_cloud_front.rb
Normal file
18
db/migrate/20100808085226_setup_files_to_cloud_front.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class SetupFilesToCloudFront < ActiveRecord::Migration
|
||||
|
||||
include UploadColumnMigration
|
||||
|
||||
def self.up
|
||||
setup_files_path = File.join(Rails.root, "public", "system", "setup_files")
|
||||
puts "Uploading setup files to CloudFront... (this may take a while)"
|
||||
Product.all.each do |product|
|
||||
if product.setup_file.instance_variable_get(:@storage).to_s == 's3' && product.setup_file.file?
|
||||
puts "Uploading #{product.setup_file.original_filename}..."
|
||||
upload_to_s3(product.setup_file, File.join(setup_files_path, product.id.to_s, product.setup_file.original_filename), product.setup_file.path(:original))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
end
|
||||
end
|
||||
22
db/migrate/20100818082747_create_pad_values.rb
Normal file
22
db/migrate/20100818082747_create_pad_values.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class CreatePadValues < ActiveRecord::Migration
|
||||
include PadImport
|
||||
|
||||
def self.up
|
||||
create_table :pad_values do |t|
|
||||
t.integer :product_id, :references => :products
|
||||
t.string :key
|
||||
t.text :value
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
puts "Migrating existing PAD files to database..."
|
||||
Product.all.each do |product|
|
||||
import_pad(product) if product.setup_file.file?
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :pad_values
|
||||
end
|
||||
end
|
||||
23
db/migrate/20100819135437_create_articles.rb
Normal file
23
db/migrate/20100819135437_create_articles.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
class CreateArticles < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :articles do |t|
|
||||
t.string :title, :null => false
|
||||
t.string :slug, :null => false
|
||||
t.text :content, :null => false
|
||||
t.date :date, :null => false
|
||||
t.string :status, :default => 'draft'
|
||||
t.string :keywords
|
||||
t.text :custom_subtemplate
|
||||
t.integer :screenshot_id
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
add_index(:articles, :slug, :unique => true)
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :articles
|
||||
end
|
||||
end
|
||||
15
db/migrate/20100819140017_create_subtemplates.rb
Normal file
15
db/migrate/20100819140017_create_subtemplates.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class CreateSubtemplates < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :subtemplates do |t|
|
||||
t.integer :subtemplate_type_id, :references => :allowed_values
|
||||
t.string :name
|
||||
t.text :content
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :subtemplates
|
||||
end
|
||||
end
|
||||
9
db/migrate/20101010101010_add_announce_to_release.rb
Normal file
9
db/migrate/20101010101010_add_announce_to_release.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class AddAnnounceToRelease < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :releases, :announce, :boolean, :default => true
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :releases, :announce
|
||||
end
|
||||
end
|
||||
74
db/migrate/20101010145127_customer_tracking.rb
Normal file
74
db/migrate/20101010145127_customer_tracking.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class CustomerTracking < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :customers do |t|
|
||||
t.string :first_name
|
||||
t.string :last_name
|
||||
t.string :email
|
||||
t.string :company
|
||||
t.text :customer_attributes
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :orders do |t|
|
||||
t.integer :customer_id
|
||||
t.integer :orderable_id, :references => nil
|
||||
t.string :orderable_type
|
||||
t.text :license_key
|
||||
t.text :order_attributes
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :visitors do |t|
|
||||
t.string :trackable_number
|
||||
t.string :user_agent
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :customers_visitors, :id => false, :primary_key => [:customer_id, :visitor_id] do |t|
|
||||
t.integer :customer_id
|
||||
t.integer :visitor_id
|
||||
end
|
||||
|
||||
create_table :visitor_tracks do |t|
|
||||
t.integer :visitor_id
|
||||
t.text :track
|
||||
t.integer :trackable_id, :references => nil
|
||||
t.string :trackable_type
|
||||
t.integer :source_type_id, :references => :allowed_values
|
||||
t.string :source
|
||||
t.string :url
|
||||
t.string :keywords
|
||||
t.string :targetable
|
||||
t.boolean :download, :default => false
|
||||
t.boolean :checkout, :default => false
|
||||
t.boolean :order, :default => false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
|
||||
create_table :redirects do |t|
|
||||
t.integer :source_type_id, :references => :allowed_values
|
||||
t.string :name
|
||||
t.string :redirect_path, :null => false
|
||||
t.string :redirect_to, :null => false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :customers
|
||||
drop_table :orders
|
||||
drop_table :visitors
|
||||
drop_table :customers_visitors
|
||||
drop_table :visitor_tracks
|
||||
drop_table :redirects
|
||||
end
|
||||
end
|
||||
24
db/migrate/20101102185849_create_autoresponders.rb
Normal file
24
db/migrate/20101102185849_create_autoresponders.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
class CreateAutoresponders < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :autoresponders do |t|
|
||||
t.integer :subscription_list_id, :null => false
|
||||
t.string :subject, :null => false
|
||||
t.text :message, :null => false
|
||||
t.integer :delay, :default => 0
|
||||
|
||||
t.timestamps
|
||||
t.datetime :deleted_at
|
||||
end
|
||||
|
||||
create_table :sent_autoresponders do |t|
|
||||
t.integer :autoresponder_id, :null => false
|
||||
t.integer :contact_id, :null => false
|
||||
t.datetime :sent_at
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :autoresponders
|
||||
drop_table :sent_autoresponders
|
||||
end
|
||||
end
|
||||
15
db/migrate/20101103125852_create_emails.rb
Normal file
15
db/migrate/20101103125852_create_emails.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class CreateEmails < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :emails do |t|
|
||||
t.column :from, :string
|
||||
t.column :to, :string
|
||||
t.column :last_send_attempt, :integer, :default => 0
|
||||
t.column :mail, :text
|
||||
t.column :created_on, :datetime
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :emails
|
||||
end
|
||||
end
|
||||
13
db/migrate/20101103181314_create_site_settings.rb
Normal file
13
db/migrate/20101103181314_create_site_settings.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateSiteSettings < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :site_settings do |t|
|
||||
t.text :settings
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :site_settings
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddExcludeFromAutoupdateToReleases < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :releases, :exclude_from_autoupdate, :boolean, :default => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :releases, :exclude_from_autoupdate
|
||||
end
|
||||
end
|
||||
16
db/migrate/20101203131634_create_activations.rb
Normal file
16
db/migrate/20101203131634_create_activations.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreateActivations < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :activations do |t|
|
||||
t.integer :order_id, :null => false
|
||||
t.integer :build, :null => false
|
||||
t.string :computer_id, :null => false, :references => nil
|
||||
t.string :product
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :activations
|
||||
end
|
||||
end
|
||||
13
db/migrate/20101207141645_add_attributes_to_activations.rb
Normal file
13
db/migrate/20101207141645_add_attributes_to_activations.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class AddAttributesToActivations < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :activations, :serial_key, :string
|
||||
add_column :activations, :ip, :string
|
||||
add_column :activations, :final_judgement, :text
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :activations, :serial_key
|
||||
remove_column :activations, :ip
|
||||
remove_column :activations, :final_judgement
|
||||
end
|
||||
end
|
||||
19
db/migrate/20101207170801_create_failed_activations.rb
Normal file
19
db/migrate/20101207170801_create_failed_activations.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CreateFailedActivations < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :failed_activations do |t|
|
||||
t.string :serial_key
|
||||
t.integer :build
|
||||
t.string :computer_id, :references => nil
|
||||
t.string :product
|
||||
t.string :ip
|
||||
t.string :result
|
||||
t.text :final_judgement
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :failed_activations
|
||||
end
|
||||
end
|
||||
19
db/migrate/20110730141514_create_comics.rb
Normal file
19
db/migrate/20110730141514_create_comics.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CreateComics < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :comics do |t|
|
||||
t.date :publish_on, :null => false
|
||||
t.string :image_file_name, :null => false
|
||||
t.string :image_content_type
|
||||
t.integer :image_file_size
|
||||
t.datetime :image_updated_at
|
||||
t.string :name
|
||||
t.text :story
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :comics
|
||||
end
|
||||
end
|
||||
16
db/migrate/20110802100859_add_number_to_comics.rb
Normal file
16
db/migrate/20110802100859_add_number_to_comics.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class AddNumberToComics < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :comics, :number, :integer, :null => false
|
||||
|
||||
number = 1
|
||||
Comic.ordered.each do |comic|
|
||||
comic.number = number
|
||||
comic.save
|
||||
number += 1
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :comics, :number
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user