diff options
Diffstat (limited to 'db/migrate')
30 files changed, 478 insertions, 0 deletions
| diff --git a/db/migrate/20180707142415_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20180707142415_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..461eae4 --- /dev/null +++ b/db/migrate/20180707142415_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 1) | ||
| 2 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
| 3 | class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2]; end | ||
| 4 | else | ||
| 5 | class ActsAsTaggableOnMigration < ActiveRecord::Migration; end | ||
| 6 | end | ||
| 7 | ActsAsTaggableOnMigration.class_eval do | ||
| 8 | def self.up | ||
| 9 | create_table :tags do |t| | ||
| 10 | t.string :name | ||
| 11 | end | ||
| 12 | |||
| 13 | create_table :taggings do |t| | ||
| 14 | t.references :tag | ||
| 15 | |||
| 16 | # You should make sure that the column created is | ||
| 17 | # long enough to store the required class names. | ||
| 18 | t.references :taggable, polymorphic: true | ||
| 19 | t.references :tagger, polymorphic: true | ||
| 20 | |||
| 21 | # Limit is created to prevent MySQL error on index | ||
| 22 | # length for MyISAM table type: http://bit.ly/vgW2Ql | ||
| 23 | t.string :context, limit: 128 | ||
| 24 | |||
| 25 | t.datetime :created_at | ||
| 26 | end | ||
| 27 | |||
| 28 | add_index :taggings, :tag_id | ||
| 29 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 30 | end | ||
| 31 | |||
| 32 | def self.down | ||
| 33 | drop_table :taggings | ||
| 34 | drop_table :tags | ||
| 35 | end | ||
| 36 | end | ||
| diff --git a/db/migrate/20180707142416_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20180707142416_add_missing_unique_indices.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..514ac57 --- /dev/null +++ b/db/migrate/20180707142416_add_missing_unique_indices.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 2) | ||
| 2 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
| 3 | class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]; end | ||
| 4 | else | ||
| 5 | class AddMissingUniqueIndices < ActiveRecord::Migration; end | ||
| 6 | end | ||
| 7 | AddMissingUniqueIndices.class_eval do | ||
| 8 | def self.up | ||
| 9 | add_index :tags, :name, unique: true | ||
| 10 | |||
| 11 | remove_index :taggings, :tag_id if index_exists?(:taggings, :tag_id) | ||
| 12 | remove_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 13 | add_index :taggings, | ||
| 14 | [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], | ||
| 15 | unique: true, name: 'taggings_idx' | ||
| 16 | end | ||
| 17 | |||
| 18 | def self.down | ||
| 19 | remove_index :tags, :name | ||
| 20 | |||
| 21 | remove_index :taggings, name: 'taggings_idx' | ||
| 22 | |||
| 23 | add_index :taggings, :tag_id unless index_exists?(:taggings, :tag_id) | ||
| 24 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 25 | end | ||
| 26 | end | ||
| diff --git a/db/migrate/20180707142417_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20180707142417_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..1d9b556 --- /dev/null +++ b/db/migrate/20180707142417_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 3) | ||
| 2 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
| 3 | class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]; end | ||
| 4 | else | ||
| 5 | class AddTaggingsCounterCacheToTags < ActiveRecord::Migration; end | ||
| 6 | end | ||
| 7 | AddTaggingsCounterCacheToTags.class_eval do | ||
| 8 | def self.up | ||
| 9 | add_column :tags, :taggings_count, :integer, default: 0 | ||
| 10 | |||
| 11 | ActsAsTaggableOn::Tag.reset_column_information | ||
| 12 | ActsAsTaggableOn::Tag.find_each do |tag| | ||
| 13 | ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) | ||
| 14 | end | ||
| 15 | end | ||
| 16 | |||
| 17 | def self.down | ||
| 18 | remove_column :tags, :taggings_count | ||
| 19 | end | ||
| 20 | end | ||
| diff --git a/db/migrate/20180707142418_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20180707142418_add_missing_taggable_index.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..5f46569 --- /dev/null +++ b/db/migrate/20180707142418_add_missing_taggable_index.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 4) | ||
| 2 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
| 3 | class AddMissingTaggableIndex < ActiveRecord::Migration[4.2]; end | ||
| 4 | else | ||
| 5 | class AddMissingTaggableIndex < ActiveRecord::Migration; end | ||
| 6 | end | ||
| 7 | AddMissingTaggableIndex.class_eval do | ||
| 8 | def self.up | ||
| 9 | add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 10 | end | ||
| 11 | |||
| 12 | def self.down | ||
| 13 | remove_index :taggings, [:taggable_id, :taggable_type, :context] | ||
| 14 | end | ||
| 15 | end | ||
| diff --git a/db/migrate/20180707142419_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20180707142419_change_collation_for_tag_names.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..f119b16 --- /dev/null +++ b/db/migrate/20180707142419_change_collation_for_tag_names.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 5) | ||
| 2 | # This migration is added to circumvent issue #623 and have special characters | ||
| 3 | # work properly | ||
| 4 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
| 5 | class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]; end | ||
| 6 | else | ||
| 7 | class ChangeCollationForTagNames < ActiveRecord::Migration; end | ||
| 8 | end | ||
| 9 | ChangeCollationForTagNames.class_eval do | ||
| 10 | def up | ||
| 11 | if ActsAsTaggableOn::Utils.using_mysql? | ||
| 12 | execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| diff --git a/db/migrate/20180707142420_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20180707142420_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..94e1f2e --- /dev/null +++ b/db/migrate/20180707142420_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | # This migration comes from acts_as_taggable_on_engine (originally 6) | ||
| 2 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') | ||
| 3 | class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end | ||
| 4 | else | ||
| 5 | class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end | ||
| 6 | end | ||
| 7 | AddMissingIndexesOnTaggings.class_eval do | ||
| 8 | def change | ||
| 9 | add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id | ||
| 10 | add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id | ||
| 11 | add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type | ||
| 12 | add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id | ||
| 13 | add_index :taggings, :context unless index_exists? :taggings, :context | ||
| 14 | |||
| 15 | unless index_exists? :taggings, [:tagger_id, :tagger_type] | ||
| 16 | add_index :taggings, [:tagger_id, :tagger_type] | ||
| 17 | end | ||
| 18 | |||
| 19 | unless index_exists? :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' | ||
| 20 | add_index :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' | ||
| 21 | end | ||
| 22 | end | ||
| 23 | end | ||
| diff --git a/db/migrate/20180811215146_create_links.rb b/db/migrate/20180811215146_create_links.rb new file mode 100644 index 0000000..0e0ca29 --- /dev/null +++ b/db/migrate/20180811215146_create_links.rb | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | class CreateLinks < ActiveRecord::Migration[5.1] | ||
| 2 | def change | ||
| 3 | create_table :links do |t| | ||
| 4 | t.string :title, null: false | ||
| 5 | t.string :url, null: false | ||
| 6 | |||
| 7 | t.timestamps | ||
| 8 | end | ||
| 9 | end | ||
| 10 | end | ||
| diff --git a/db/migrate/20190312193025_install_audited.rb b/db/migrate/20190312193025_install_audited.rb new file mode 100644 index 0000000..ef5487e --- /dev/null +++ b/db/migrate/20190312193025_install_audited.rb | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | class InstallAudited < ActiveRecord::Migration[5.2] | ||
| 2 | def self.up | ||
| 3 | create_table :audits, :force => true do |t| | ||
| 4 | t.column :auditable_id, :integer | ||
| 5 | t.column :auditable_type, :string | ||
| 6 | t.column :associated_id, :integer | ||
| 7 | t.column :associated_type, :string | ||
| 8 | t.column :user_id, :integer | ||
| 9 | t.column :user_type, :string | ||
| 10 | t.column :username, :string | ||
| 11 | t.column :action, :string | ||
| 12 | t.column :audited_changes, :text | ||
| 13 | t.column :version, :integer, :default => 0 | ||
| 14 | t.column :comment, :string | ||
| 15 | t.column :remote_address, :string | ||
| 16 | t.column :request_uuid, :string | ||
| 17 | t.column :created_at, :datetime | ||
| 18 | end | ||
| 19 | |||
| 20 | add_index :audits, [:auditable_type, :auditable_id, :version], :name => 'auditable_index' | ||
| 21 | add_index :audits, [:associated_type, :associated_id], :name => 'associated_index' | ||
| 22 | add_index :audits, [:user_id, :user_type], :name => 'user_index' | ||
| 23 | add_index :audits, :request_uuid | ||
| 24 | add_index :audits, :created_at | ||
| 25 | end | ||
| 26 | |||
| 27 | def self.down | ||
| 28 | drop_table :audits | ||
| 29 | end | ||
| 30 | end | ||
| diff --git a/db/migrate/20190312193154_create_games.rb b/db/migrate/20190312193154_create_games.rb new file mode 100644 index 0000000..de30492 --- /dev/null +++ b/db/migrate/20190312193154_create_games.rb | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | class CreateGames < ActiveRecord::Migration[5.2] | ||
| 2 | def change | ||
| 3 | create_table :games do |t| | ||
| 4 | t.string :title | ||
| 5 | t.string :status | ||
| 6 | t.text :progress | ||
| 7 | t.text :description | ||
| 8 | t.integer :score | ||
| 9 | |||
| 10 | t.timestamps | ||
| 11 | end | ||
| 12 | end | ||
| 13 | end | ||
| diff --git a/db/migrate/20190313123149_add_start_and_end_dates_to_game.rb b/db/migrate/20190313123149_add_start_and_end_dates_to_game.rb new file mode 100644 index 0000000..7803344 --- /dev/null +++ b/db/migrate/20190313123149_add_start_and_end_dates_to_game.rb | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | class AddStartAndEndDatesToGame < ActiveRecord::Migration[5.2] | ||
| 2 | def change | ||
| 3 | change_table :games do |c| | ||
| 4 | c.date :started_on | ||
| 5 | c.date :finished_on | ||
| 6 | end | ||
| 7 | end | ||
| 8 | end | ||
| diff --git a/db/migrate/20221210170526_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20221210170526_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 0000000..a15c6ce --- /dev/null +++ b/db/migrate/20221210170526_add_service_name_to_active_storage_blobs.active_storage.rb | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # This migration comes from active_storage (originally 20190112182829) | ||
| 2 | class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] | ||
| 3 | def up | ||
| 4 | return unless table_exists?(:active_storage_blobs) | ||
| 5 | |||
| 6 | unless column_exists?(:active_storage_blobs, :service_name) | ||
| 7 | add_column :active_storage_blobs, :service_name, :string | ||
| 8 | |||
| 9 | if configured_service = ActiveStorage::Blob.service.name | ||
| 10 | ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) | ||
| 11 | end | ||
| 12 | |||
| 13 | change_column :active_storage_blobs, :service_name, :string, null: false | ||
| 14 | end | ||
| 15 | end | ||
| 16 | |||
| 17 | def down | ||
| 18 | return unless table_exists?(:active_storage_blobs) | ||
| 19 | |||
| 20 | remove_column :active_storage_blobs, :service_name | ||
| 21 | end | ||
| 22 | end | ||
| diff --git a/db/migrate/20221210170527_create_active_storage_variant_records.active_storage.rb b/db/migrate/20221210170527_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 0000000..94ac83a --- /dev/null +++ b/db/migrate/20221210170527_create_active_storage_variant_records.active_storage.rb | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # This migration comes from active_storage (originally 20191206030411) | ||
| 2 | class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] | ||
| 3 | def change | ||
| 4 | return unless table_exists?(:active_storage_blobs) | ||
| 5 | |||
| 6 | # Use Active Record's configured type for primary key | ||
| 7 | create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| | ||
| 8 | t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type | ||
| 9 | t.string :variation_digest, null: false | ||
| 10 | |||
| 11 | t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true | ||
| 12 | t.foreign_key :active_storage_blobs, column: :blob_id | ||
| 13 | end | ||
| 14 | end | ||
| 15 | |||
| 16 | private | ||
| 17 | def primary_key_type | ||
| 18 | config = Rails.configuration.generators | ||
| 19 | config.options[config.orm][:primary_key_type] || :primary_key | ||
| 20 | end | ||
| 21 | |||
| 22 | def blobs_primary_key_type | ||
| 23 | pkey_name = connection.primary_key(:active_storage_blobs) | ||
| 24 | pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } | ||
| 25 | pkey_column.bigint? ? :bigint : pkey_column.type | ||
| 26 | end | ||
| 27 | end | ||
| diff --git a/db/migrate/20221210170528_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20221210170528_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 0000000..93c8b85 --- /dev/null +++ b/db/migrate/20221210170528_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # This migration comes from active_storage (originally 20211119233751) | ||
| 2 | class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] | ||
| 3 | def change | ||
| 4 | return unless table_exists?(:active_storage_blobs) | ||
| 5 | |||
| 6 | change_column_null(:active_storage_blobs, :checksum, true) | ||
| 7 | end | ||
| 8 | end | ||
| diff --git a/db/migrate/20221210170549_create_lingo_scores.lingo.rb b/db/migrate/20221210170549_create_lingo_scores.lingo.rb new file mode 100644 index 0000000..f56790f --- /dev/null +++ b/db/migrate/20221210170549_create_lingo_scores.lingo.rb | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | # This migration comes from lingo (originally 20221210011146) | ||
| 2 | class CreateLingoScores < ActiveRecord::Migration[7.0] | ||
| 3 | def change | ||
| 4 | create_table :lingo_scores do |t| | ||
| 5 | t.integer :user_id | ||
| 6 | t.string :username | ||
| 7 | t.string :avatar_url | ||
| 8 | t.integer :score | ||
| 9 | |||
| 10 | t.timestamps | ||
| 11 | end | ||
| 12 | end | ||
| 13 | end | ||
| diff --git a/db/migrate/20221210175109_widen_user_id_field.lingo.rb b/db/migrate/20221210175109_widen_user_id_field.lingo.rb new file mode 100644 index 0000000..7ccb934 --- /dev/null +++ b/db/migrate/20221210175109_widen_user_id_field.lingo.rb | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # This migration comes from lingo (originally 20221210174554) | ||
| 2 | class WidenUserIdField < ActiveRecord::Migration[7.0] | ||
| 3 | def change | ||
| 4 | change_column :lingo_scores, :user_id, :integer, limit: 8 | ||
| 5 | end | ||
| 6 | end | ||
| diff --git a/db/migrate/20231012190529_create_comments.rb b/db/migrate/20231012190529_create_comments.rb new file mode 100644 index 0000000..3073dd5 --- /dev/null +++ b/db/migrate/20231012190529_create_comments.rb | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | class CreateComments < ActiveRecord::Migration[7.0] | ||
| 2 | def change | ||
| 3 | create_table :comments do |t| | ||
| 4 | t.references :blog, null: false, foreign_key: true | ||
| 5 | t.string :username | ||
| 6 | t.string :email | ||
| 7 | t.string :website | ||
| 8 | t.text :body | ||
| 9 | t.string :status | ||
| 10 | t.datetime :published_at | ||
| 11 | |||
| 12 | t.timestamps | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| diff --git a/db/migrate/20231014140431_add_user_to_blog.rb b/db/migrate/20231014140431_add_user_to_blog.rb new file mode 100644 index 0000000..74af555 --- /dev/null +++ b/db/migrate/20231014140431_add_user_to_blog.rb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | class AddUserToBlog < ActiveRecord::Migration[7.0] | ||
| 2 | def change | ||
| 3 | add_reference :blogs, :user, foreign_key: true | ||
| 4 | end | ||
| 5 | end | ||
| diff --git a/db/migrate/20231014141657_add_reply_to_comment.rb b/db/migrate/20231014141657_add_reply_to_comment.rb new file mode 100644 index 0000000..8e7b445 --- /dev/null +++ b/db/migrate/20231014141657_add_reply_to_comment.rb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | class AddReplyToComment < ActiveRecord::Migration[7.0] | ||
| 2 | def change | ||
| 3 | add_reference :comments, :reply_to, foreign_key: { to_table: :comments } | ||
| 4 | end | ||
| 5 | end | ||
| diff --git a/db/migrate/20231014194459_create_active_storage_tables.active_storage.rb b/db/migrate/20231014194459_create_active_storage_tables.active_storage.rb new file mode 100644 index 0000000..8a7bfe1 --- /dev/null +++ b/db/migrate/20231014194459_create_active_storage_tables.active_storage.rb | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | # This migration comes from active_storage (originally 20170806125915) | ||
| 2 | class CreateActiveStorageTables < ActiveRecord::Migration[5.2] | ||
| 3 | def change | ||
| 4 | # Use Active Record's configured type for primary and foreign keys | ||
| 5 | primary_key_type, foreign_key_type = primary_and_foreign_key_types | ||
| 6 | |||
| 7 | create_table :active_storage_blobs, id: primary_key_type do |t| | ||
| 8 | t.string :key, null: false | ||
| 9 | t.string :filename, null: false | ||
| 10 | t.string :content_type | ||
| 11 | t.text :metadata | ||
| 12 | t.string :service_name, null: false | ||
| 13 | t.bigint :byte_size, null: false | ||
| 14 | t.string :checksum | ||
| 15 | |||
| 16 | if connection.supports_datetime_with_precision? | ||
| 17 | t.datetime :created_at, precision: 6, null: false | ||
| 18 | else | ||
| 19 | t.datetime :created_at, null: false | ||
| 20 | end | ||
| 21 | |||
| 22 | t.index [ :key ], unique: true | ||
| 23 | end | ||
| 24 | |||
| 25 | create_table :active_storage_attachments, id: primary_key_type do |t| | ||
| 26 | t.string :name, null: false | ||
| 27 | t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type | ||
| 28 | t.references :blob, null: false, type: foreign_key_type | ||
| 29 | |||
| 30 | if connection.supports_datetime_with_precision? | ||
| 31 | t.datetime :created_at, precision: 6, null: false | ||
| 32 | else | ||
| 33 | t.datetime :created_at, null: false | ||
| 34 | end | ||
| 35 | |||
| 36 | t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true | ||
| 37 | t.foreign_key :active_storage_blobs, column: :blob_id | ||
| 38 | end | ||
| 39 | |||
| 40 | create_table :active_storage_variant_records, id: primary_key_type do |t| | ||
| 41 | t.belongs_to :blob, null: false, index: false, type: foreign_key_type | ||
| 42 | t.string :variation_digest, null: false | ||
| 43 | |||
| 44 | t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true | ||
| 45 | t.foreign_key :active_storage_blobs, column: :blob_id | ||
| 46 | end | ||
| 47 | end | ||
| 48 | |||
| 49 | private | ||
| 50 | def primary_and_foreign_key_types | ||
| 51 | config = Rails.configuration.generators | ||
| 52 | setting = config.options[config.orm][:primary_key_type] | ||
| 53 | primary_key_type = setting || :primary_key | ||
| 54 | foreign_key_type = setting || :bigint | ||
| 55 | [primary_key_type, foreign_key_type] | ||
| 56 | end | ||
| 57 | end | ||
| diff --git a/db/migrate/20231017153558_add_more_comment_columns.rb b/db/migrate/20231017153558_add_more_comment_columns.rb new file mode 100644 index 0000000..9ce3e07 --- /dev/null +++ b/db/migrate/20231017153558_add_more_comment_columns.rb | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | class AddMoreCommentColumns < ActiveRecord::Migration[7.0] | ||
| 2 | def change | ||
| 3 | change_table :comments do |t| | ||
| 4 | t.string :request_ip | ||
| 5 | t.string :user_agent | ||
| 6 | t.string :referrer | ||
| 7 | end | ||
| 8 | end | ||
| 9 | end | ||
| diff --git a/db/migrate/20231020194529_create_votes.rb b/db/migrate/20231020194529_create_votes.rb new file mode 100644 index 0000000..947652b --- /dev/null +++ b/db/migrate/20231020194529_create_votes.rb | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | class CreateVotes < ActiveRecord::Migration[7.0] | ||
| 2 | def change | ||
| 3 | create_table :votes do |t| | ||
| 4 | t.references :votable, polymorphic: true | ||
| 5 | t.integer :upvote | ||
| 6 | t.string :ip | ||
| 7 | |||
| 8 | t.timestamps | ||
| 9 | end | ||
| 10 | end | ||
| 11 | end | ||
| diff --git a/db/migrate/20231020195330_make_blog_votable.rb b/db/migrate/20231020195330_make_blog_votable.rb new file mode 100644 index 0000000..4d1e42a --- /dev/null +++ b/db/migrate/20231020195330_make_blog_votable.rb | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | class MakeBlogVotable < ActiveRecord::Migration[7.0] | ||
| 2 | def change | ||
| 3 | change_table :blogs do |t| | ||
| 4 | t.integer :upvotes, default: 0, null: false | ||
| 5 | t.integer :downvotes, default: 0, null: false | ||
| 6 | end | ||
| 7 | end | ||
| 8 | end | ||
| diff --git a/db/migrate/20231021020306_create_quotes.rb b/db/migrate/20231021020306_create_quotes.rb new file mode 100644 index 0000000..60424e5 --- /dev/null +++ b/db/migrate/20231021020306_create_quotes.rb | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | class CreateQuotes < ActiveRecord::Migration[7.0] | ||
| 2 | def change | ||
| 3 | create_table :quotes do |t| | ||
| 4 | t.text :content, null: false | ||
| 5 | t.string :state, null: false | ||
| 6 | t.string :submitter | ||
| 7 | t.text :notes, null: false | ||
| 8 | t.integer :upvotes, null: false, default: 0 | ||
| 9 | t.integer :downvotes, null: false, default: 0 | ||
| 10 | |||
| 11 | t.timestamps | ||
| 12 | end | ||
| 13 | end | ||
| 14 | end | ||
| diff --git a/db/migrate/20231030181439_create_wittle_puzzles.wittle.rb b/db/migrate/20231030181439_create_wittle_puzzles.wittle.rb new file mode 100644 index 0000000..9accf92 --- /dev/null +++ b/db/migrate/20231030181439_create_wittle_puzzles.wittle.rb | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # This migration comes from wittle (originally 20231028205751) | ||
| 2 | class CreateWittlePuzzles < ActiveRecord::Migration[7.1] | ||
| 3 | def change | ||
| 4 | create_table :wittle_puzzles do |t| | ||
| 5 | t.text :data | ||
| 6 | t.text :solved_data | ||
| 7 | t.string :category | ||
| 8 | |||
| 9 | t.timestamps | ||
| 10 | end | ||
| 11 | end | ||
| 12 | end | ||
| diff --git a/db/migrate/20231030181440_create_wittle_scores.wittle.rb b/db/migrate/20231030181440_create_wittle_scores.wittle.rb new file mode 100644 index 0000000..5110221 --- /dev/null +++ b/db/migrate/20231030181440_create_wittle_scores.wittle.rb | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | # This migration comes from wittle (originally 20231028210722) | ||
| 2 | class CreateWittleScores < ActiveRecord::Migration[7.1] | ||
| 3 | def change | ||
| 4 | create_table :wittle_scores do |t| | ||
| 5 | t.references :puzzle, null: false | ||
| 6 | t.string :name | ||
| 7 | t.string :ip | ||
| 8 | t.integer :seconds_taken | ||
| 9 | |||
| 10 | t.timestamps | ||
| 11 | end | ||
| 12 | end | ||
| 13 | end | ||
| diff --git a/db/migrate/20240320145033_create_globals.rb b/db/migrate/20240320145033_create_globals.rb new file mode 100644 index 0000000..6ac9a29 --- /dev/null +++ b/db/migrate/20240320145033_create_globals.rb | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | class CreateGlobals < ActiveRecord::Migration[7.1] | ||
| 2 | def change | ||
| 3 | create_table :globals do |t| | ||
| 4 | t.string :key | ||
| 5 | t.string :string_value | ||
| 6 | t.integer :int_value | ||
| 7 | |||
| 8 | t.timestamps | ||
| 9 | end | ||
| 10 | end | ||
| 11 | end | ||
| diff --git a/db/migrate/20241207200746_add_like_fields_to_vote.rb b/db/migrate/20241207200746_add_like_fields_to_vote.rb new file mode 100644 index 0000000..eae2816 --- /dev/null +++ b/db/migrate/20241207200746_add_like_fields_to_vote.rb | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | class AddLikeFieldsToVote < ActiveRecord::Migration[7.1] | ||
| 2 | def change | ||
| 3 | change_table :votes do |t| | ||
| 4 | t.string :liker_url | ||
| 5 | t.string :liker_name | ||
| 6 | end | ||
| 7 | end | ||
| 8 | end | ||
| diff --git a/db/migrate/20250112025207_widen_blog_body_column.rb b/db/migrate/20250112025207_widen_blog_body_column.rb new file mode 100644 index 0000000..f65aaea --- /dev/null +++ b/db/migrate/20250112025207_widen_blog_body_column.rb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | class WidenBlogBodyColumn < ActiveRecord::Migration[7.1] | ||
| 2 | def change | ||
| 3 | change_column :blogs, :body, :text, limit: 16.megabytes - 1 | ||
| 4 | end | ||
| 5 | end | ||
| diff --git a/db/migrate/20250512181245_add_latest_post_at_to_stream.rb b/db/migrate/20250512181245_add_latest_post_at_to_stream.rb new file mode 100644 index 0000000..9d753e3 --- /dev/null +++ b/db/migrate/20250512181245_add_latest_post_at_to_stream.rb | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | class AddLatestPostAtToStream < ActiveRecord::Migration[7.1] | ||
| 2 | def up | ||
| 3 | add_column :streams, :latest_post_at, :datetime | ||
| 4 | |||
| 5 | Stream.all.each do |stream| | ||
| 6 | if stream.updates.empty? | ||
| 7 | stream.latest_post_at = stream.created_at | ||
| 8 | else | ||
| 9 | stream.latest_post_at = stream.updates.order(created_at: :desc).first.created_at | ||
| 10 | end | ||
| 11 | |||
| 12 | stream.save! | ||
| 13 | end | ||
| 14 | |||
| 15 | change_column_null :streams, :latest_post_at, false | ||
| 16 | end | ||
| 17 | |||
| 18 | def down | ||
| 19 | remove_column :streams, :latest_post_at, :datetime | ||
| 20 | end | ||
| 21 | end | ||
| diff --git a/db/migrate/20251122012500_create_scrobbles.rb b/db/migrate/20251122012500_create_scrobbles.rb new file mode 100644 index 0000000..9f00435 --- /dev/null +++ b/db/migrate/20251122012500_create_scrobbles.rb | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | class CreateScrobbles < ActiveRecord::Migration[7.1] | ||
| 2 | def change | ||
| 3 | create_table :scrobbles do |t| | ||
| 4 | t.string :title | ||
| 5 | t.string :artist | ||
| 6 | t.string :album | ||
| 7 | t.string :image | ||
| 8 | |||
| 9 | t.timestamps | ||
| 10 | end | ||
| 11 | end | ||
| 12 | end | ||
