DEV: Apply syntax_tree formatting to `db/*`
This commit is contained in:
parent
cb932d6ee1
commit
b0fda61a8e
1
.streerc
1
.streerc
|
@ -1,5 +1,4 @@
|
|||
--print-width=100
|
||||
--plugins=plugin/trailing_comma,disable_ternary
|
||||
--ignore-files=app/*
|
||||
--ignore-files=db/*
|
||||
--ignore-files=lib/*
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
user = User.where(username: "test_user").first_or_create(name: "Test User", email: "test_user@example.com", password: SecureRandom.hex, username: "test_user", approved: true, active: true, admin: true)
|
||||
user =
|
||||
User.where(username: "test_user").first_or_create(
|
||||
name: "Test User",
|
||||
email: "test_user@example.com",
|
||||
password: SecureRandom.hex,
|
||||
username: "test_user",
|
||||
approved: true,
|
||||
active: true,
|
||||
admin: true,
|
||||
)
|
||||
UserAuthToken.generate!(user_id: user.id)
|
||||
ApiKey.create(key: 'test_d7fd0429940', user_id: user.id, created_by_id: user.id)
|
||||
ApiKey.create(key: "test_d7fd0429940", user_id: user.id, created_by_id: user.id)
|
||||
|
|
|
@ -12,7 +12,11 @@ class SeedData::Refresher
|
|||
# Not that reset_column_information is not thread safe so we have to be careful
|
||||
# not to run it concurrently within the same process.
|
||||
ActiveRecord::Base.connection.tables.each do |table|
|
||||
table.classify.constantize.reset_column_information rescue nil
|
||||
begin
|
||||
table.classify.constantize.reset_column_information
|
||||
rescue StandardError
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
@refreshed = true
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Group.ensure_automatic_groups!
|
||||
if g = Group.find_by(name: 'trust_level_5', id: 15)
|
||||
if g = Group.find_by(name: "trust_level_5", id: 15)
|
||||
g.destroy!
|
||||
end
|
||||
|
||||
Group.where(name: 'everyone').update_all(visibility_level: Group.visibility_levels[:staff])
|
||||
Group.where(name: "everyone").update_all(visibility_level: Group.visibility_levels[:staff])
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
PostActionType.seed do |s|
|
||||
s.id = PostActionType.types[:like]
|
||||
s.name_key = 'like'
|
||||
s.name_key = "like"
|
||||
s.is_flag = false
|
||||
s.icon = 'heart'
|
||||
s.icon = "heart"
|
||||
s.position = 2
|
||||
end
|
||||
|
||||
if PostActionType.types[:off_topic]
|
||||
PostActionType.seed do |s|
|
||||
s.id = PostActionType.types[:off_topic]
|
||||
s.name_key = 'off_topic'
|
||||
s.name_key = "off_topic"
|
||||
s.is_flag = true
|
||||
s.position = 3
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ end
|
|||
if PostActionType.types[:inappropriate]
|
||||
PostActionType.seed do |s|
|
||||
s.id = PostActionType.types[:inappropriate]
|
||||
s.name_key = 'inappropriate'
|
||||
s.name_key = "inappropriate"
|
||||
s.is_flag = true
|
||||
s.position = 4
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ end
|
|||
if PostActionType.types[:spam]
|
||||
PostActionType.seed do |s|
|
||||
s.id = PostActionType.types[:spam]
|
||||
s.name_key = 'spam'
|
||||
s.name_key = "spam"
|
||||
s.is_flag = true
|
||||
s.position = 6
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ end
|
|||
if PostActionType.types[:notify_user]
|
||||
PostActionType.seed do |s|
|
||||
s.id = PostActionType.types[:notify_user]
|
||||
s.name_key = 'notify_user'
|
||||
s.name_key = "notify_user"
|
||||
s.is_flag = true
|
||||
s.position = 7
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ end
|
|||
if PostActionType.types[:notify_moderators]
|
||||
PostActionType.seed do |s|
|
||||
s.id = PostActionType.types[:notify_moderators]
|
||||
s.name_key = 'notify_moderators'
|
||||
s.name_key = "notify_moderators"
|
||||
s.is_flag = true
|
||||
s.position = 8
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'badge_queries'
|
||||
require "badge_queries"
|
||||
|
||||
BadgeGrouping.seed do |g|
|
||||
g.id = BadgeGrouping::GettingStarted
|
||||
|
@ -45,9 +45,9 @@ SQL
|
|||
|
||||
[
|
||||
[Badge::BasicUser, "Basic User", BadgeType::Bronze],
|
||||
[Badge::Member, "Member", BadgeType::Bronze],
|
||||
[Badge::Regular, "Regular", BadgeType::Silver],
|
||||
[Badge::Leader, "Leader", BadgeType::Gold],
|
||||
[Badge::Member, "Member", BadgeType::Bronze],
|
||||
[Badge::Regular, "Regular", BadgeType::Silver],
|
||||
[Badge::Leader, "Leader", BadgeType::Gold],
|
||||
].each do |id, name, type|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -179,9 +179,9 @@ Badge.seed do |b|
|
|||
end
|
||||
|
||||
[
|
||||
[Badge::NiceShare, "Nice Share", BadgeType::Bronze, 25],
|
||||
[Badge::GoodShare, "Good Share", BadgeType::Silver, 300],
|
||||
[Badge::GreatShare, "Great Share", BadgeType::Gold, 1000],
|
||||
[Badge::NiceShare, "Nice Share", BadgeType::Bronze, 25],
|
||||
[Badge::GoodShare, "Good Share", BadgeType::Silver, 300],
|
||||
[Badge::GreatShare, "Great Share", BadgeType::Gold, 1000],
|
||||
].each do |id, name, level, count|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -246,12 +246,12 @@ Badge.seed do |b|
|
|||
end
|
||||
|
||||
[
|
||||
[Badge::NicePost, "Nice Post", BadgeType::Bronze, false],
|
||||
[Badge::GoodPost, "Good Post", BadgeType::Silver, false],
|
||||
[Badge::GreatPost, "Great Post", BadgeType::Gold, false],
|
||||
[Badge::NiceTopic, "Nice Topic", BadgeType::Bronze, true],
|
||||
[Badge::GoodTopic, "Good Topic", BadgeType::Silver, true],
|
||||
[Badge::GreatTopic, "Great Topic", BadgeType::Gold, true],
|
||||
[Badge::NicePost, "Nice Post", BadgeType::Bronze, false],
|
||||
[Badge::GoodPost, "Good Post", BadgeType::Silver, false],
|
||||
[Badge::GreatPost, "Great Post", BadgeType::Gold, false],
|
||||
[Badge::NiceTopic, "Nice Topic", BadgeType::Bronze, true],
|
||||
[Badge::GoodTopic, "Good Topic", BadgeType::Silver, true],
|
||||
[Badge::GreatTopic, "Great Topic", BadgeType::Gold, true],
|
||||
].each do |id, name, type, topic|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -281,9 +281,9 @@ Badge.seed do |b|
|
|||
end
|
||||
|
||||
[
|
||||
[Badge::PopularLink, "Popular Link", BadgeType::Bronze, 50],
|
||||
[Badge::HotLink, "Hot Link", BadgeType::Silver, 300],
|
||||
[Badge::FamousLink, "Famous Link", BadgeType::Gold, 1000],
|
||||
[Badge::PopularLink, "Popular Link", BadgeType::Bronze, 50],
|
||||
[Badge::HotLink, "Hot Link", BadgeType::Silver, 300],
|
||||
[Badge::FamousLink, "Famous Link", BadgeType::Gold, 1000],
|
||||
].each do |id, name, level, count|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -302,8 +302,8 @@ end
|
|||
|
||||
[
|
||||
[Badge::Appreciated, "Appreciated", BadgeType::Bronze, 1, 20],
|
||||
[Badge::Respected, "Respected", BadgeType::Silver, 2, 100],
|
||||
[Badge::Admired, "Admired", BadgeType::Gold, 5, 300],
|
||||
[Badge::Respected, "Respected", BadgeType::Silver, 2, 100],
|
||||
[Badge::Admired, "Admired", BadgeType::Gold, 5, 300],
|
||||
].each do |id, name, level, like_count, post_count|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -319,9 +319,9 @@ end
|
|||
end
|
||||
|
||||
[
|
||||
[Badge::ThankYou, "Thank You", BadgeType::Bronze, 20, 10],
|
||||
[Badge::GivesBack, "Gives Back", BadgeType::Silver, 100, 100],
|
||||
[Badge::Empathetic, "Empathetic", BadgeType::Gold, 500, 1000]
|
||||
[Badge::ThankYou, "Thank You", BadgeType::Bronze, 20, 10],
|
||||
[Badge::GivesBack, "Gives Back", BadgeType::Silver, 100, 100],
|
||||
[Badge::Empathetic, "Empathetic", BadgeType::Gold, 500, 1000],
|
||||
].each do |id, name, level, count, ratio|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -337,9 +337,9 @@ end
|
|||
end
|
||||
|
||||
[
|
||||
[Badge::OutOfLove, "Out of Love", BadgeType::Bronze, 1],
|
||||
[Badge::HigherLove, "Higher Love", BadgeType::Silver, 5],
|
||||
[Badge::CrazyInLove, "Crazy in Love", BadgeType::Gold, 20],
|
||||
[Badge::OutOfLove, "Out of Love", BadgeType::Bronze, 1],
|
||||
[Badge::HigherLove, "Higher Love", BadgeType::Silver, 5],
|
||||
[Badge::CrazyInLove, "Crazy in Love", BadgeType::Gold, 20],
|
||||
].each do |id, name, level, count|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -422,7 +422,7 @@ end
|
|||
[
|
||||
[Badge::Enthusiast, "Enthusiast", BadgeType::Bronze, 10],
|
||||
[Badge::Aficionado, "Aficionado", BadgeType::Silver, 100],
|
||||
[Badge::Devotee, "Devotee", BadgeType::Gold, 365],
|
||||
[Badge::Devotee, "Devotee", BadgeType::Gold, 365],
|
||||
].each do |id, name, level, days|
|
||||
Badge.seed do |b|
|
||||
b.id = id
|
||||
|
@ -437,9 +437,11 @@ end
|
|||
end
|
||||
end
|
||||
|
||||
Badge.where("NOT system AND id < 100").each do |badge|
|
||||
new_id = [Badge.maximum(:id) + 1, 100].max
|
||||
old_id = badge.id
|
||||
badge.update_columns(id: new_id)
|
||||
UserBadge.where(badge_id: old_id).update_all(badge_id: new_id)
|
||||
end
|
||||
Badge
|
||||
.where("NOT system AND id < 100")
|
||||
.each do |badge|
|
||||
new_id = [Badge.maximum(:id) + 1, 100].max
|
||||
old_id = badge.id
|
||||
badge.update_columns(id: new_id)
|
||||
UserBadge.where(badge_id: old_id).update_all(badge_id: new_id)
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ end
|
|||
|
||||
UserOption.where(user_id: -1).update_all(
|
||||
email_messages_level: UserOption.email_level_types[:never],
|
||||
email_level: UserOption.email_level_types[:never]
|
||||
email_level: UserOption.email_level_types[:never],
|
||||
)
|
||||
|
||||
Group.user_trust_level_change!(-1, TrustLevel[4])
|
||||
|
@ -44,22 +44,25 @@ if ENV["SMOKE"] == "1"
|
|||
ue.user_id = 0
|
||||
end
|
||||
|
||||
smoke_user = User.seed do |u|
|
||||
u.id = 0
|
||||
u.name = "smoke_user"
|
||||
u.username = "smoke_user"
|
||||
u.username_lower = "smoke_user"
|
||||
u.password = "P4ssw0rd"
|
||||
u.active = true
|
||||
u.approved = true
|
||||
u.approved_at = Time.now
|
||||
u.trust_level = TrustLevel[3]
|
||||
end.first
|
||||
smoke_user =
|
||||
User
|
||||
.seed do |u|
|
||||
u.id = 0
|
||||
u.name = "smoke_user"
|
||||
u.username = "smoke_user"
|
||||
u.username_lower = "smoke_user"
|
||||
u.password = "P4ssw0rd"
|
||||
u.active = true
|
||||
u.approved = true
|
||||
u.approved_at = Time.now
|
||||
u.trust_level = TrustLevel[3]
|
||||
end
|
||||
.first
|
||||
|
||||
UserOption.where(user_id: smoke_user.id).update_all(
|
||||
email_digests: false,
|
||||
email_messages_level: UserOption.email_level_types[:never],
|
||||
email_level: UserOption.email_level_types[:never]
|
||||
email_level: UserOption.email_level_types[:never],
|
||||
)
|
||||
|
||||
EmailToken.where(user_id: smoke_user.id).update_all(confirmed: true)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'seed_data/categories'
|
||||
require "seed_data/categories"
|
||||
|
||||
if !Rails.env.test?
|
||||
SeedData::Categories.with_default_locale.create
|
||||
end
|
||||
SeedData::Categories.with_default_locale.create if !Rails.env.test?
|
||||
|
|
|
@ -10,23 +10,28 @@ if !Theme.exists?
|
|||
{ name: I18n.t("color_schemes.wcag_dark"), base_scheme_id: "WCAG Dark" },
|
||||
{ name: I18n.t("color_schemes.dracula"), base_scheme_id: "Dracula" },
|
||||
{ name: I18n.t("color_schemes.solarized_light"), base_scheme_id: "Solarized Light" },
|
||||
{ name: I18n.t("color_schemes.solarized_dark"), base_scheme_id: "Solarized Dark" }
|
||||
{ name: I18n.t("color_schemes.solarized_dark"), base_scheme_id: "Solarized Dark" },
|
||||
]
|
||||
|
||||
color_schemes.each do |cs|
|
||||
scheme = ColorScheme.find_by(base_scheme_id: cs[:base_scheme_id])
|
||||
scheme ||= ColorScheme.create_from_base(name: cs[:name], via_wizard: true, base_scheme_id: cs[:base_scheme_id], user_selectable: true)
|
||||
scheme ||=
|
||||
ColorScheme.create_from_base(
|
||||
name: cs[:name],
|
||||
via_wizard: true,
|
||||
base_scheme_id: cs[:base_scheme_id],
|
||||
user_selectable: true,
|
||||
)
|
||||
end
|
||||
|
||||
name = I18n.t('color_schemes.default_theme_name')
|
||||
name = I18n.t("color_schemes.default_theme_name")
|
||||
default_theme = Theme.create!(name: name, user_id: -1)
|
||||
default_theme.set_default!
|
||||
|
||||
if SiteSetting.default_dark_mode_color_scheme_id == SiteSetting.defaults[:default_dark_mode_color_scheme_id]
|
||||
if SiteSetting.default_dark_mode_color_scheme_id ==
|
||||
SiteSetting.defaults[:default_dark_mode_color_scheme_id]
|
||||
dark_scheme_id = ColorScheme.where(base_scheme_id: "Dark").pluck_first(:id)
|
||||
|
||||
if dark_scheme_id.present?
|
||||
SiteSetting.default_dark_mode_color_scheme_id = dark_scheme_id
|
||||
end
|
||||
SiteSetting.default_dark_mode_color_scheme_id = dark_scheme_id if dark_scheme_id.present?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
if !Rails.env.test?
|
||||
require 'seed_data/topics'
|
||||
require "seed_data/topics"
|
||||
|
||||
topics_exist = Topic.where(<<~SQL).exists?
|
||||
id NOT IN (
|
||||
|
|
|
@ -19,11 +19,13 @@ class AddSchemaMigrationDetails < ActiveRecord::Migration[4.2]
|
|||
|
||||
add_index :schema_migration_details, [:version]
|
||||
|
||||
execute("INSERT INTO schema_migration_details(version, created_at)
|
||||
execute(
|
||||
"INSERT INTO schema_migration_details(version, created_at)
|
||||
SELECT version, current_timestamp
|
||||
FROM schema_migrations
|
||||
ORDER BY version
|
||||
")
|
||||
",
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -11,6 +11,6 @@ class CreatePosts < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :posts, [:forum_thread_id, :created_at]
|
||||
add_index :posts, %i[forum_thread_id created_at]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class CreateSites < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :sites do |t|
|
||||
create_table :sites do |t|
|
||||
t.string :title, limit: 100, null: false
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
class FixPostIndices < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
remove_index :posts, [:forum_thread_id, :created_at]
|
||||
add_index :posts, [:forum_thread_id, :post_number]
|
||||
remove_index :posts, %i[forum_thread_id created_at]
|
||||
add_index :posts, %i[forum_thread_id post_number]
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :posts, [:forum_thread_id, :post_number]
|
||||
add_index :posts, [:forum_thread_id, :created_at]
|
||||
remove_index :posts, %i[forum_thread_id post_number]
|
||||
add_index :posts, %i[forum_thread_id created_at]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,5 +13,4 @@ class AddDisplayUsernameToUsers < ActiveRecord::Migration[4.2]
|
|||
execute "UPDATE users SET username = display_username"
|
||||
remove_column :users, :display_username
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,18 +5,18 @@ class CreateVestalVersions < ActiveRecord::Migration[4.2]
|
|||
create_table :versions do |t|
|
||||
t.belongs_to :versioned, polymorphic: true
|
||||
t.belongs_to :user, polymorphic: true
|
||||
t.string :user_name
|
||||
t.text :modifications
|
||||
t.string :user_name
|
||||
t.text :modifications
|
||||
t.integer :number
|
||||
t.integer :reverted_from
|
||||
t.string :tag
|
||||
t.string :tag
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
change_table :versions do |t|
|
||||
t.index [:versioned_id, :versioned_type]
|
||||
t.index [:user_id, :user_type]
|
||||
t.index %i[versioned_id versioned_type]
|
||||
t.index %i[user_id user_type]
|
||||
t.index :user_name
|
||||
t.index :number
|
||||
t.index :tag
|
||||
|
|
|
@ -13,5 +13,4 @@ class AddCreatedByToForumThreads < ActiveRecord::Migration[4.2]
|
|||
def down
|
||||
remove_column :forum_threads, :user_id
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddLastPostUserIdToForumThreads < ActiveRecord::Migration[4.2]
|
||||
|
||||
def up
|
||||
add_column :forum_threads, :last_post_user_id, :integer
|
||||
|
||||
|
@ -14,5 +13,4 @@ class AddLastPostUserIdToForumThreads < ActiveRecord::Migration[4.2]
|
|||
def down
|
||||
remove_column :forum_threads, :last_post_user_id
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -10,6 +10,9 @@ class CreateExpressions < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :expressions, [:parent_id, :parent_type, :expression_type_id, :user_id], unique: true, name: "expressions_pk"
|
||||
add_index :expressions,
|
||||
%i[parent_id parent_type expression_type_id user_id],
|
||||
unique: true,
|
||||
name: "expressions_pk"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,6 @@ class CreateExpressionTypes < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :expression_types, [:site_id, :name], unique: true
|
||||
add_index :expression_types, %i[site_id name], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,5 +11,4 @@ class AddReplyCountToPosts < ActiveRecord::Migration[4.2]
|
|||
def down
|
||||
remove_column :posts, :reply_count
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -9,11 +9,10 @@ class CreateReadPosts < ActiveRecord::Migration[4.2]
|
|||
t.column :seen, :integer, null: false
|
||||
end
|
||||
|
||||
add_index :read_posts, [:forum_thread_id, :user_id, :page], unique: true
|
||||
add_index :read_posts, %i[forum_thread_id user_id page], unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :read_posts
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -9,6 +9,6 @@ class CreateLastReadPosts < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :last_read_posts, [:user_id, :forum_thread_id], unique: true
|
||||
add_index :last_read_posts, %i[user_id forum_thread_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
class CreateViews < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :views, id: false do |t|
|
||||
t.integer :parent_id, null: false
|
||||
t.string :parent_type, limit: 50, null: false
|
||||
t.integer :ip, limit: 8, null: false
|
||||
t.integer :parent_id, null: false
|
||||
t.string :parent_type, limit: 50, null: false
|
||||
t.integer :ip, limit: 8, null: false
|
||||
t.datetime :viewed_at, null: false
|
||||
t.integer :user_id, null: true
|
||||
t.integer :user_id, null: true
|
||||
end
|
||||
|
||||
add_index :views, [:parent_id, :parent_type]
|
||||
add_index :views, [:parent_id, :parent_type, :ip, :viewed_at], unique: true, name: "unique_views"
|
||||
add_index :views, %i[parent_id parent_type]
|
||||
add_index :views, %i[parent_id parent_type ip viewed_at], unique: true, name: "unique_views"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,5 +10,4 @@ class AddAvgTimeToForumThreads < ActiveRecord::Migration[4.2]
|
|||
def down
|
||||
remove_column :forum_threads, :avg_time
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,16 +5,15 @@ class CreateUploads < ActiveRecord::Migration[4.2]
|
|||
create_table :uploads do |t|
|
||||
t.integer :user_id, null: false
|
||||
t.integer :forum_thread_id, null: false
|
||||
t.string :original_filename, null: false
|
||||
t.string :original_filename, null: false
|
||||
t.integer :filesize, null: false
|
||||
t.integer :width, null: true
|
||||
t.integer :height, null: true
|
||||
t.string :url, null: false
|
||||
t.string :url, null: false
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :uploads, :forum_thread_id
|
||||
add_index :uploads, :user_id
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
class CreateStars < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :stars, id: false do |t|
|
||||
t.integer :parent_id, null: false
|
||||
t.string :parent_type, limit: 50, null: false
|
||||
t.integer :user_id, null: true
|
||||
t.integer :parent_id, null: false
|
||||
t.string :parent_type, limit: 50, null: false
|
||||
t.integer :user_id, null: true
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :stars, [:parent_id, :parent_type, :user_id]
|
||||
add_index :stars, %i[parent_id parent_type user_id]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
class CreateForumThreadUser < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
create_table :forum_thread_users, id: false do |t|
|
||||
t.integer :user_id, null: false
|
||||
t.integer :forum_thread_id, null: false
|
||||
t.boolean :starred, null: false, default: false
|
||||
t.boolean :posted, null: false, default: false
|
||||
t.integer :last_read_post_number, null: false, default: 1
|
||||
t.integer :user_id, null: false
|
||||
t.integer :forum_thread_id, null: false
|
||||
t.boolean :starred, null: false, default: false
|
||||
t.boolean :posted, null: false, default: false
|
||||
t.integer :last_read_post_number, null: false, default: 1
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
execute "DELETE FROM read_posts"
|
||||
|
||||
add_index :forum_thread_users, [:forum_thread_id, :user_id], unique: true
|
||||
add_index :forum_thread_users, %i[forum_thread_id user_id], unique: true
|
||||
|
||||
drop_table :stars
|
||||
drop_table :last_read_posts
|
||||
|
@ -23,13 +23,13 @@ class CreateForumThreadUser < ActiveRecord::Migration[4.2]
|
|||
drop_table :forum_thread_users
|
||||
|
||||
create_table :stars, id: false do |t|
|
||||
t.integer :parent_id, null: false
|
||||
t.string :parent_type, limit: 50, null: false
|
||||
t.integer :user_id, null: true
|
||||
t.integer :parent_id, null: false
|
||||
t.string :parent_type, limit: 50, null: false
|
||||
t.integer :user_id, null: true
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :stars, [:parent_id, :parent_type, :user_id]
|
||||
add_index :stars, %i[parent_id parent_type user_id]
|
||||
|
||||
create_table :last_read_posts do |t|
|
||||
t.integer :user_id, null: false
|
||||
|
@ -38,6 +38,6 @@ class CreateForumThreadUser < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :last_read_posts, [:user_id, :forum_thread_id], unique: true
|
||||
add_index :last_read_posts, %i[user_id forum_thread_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,8 +6,8 @@ class CreateForumThreadLinks < ActiveRecord::Migration[4.2]
|
|||
t.integer :forum_thread_id, null: false
|
||||
t.integer :post_id, null: false
|
||||
t.integer :user_id, null: false
|
||||
t.string :url, limit: 500, null: false
|
||||
t.string :domain, limit: 100, null: false
|
||||
t.string :url, limit: 500, null: false
|
||||
t.string :domain, limit: 100, null: false
|
||||
t.boolean :internal, null: false, default: false
|
||||
t.integer :link_forum_thread_id, null: true
|
||||
t.timestamps null: false
|
||||
|
|
|
@ -8,6 +8,6 @@ class CreateBookmarks < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :bookmarks, [:user_id, :post_id], unique: true
|
||||
add_index :bookmarks, %i[user_id post_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ class CreatePostTimings < ActiveRecord::Migration[4.2]
|
|||
t.integer :msecs, null: false
|
||||
end
|
||||
|
||||
add_index :post_timings, [:thread_id, :post_number]
|
||||
add_index :post_timings, [:thread_id, :post_number, :user_id], unique: true
|
||||
add_index :post_timings, %i[thread_id post_number]
|
||||
add_index :post_timings, %i[thread_id post_number user_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,5 +11,4 @@ class CreateMessageBus < ActiveRecord::Migration[4.2]
|
|||
|
||||
add_index :message_bus, [:created_at]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
class FixPostTimings < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
remove_index :post_timings, [:thread_id, :post_number]
|
||||
remove_index :post_timings, [:thread_id, :post_number, :user_id]
|
||||
remove_index :post_timings, %i[thread_id post_number]
|
||||
remove_index :post_timings, %i[thread_id post_number user_id]
|
||||
rename_column :post_timings, :thread_id, :forum_thread_id
|
||||
add_index :post_timings, [:forum_thread_id, :post_number], name: 'post_timings_summary'
|
||||
add_index :post_timings, [:forum_thread_id, :post_number, :user_id], unique: true, name: 'post_timings_unique'
|
||||
|
||||
add_index :post_timings, %i[forum_thread_id post_number], name: "post_timings_summary"
|
||||
add_index :post_timings,
|
||||
%i[forum_thread_id post_number user_id],
|
||||
unique: true,
|
||||
name: "post_timings_unique"
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -11,6 +11,6 @@ class AddPostNumberToBookmarks < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :bookmarks, [:user_id, :forum_thread_id, :post_number], unique: true
|
||||
add_index :bookmarks, %i[user_id forum_thread_id post_number], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,6 +10,6 @@ class CreateNotifications < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :notifications, [:user_id, :created_at]
|
||||
add_index :notifications, %i[user_id created_at]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
class AddSeenNotificationIdToUsers < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
|
||||
execute "TRUNCATE TABLE notifications"
|
||||
|
||||
add_column :users, :seen_notificaiton_id, :integer, default: 0, null: false
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RenameExpressionTypeId < ActiveRecord::Migration[4.2]
|
||||
|
||||
def up
|
||||
add_column :expression_types, :expression_index, :integer
|
||||
execute "UPDATE expression_types SET expression_index = id"
|
||||
remove_column :expression_types, :id
|
||||
|
||||
add_index :expression_types, [:site_id, :expression_index], unique: true
|
||||
add_index :expression_types, %i[site_id expression_index], unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
class DenormalizeExpressions < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
|
||||
# Denormalizing this makes our queries so, so, so much nicer
|
||||
|
||||
add_column :posts, :expression1_count, :integer, null: false, default: 0
|
||||
|
@ -22,5 +21,4 @@ class DenormalizeExpressions < ActiveRecord::Migration[4.2]
|
|||
execute "update forum_threads set expression#{i}_count = (select sum(expression#{i}_count) from posts where forum_thread_id = forum_threads.id)"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,10 @@ class MakeExpressionsLessGeneric < ActiveRecord::Migration[4.2]
|
|||
rename_column :expressions, :expression_type_id, :expression_index
|
||||
remove_column :expressions, :parent_type
|
||||
|
||||
add_index :expressions, [:post_id, :expression_index, :user_id], unique: true, name: 'unique_by_user'
|
||||
add_index :expressions,
|
||||
%i[post_id expression_index user_id],
|
||||
unique: true,
|
||||
name: "unique_by_user"
|
||||
end
|
||||
|
||||
def down
|
||||
|
@ -14,5 +17,4 @@ class MakeExpressionsLessGeneric < ActiveRecord::Migration[4.2]
|
|||
rename_column :expressions, :expression_index, :expression_type_id
|
||||
add_column :expressions, :parent_type, :string, null: true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,6 +12,6 @@ class CreateIncomingLinks < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :incoming_links, [:site_id, :forum_thread_id, :post_number], name: 'incoming_index'
|
||||
add_index :incoming_links, %i[site_id forum_thread_id post_number], name: "incoming_index"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class CreateReplies < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :post_replies, [:post_id, :reply_id], unique: true
|
||||
add_index :post_replies, %i[post_id reply_id], unique: true
|
||||
|
||||
execute "INSERT INTO post_replies (post_id, reply_id, created_at, updated_at)
|
||||
SELECT p2.id, p.id, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
|
|
|
@ -4,7 +4,7 @@ class CreateCategories < ActiveRecord::Migration[4.2]
|
|||
def up
|
||||
create_table :categories do |t|
|
||||
t.string :name, limit: 50, null: false
|
||||
t.string :color, limit: 6, null: false, default: '0088CC'
|
||||
t.string :color, limit: 6, null: false, default: "0088CC"
|
||||
t.integer :forum_thread_id, null: true
|
||||
t.integer :top1_forum_thread_id, null: true
|
||||
t.integer :top2_forum_thread_id, null: true
|
||||
|
@ -26,5 +26,4 @@ class CreateCategories < ActiveRecord::Migration[4.2]
|
|||
def down
|
||||
drop_table :categories
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -16,5 +16,4 @@ class AddCategoryIdToForumThreads < ActiveRecord::Migration[4.2]
|
|||
remove_column :forum_threads, :category_id
|
||||
add_column :forum_threads, :tag, :string, limit: 20
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,6 +8,9 @@ class CreateCategoryFeaturedThreads < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :category_featured_threads, [:category_id, :forum_thread_id], unique: true, name: 'cat_featured_threads'
|
||||
add_index :category_featured_threads,
|
||||
%i[category_id forum_thread_id],
|
||||
unique: true,
|
||||
name: "cat_featured_threads"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,6 +10,5 @@ class CreateUserOpenIds < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
|
||||
add_index :user_open_ids, [:url]
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,6 @@ class AddEmailHashedPasswordNameSaltToUsers < ActiveRecord::Migration[4.2]
|
|||
add_column :users, :activation_key, :string, limit: 32
|
||||
|
||||
add_column :user_open_ids, :active, :boolean, null: false
|
||||
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -10,5 +10,4 @@ class AddForumIdToCategories < ActiveRecord::Migration[4.2]
|
|||
def down
|
||||
remove_column :categories, :forum_id
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -10,5 +10,4 @@ class AddInvisibleToForumThread < ActiveRecord::Migration[4.2]
|
|||
remove_column :forum_threads, :invisible
|
||||
change_column :categories, :excerpt, :string, limit: 250, null: true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
class RenameInvisible < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
|
||||
add_column :forum_threads, :visible, :boolean, default: true, null: false
|
||||
execute "UPDATE forum_threads SET visible = CASE WHEN invisible THEN false ELSE true END"
|
||||
remove_column :forum_threads, :invisible
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
class CreateActions < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :actions do |t|
|
||||
|
||||
# I elected for multiple ids as opposed to using :as cause it makes the table
|
||||
# thinner, and the joining semantics much simpler (a simple multiple left join will do)
|
||||
#
|
||||
|
@ -20,7 +19,7 @@ class CreateActions < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :actions, [:user_id, :action_type]
|
||||
add_index :actions, %i[user_id action_type]
|
||||
add_index :actions, [:acting_user_id]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
class RemoveSiteId < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
drop_table 'sites'
|
||||
remove_index 'incoming_links', name: "incoming_index"
|
||||
add_index "incoming_links", ["forum_thread_id", "post_number"], name: "incoming_index"
|
||||
remove_column 'incoming_links', 'site_id'
|
||||
remove_index 'users', name: 'index_users_on_site_id'
|
||||
remove_column 'users', 'site_id'
|
||||
drop_table "sites"
|
||||
remove_index "incoming_links", name: "incoming_index"
|
||||
add_index "incoming_links", %w[forum_thread_id post_number], name: "incoming_index"
|
||||
remove_column "incoming_links", "site_id"
|
||||
remove_index "users", name: "index_users_on_site_id"
|
||||
remove_column "users", "site_id"
|
||||
|
||||
remove_index 'expression_types', name: 'index_expression_types_on_site_id_and_expression_index'
|
||||
remove_index 'expression_types', name: 'index_expression_types_on_site_id_and_name'
|
||||
remove_column 'expression_types', 'site_id'
|
||||
remove_index "expression_types", name: "index_expression_types_on_site_id_and_expression_index"
|
||||
remove_index "expression_types", name: "index_expression_types_on_site_id_and_name"
|
||||
remove_column "expression_types", "site_id"
|
||||
add_index "expression_types", ["expression_index"], unique: true
|
||||
add_index "expression_types", ["name"], unique: true
|
||||
|
||||
drop_table 'forums'
|
||||
drop_table "forums"
|
||||
end
|
||||
|
||||
def down
|
||||
raise 'not reversable'
|
||||
raise "not reversable"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
class RemoveForumId < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
remove_column 'forum_threads', 'forum_id'
|
||||
remove_column 'categories', 'forum_id'
|
||||
remove_column "forum_threads", "forum_id"
|
||||
remove_column "categories", "forum_id"
|
||||
end
|
||||
|
||||
def down
|
||||
raise 'not reversible'
|
||||
raise "not reversible"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,11 +13,10 @@ from
|
|||
) as c
|
||||
where pp.id = c.id and pp.post_number <> c.real_number"
|
||||
|
||||
remove_index "posts", ["forum_thread_id", "post_number"]
|
||||
remove_index "posts", %w[forum_thread_id post_number]
|
||||
|
||||
# this needs to be unique if it is not we can not use post_number to identify a post
|
||||
add_index "posts", ["forum_thread_id", "post_number"], unique: true
|
||||
|
||||
add_index "posts", %w[forum_thread_id post_number], unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
class RemoveIndexForNow < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
remove_index "posts", ["forum_thread_id", "post_number"]
|
||||
add_index "posts", ["forum_thread_id", "post_number"], unique: false
|
||||
remove_index "posts", %w[forum_thread_id post_number]
|
||||
add_index "posts", %w[forum_thread_id post_number], unique: false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index "posts", ["forum_thread_id", "post_number"]
|
||||
add_index "posts", ["forum_thread_id", "post_number"], unique: true
|
||||
remove_index "posts", %w[forum_thread_id post_number]
|
||||
add_index "posts", %w[forum_thread_id post_number], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,9 +13,8 @@ class CreatePostActions < ActiveRecord::Migration[4.2]
|
|||
add_index :post_actions, ["post_id"]
|
||||
|
||||
# no support for this till rails 4
|
||||
execute 'create unique index idx_unique_actions on
|
||||
post_actions(user_id, post_action_type_id, post_id) where deleted_at is null'
|
||||
|
||||
execute "create unique index idx_unique_actions on
|
||||
post_actions(user_id, post_action_type_id, post_id) where deleted_at is null"
|
||||
end
|
||||
def down
|
||||
drop_table :post_actions
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class RenameActionsToUserActions < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
rename_table 'actions', 'user_actions'
|
||||
rename_table "actions", "user_actions"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class RetireExpressions < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
execute 'insert into post_actions (post_action_type_id, user_id, post_id, created_at, updated_at)
|
||||
execute "insert into post_actions (post_action_type_id, user_id, post_id, created_at, updated_at)
|
||||
select
|
||||
case
|
||||
when expression_index=1 then 3
|
||||
|
@ -10,10 +10,10 @@ select
|
|||
when expression_index=3 then 2
|
||||
end
|
||||
|
||||
, user_id, post_id, created_at, updated_at from expressions'
|
||||
, user_id, post_id, created_at, updated_at from expressions"
|
||||
|
||||
drop_table 'expressions'
|
||||
drop_table 'expression_types'
|
||||
drop_table "expressions"
|
||||
drop_table "expression_types"
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
class RenameExpressionColumnsInForumThread < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
rename_column 'forum_threads', 'expression1_count', 'off_topic_count'
|
||||
rename_column 'forum_threads', 'expression2_count', 'offensive_count'
|
||||
rename_column 'forum_threads', 'expression3_count', 'like_count'
|
||||
remove_column 'forum_threads', 'expression4_count'
|
||||
remove_column 'forum_threads', 'expression5_count'
|
||||
|
||||
rename_column "forum_threads", "expression1_count", "off_topic_count"
|
||||
rename_column "forum_threads", "expression2_count", "offensive_count"
|
||||
rename_column "forum_threads", "expression3_count", "like_count"
|
||||
remove_column "forum_threads", "expression4_count"
|
||||
remove_column "forum_threads", "expression5_count"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
class RenameExpressionColumnsInPosts < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
rename_column 'posts', 'expression1_count', 'off_topic_count'
|
||||
rename_column 'posts', 'expression2_count', 'offensive_count'
|
||||
rename_column 'posts', 'expression3_count', 'like_count'
|
||||
remove_column 'posts', 'expression4_count'
|
||||
remove_column 'posts', 'expression5_count'
|
||||
rename_column "posts", "expression1_count", "off_topic_count"
|
||||
rename_column "posts", "expression2_count", "offensive_count"
|
||||
rename_column "posts", "expression3_count", "like_count"
|
||||
remove_column "posts", "expression4_count"
|
||||
remove_column "posts", "expression5_count"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
class AddUniqueIndexToForumThreadLinks < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
|
||||
execute "DELETE FROM forum_thread_links USING forum_thread_links ftl2
|
||||
WHERE ftl2.forum_thread_id = forum_thread_links.forum_thread_id
|
||||
AND ftl2.post_id = forum_thread_links.post_id
|
||||
|
@ -10,6 +9,9 @@ class AddUniqueIndexToForumThreadLinks < ActiveRecord::Migration[4.2]
|
|||
AND ftl2.id < forum_thread_links.id"
|
||||
|
||||
# Add the unique index
|
||||
add_index :forum_thread_links, [:forum_thread_id, :post_id, :url], unique: true, name: 'unique_post_links'
|
||||
add_index :forum_thread_links,
|
||||
%i[forum_thread_id post_id url],
|
||||
unique: true,
|
||||
name: "unique_post_links"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
class AddUniqueConstraintToUserActions < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_index :user_actions, ['action_type', 'user_id', 'target_forum_thread_id', 'target_post_id', 'acting_user_id'], name: "idx_unique_rows", unique: true
|
||||
add_index :user_actions,
|
||||
%w[action_type user_id target_forum_thread_id target_post_id acting_user_id],
|
||||
name: "idx_unique_rows",
|
||||
unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,20 +3,21 @@
|
|||
class AddStarredAtToForumThreadUser < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
add_column :forum_thread_users, :starred_at, :datetime
|
||||
DB.exec 'update forum_thread_users f set starred_at = COALESCE(created_at, ?)
|
||||
DB.exec "update forum_thread_users f set starred_at = COALESCE(created_at, ?)
|
||||
from
|
||||
(
|
||||
select f1.forum_thread_id, f1.user_id, t.created_at from forum_thread_users f1
|
||||
left join forum_threads t on f1.forum_thread_id = t.id
|
||||
) x
|
||||
where x.forum_thread_id = f.forum_thread_id and x.user_id = f.user_id', [DateTime.now]
|
||||
where x.forum_thread_id = f.forum_thread_id and x.user_id = f.user_id",
|
||||
[DateTime.now]
|
||||
|
||||
# probably makes sense to move this out to forum_thread_actions
|
||||
execute 'alter table forum_thread_users add constraint test_starred_at check(starred = false or starred_at is not null)'
|
||||
execute "alter table forum_thread_users add constraint test_starred_at check(starred = false or starred_at is not null)"
|
||||
end
|
||||
|
||||
def down
|
||||
execute 'alter table forum_thread_users drop constraint test_starred_at'
|
||||
execute "alter table forum_thread_users drop constraint test_starred_at"
|
||||
remove_column :forum_thread_users, :starred_at
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,6 @@ class CreateCategoryFeaturedUsers < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :category_featured_users, [:category_id, :user_id], unique: true
|
||||
add_index :category_featured_users, %i[category_id user_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,6 @@ class CreatePostOneboxRenders < ActiveRecord::Migration[4.2]
|
|||
t.references :onebox_render, null: false
|
||||
t.timestamps null: false
|
||||
end
|
||||
add_index :post_onebox_renders, [:post_id, :onebox_render_id], unique: true
|
||||
add_index :post_onebox_renders, %i[post_id onebox_render_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
class AddSubTagToForumThreads < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :forum_threads, :sub_tag, :string
|
||||
add_index :forum_threads, [:category_id, :sub_tag, :bumped_at]
|
||||
add_index :forum_threads, %i[category_id sub_tag bumped_at]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddHasBestOfToForumThreads < ActiveRecord::Migration[4.2]
|
||||
|
||||
def change
|
||||
add_column :forum_threads, :has_best_of, :boolean, default: false, null: false
|
||||
change_column :posts, :score, :float
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class AddTwitterUserInfo < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :twitter_user_infos do |t|
|
||||
create_table :twitter_user_infos do |t|
|
||||
t.integer :user_id, null: false
|
||||
t.string :screen_name, null: false
|
||||
t.integer :twitter_user_id, null: false
|
||||
|
|
|
@ -18,5 +18,4 @@ class CreateArchetypes < ActiveRecord::Migration[4.2]
|
|||
remove_column :forum_threads, :archetype_id
|
||||
drop_table :archetypes
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -10,6 +10,6 @@ class CreateEmailLogs < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
|
||||
add_index :email_logs, :created_at, order: { created_at: :desc }
|
||||
add_index :email_logs, [:user_id, :created_at], order: { created_at: :desc }
|
||||
add_index :email_logs, %i[user_id created_at], order: { created_at: :desc }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class ConvertArchetypes < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
add_column :forum_threads, :archetype, :string, default: 'regular', null: false
|
||||
add_column :forum_threads, :archetype, :string, default: "regular", null: false
|
||||
execute "UPDATE forum_threads SET archetype = a.name_key FROM archetypes AS a WHERE a.id = forum_threads.archetype_id"
|
||||
remove_column :forum_threads, :archetype_id
|
||||
|
||||
|
|
|
@ -2,39 +2,39 @@
|
|||
|
||||
class RenameForumThreadTables < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
rename_table 'forum_threads', 'topics'
|
||||
rename_table 'forum_thread_link_clicks', 'topic_link_clicks'
|
||||
rename_table 'forum_thread_links', 'topic_links'
|
||||
rename_table 'forum_thread_users', 'topic_users'
|
||||
rename_table 'category_featured_threads', 'category_featured_topics'
|
||||
rename_table "forum_threads", "topics"
|
||||
rename_table "forum_thread_link_clicks", "topic_link_clicks"
|
||||
rename_table "forum_thread_links", "topic_links"
|
||||
rename_table "forum_thread_users", "topic_users"
|
||||
rename_table "category_featured_threads", "category_featured_topics"
|
||||
|
||||
rename_column 'categories', 'forum_thread_id', 'topic_id'
|
||||
rename_column 'categories', 'top1_forum_thread_id', 'top1_topic_id'
|
||||
rename_column 'categories', 'top2_forum_thread_id', 'top2_topic_id'
|
||||
rename_column 'categories', 'forum_thread_count', 'topic_count'
|
||||
rename_column 'categories', 'threads_year', 'topics_year'
|
||||
rename_column 'categories', 'threads_month', 'topics_month'
|
||||
rename_column 'categories', 'threads_week', 'topics_week'
|
||||
rename_column "categories", "forum_thread_id", "topic_id"
|
||||
rename_column "categories", "top1_forum_thread_id", "top1_topic_id"
|
||||
rename_column "categories", "top2_forum_thread_id", "top2_topic_id"
|
||||
rename_column "categories", "forum_thread_count", "topic_count"
|
||||
rename_column "categories", "threads_year", "topics_year"
|
||||
rename_column "categories", "threads_month", "topics_month"
|
||||
rename_column "categories", "threads_week", "topics_week"
|
||||
|
||||
rename_column 'category_featured_topics', 'forum_thread_id', 'topic_id'
|
||||
rename_column "category_featured_topics", "forum_thread_id", "topic_id"
|
||||
|
||||
rename_column 'topic_link_clicks', 'forum_thread_link_id', 'topic_link_id'
|
||||
rename_column "topic_link_clicks", "forum_thread_link_id", "topic_link_id"
|
||||
|
||||
rename_column 'topic_links', 'forum_thread_id', 'topic_id'
|
||||
rename_column 'topic_links', 'link_forum_thread_id', 'link_topic_id'
|
||||
rename_column "topic_links", "forum_thread_id", "topic_id"
|
||||
rename_column "topic_links", "link_forum_thread_id", "link_topic_id"
|
||||
|
||||
rename_column 'topic_users', 'forum_thread_id', 'topic_id'
|
||||
rename_column "topic_users", "forum_thread_id", "topic_id"
|
||||
|
||||
rename_column 'incoming_links', 'forum_thread_id', 'topic_id'
|
||||
rename_column "incoming_links", "forum_thread_id", "topic_id"
|
||||
|
||||
rename_column 'notifications', 'forum_thread_id', 'topic_id'
|
||||
rename_column "notifications", "forum_thread_id", "topic_id"
|
||||
|
||||
rename_column 'post_timings', 'forum_thread_id', 'topic_id'
|
||||
rename_column "post_timings", "forum_thread_id", "topic_id"
|
||||
|
||||
rename_column 'posts', 'forum_thread_id', 'topic_id'
|
||||
rename_column "posts", "forum_thread_id", "topic_id"
|
||||
|
||||
rename_column 'user_actions', 'target_forum_thread_id', 'target_topic_id'
|
||||
rename_column "user_actions", "target_forum_thread_id", "target_topic_id"
|
||||
|
||||
rename_column 'uploads', 'forum_thread_id', 'topic_id'
|
||||
rename_column "uploads", "forum_thread_id", "topic_id"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class CreateTopicAllowedUsers < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :topic_allowed_users, [:topic_id, :user_id], unique: true
|
||||
add_index :topic_allowed_users, [:user_id, :topic_id], unique: true
|
||||
add_index :topic_allowed_users, %i[topic_id user_id], unique: true
|
||||
add_index :topic_allowed_users, %i[user_id topic_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,6 @@ class DropAvatarUrlFromUsers < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
|
||||
def down
|
||||
add_column :users, :avatar_url, :string, null: false, default: ''
|
||||
add_column :users, :avatar_url, :string, null: false, default: ""
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,6 @@ class CreateInvites < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
|
||||
add_index :invites, :invite_key, unique: true
|
||||
add_index :invites, [:email, :invited_by_id], unique: true
|
||||
add_index :invites, %i[email invited_by_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class CreateTopicInvites < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :topic_invites, [:topic_id, :invite_id], unique: true
|
||||
add_index :topic_invites, %i[topic_id invite_id], unique: true
|
||||
add_index :topic_invites, :invite_id
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
class MakePostNumberDistinct < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
DB.exec('update posts p
|
||||
DB.exec(
|
||||
"update posts p
|
||||
set post_number = calc
|
||||
from
|
||||
(
|
||||
|
@ -20,7 +20,8 @@ from
|
|||
)
|
||||
|
||||
) as X
|
||||
where calc <> p.post_number and X.id = p.id')
|
||||
where calc <> p.post_number and X.id = p.id",
|
||||
)
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -7,6 +7,6 @@ class CreateUserVisits < ActiveRecord::Migration[4.2]
|
|||
t.date :visited_at, null: false
|
||||
end
|
||||
|
||||
add_index :user_visits, [:user_id, :visited_at], unique: true
|
||||
add_index :user_visits, %i[user_id visited_at], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,6 @@ class CreateDrafts < ActiveRecord::Migration[4.2]
|
|||
t.text :data, null: false
|
||||
t.timestamps null: false
|
||||
end
|
||||
add_index :drafts, [:user_id, :draft_key]
|
||||
add_index :drafts, %i[user_id draft_key]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,22 +4,21 @@ class FixLinkPostId < ActiveRecord::Migration[4.2]
|
|||
def up
|
||||
to_remove = []
|
||||
|
||||
TopicLink.where('internal = TRUE AND link_post_id IS NULL').each do |tl|
|
||||
|
||||
begin
|
||||
parsed = URI.parse(tl.url)
|
||||
route = Rails.application.routes.recognize_path(parsed.path)
|
||||
if route[:topic_id].present?
|
||||
post = Post.find_by(topic_id: route[:topic_id], post_number: (route[:post_number] || 1))
|
||||
tl.update_column(:link_post_id, post.id) if post.present?
|
||||
TopicLink
|
||||
.where("internal = TRUE AND link_post_id IS NULL")
|
||||
.each do |tl|
|
||||
begin
|
||||
parsed = URI.parse(tl.url)
|
||||
route = Rails.application.routes.recognize_path(parsed.path)
|
||||
if route[:topic_id].present?
|
||||
post = Post.find_by(topic_id: route[:topic_id], post_number: (route[:post_number] || 1))
|
||||
tl.update_column(:link_post_id, post.id) if post.present?
|
||||
end
|
||||
rescue ActionController::RoutingError
|
||||
to_remove << tl.id
|
||||
end
|
||||
|
||||
rescue ActionController::RoutingError
|
||||
to_remove << tl.id
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
TopicLink.where("id in (?)", to_remove).delete_all
|
||||
end
|
||||
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
class AddOverrideDefaultStyleToSiteCustomization < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :site_customizations, :override_default_style, :boolean, default: false, null: false
|
||||
add_column :site_customizations, :stylesheet_baked, :text, default: '', null: false
|
||||
add_column :site_customizations, :stylesheet_baked, :text, default: "", null: false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,6 @@ class CreateDraftSequence < ActiveRecord::Migration[4.2]
|
|||
t.string :draft_key, null: false
|
||||
t.integer :sequence, null: false
|
||||
end
|
||||
add_index :draft_sequences, [:user_id, :draft_key], unique: true
|
||||
add_index :draft_sequences, %i[user_id draft_key], unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class OopsUnwatchABoatOfWatchedStuff < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
execute 'update topic_users set notification_level = 1 where notifications_reason_id is null and notification_level = 2'
|
||||
execute "update topic_users set notification_level = 1 where notifications_reason_id is null and notification_level = 2"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
class FixSearch < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
execute 'drop index idx_search_thread'
|
||||
execute 'drop index idx_search_user'
|
||||
execute "drop index idx_search_thread"
|
||||
execute "drop index idx_search_user"
|
||||
|
||||
execute 'create table posts_search (id integer not null primary key, search_data tsvector)'
|
||||
execute 'create table users_search (id integer not null primary key, search_data tsvector)'
|
||||
execute 'create table categories_search (id integer not null primary key, search_data tsvector)'
|
||||
execute "create table posts_search (id integer not null primary key, search_data tsvector)"
|
||||
execute "create table users_search (id integer not null primary key, search_data tsvector)"
|
||||
execute "create table categories_search (id integer not null primary key, search_data tsvector)"
|
||||
|
||||
execute 'create index idx_search_post on posts_search using gin(search_data) '
|
||||
execute 'create index idx_search_user on users_search using gin(search_data) '
|
||||
execute 'create index idx_search_category on categories_search using gin(search_data) '
|
||||
execute "create index idx_search_post on posts_search using gin(search_data) "
|
||||
execute "create index idx_search_user on users_search using gin(search_data) "
|
||||
execute "create index idx_search_category on categories_search using gin(search_data) "
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
class AddTrackingToTopicUsers < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
execute 'update topic_users set notification_level = 3 where notification_level = 2'
|
||||
execute "update topic_users set notification_level = 3 where notification_level = 2"
|
||||
end
|
||||
def down
|
||||
execute 'update topic_users set notification_level = 2 where notification_level = 3'
|
||||
execute "update topic_users set notification_level = 2 where notification_level = 3"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,11 +12,11 @@ class AddAutoTrackAfterSecondsAndBanningAndDobToUser < ActiveRecord::Migration[4
|
|||
|
||||
add_column :topic_users, :total_msecs_viewed, :integer, null: false, default: 0
|
||||
|
||||
execute 'update topic_users set total_msecs_viewed =
|
||||
execute "update topic_users set total_msecs_viewed =
|
||||
(
|
||||
select coalesce(sum(msecs) ,0)
|
||||
from post_timings t
|
||||
where topic_users.topic_id = t.topic_id and topic_users.user_id = t.user_id
|
||||
)'
|
||||
)"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
class AutoTrackAllTopicsRepliedTo < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
execute 'update topic_users set notification_level = 2, notifications_reason_id = 4
|
||||
execute "update topic_users set notification_level = 2, notifications_reason_id = 4
|
||||
from posts p
|
||||
where
|
||||
notification_level = 1 and
|
||||
notifications_reason_id is null and
|
||||
p.topic_id = topic_users.topic_id and
|
||||
p.user_id = topic_users.user_id
|
||||
'
|
||||
"
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
class CorrectIndexOnPostAction < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
remove_index "post_actions", name: "idx_unique_actions"
|
||||
add_index "post_actions", ["user_id", "post_action_type_id", "post_id", "deleted_at"], name: "idx_unique_actions", unique: true
|
||||
add_index "post_actions",
|
||||
%w[user_id post_action_type_id post_id deleted_at],
|
||||
name: "idx_unique_actions",
|
||||
unique: true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,5 +11,4 @@ class RemoveTrustLevels < ActiveRecord::Migration[4.2]
|
|||
remove_column :users, :moderator
|
||||
add_column :users, :flag_level, :integer, null: false, default: 0
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class RemoveIndexFromViews < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
|
||||
def down
|
||||
add_index "views", ["parent_id", "parent_type", "ip", "viewed_at"], name: "unique_views", unique: true
|
||||
add_index "views", %w[parent_id parent_type ip viewed_at], name: "unique_views", unique: true
|
||||
change_column :views, :viewed_at, :timestamp
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
class AddIpAddressToUsers < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
execute 'alter table users add column ip_address inet'
|
||||
execute "alter table users add column ip_address inet"
|
||||
end
|
||||
def down
|
||||
execute 'alter table users drop column ip_address'
|
||||
execute "alter table users drop column ip_address"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class RemoveTopicResponseActions < ActiveRecord::Migration[4.2]
|
|||
#
|
||||
# There is an open question about we should keep stuff in the user stream on the user page, even if a topic is unwatched
|
||||
# Eg: I am not watching a topic I created, when somebody responds to the topic should I be notified on the user page?
|
||||
execute 'delete from user_actions where action_type = 8'
|
||||
execute "delete from user_actions where action_type = 8"
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -13,23 +13,22 @@ class AddDescriptionToCategories < ActiveRecord::Migration[4.2]
|
|||
# some ancient installs may have bad category descriptions
|
||||
# attempt to fix
|
||||
if !DB.query_single("SELECT 1 FROM categories limit 1").empty?
|
||||
|
||||
# Reaching into post revisor is not ideal here, but this code
|
||||
# should almost never run, so bypass it
|
||||
Discourse.reset_active_record_cache
|
||||
|
||||
Category.order('id').each do |c|
|
||||
post = c.topic.ordered_posts.first
|
||||
PostRevisor.new(post).update_category_description
|
||||
end
|
||||
Category
|
||||
.order("id")
|
||||
.each do |c|
|
||||
post = c.topic.ordered_posts.first
|
||||
PostRevisor.new(post).update_category_description
|
||||
end
|
||||
|
||||
Discourse.reset_active_record_cache
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :categories, :description
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class AddGithubUserInfo < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
create_table :github_user_infos do |t|
|
||||
create_table :github_user_infos do |t|
|
||||
t.integer :user_id, null: false
|
||||
t.string :screen_name, null: false
|
||||
t.integer :github_user_id, null: false
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
class AddForegroundColorToCategories < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
add_column :categories, :text_color, :string, limit: 6, null: false, default: 'FFFFFF'
|
||||
add_column :categories, :text_color, :string, limit: 6, null: false, default: "FFFFFF"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,12 +4,12 @@ class AddReplyToUserIdToPost < ActiveRecord::Migration[4.2]
|
|||
def up
|
||||
# caching this column makes the topic page WAY faster
|
||||
add_column :posts, :reply_to_user_id, :integer
|
||||
execute 'UPDATE posts p SET reply_to_user_id = (
|
||||
execute "UPDATE posts p SET reply_to_user_id = (
|
||||
SELECT u.id from users u
|
||||
JOIN posts p2 ON p2.user_id = u.id AND
|
||||
p2.post_number = p.reply_to_post_number AND
|
||||
p2.topic_id = p.topic_id
|
||||
)'
|
||||
)"
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -9,6 +9,5 @@ class AddPercentRankToPosts < ActiveRecord::Migration[4.2]
|
|||
OVER (PARTITION BY topic_id ORDER BY SCORE DESC)
|
||||
FROM posts) AS x
|
||||
WHERE x.id = posts.id"
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,6 @@ class CreateHotTopics < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
|
||||
add_index :hot_topics, :topic_id, unique: true
|
||||
add_index :hot_topics, :score, order: 'desc'
|
||||
add_index :hot_topics, :score, order: "desc"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
class AddUserExtras < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
|
||||
# NOTE: our user table is getting bloated, we probably want to split it for performance
|
||||
# put lesser used columns into a user_extras table and frequently used ones here.
|
||||
add_column :users, :likes_given, :integer, null: false, default: 0
|
||||
|
@ -27,7 +26,7 @@ FROM (
|
|||
WHERE X.user_id = u.id
|
||||
SQL
|
||||
|
||||
execute <<SQL
|
||||
execute <<SQL
|
||||
UPDATE users u
|
||||
SET
|
||||
likes_received = Y.likes_received
|
||||
|
@ -43,7 +42,7 @@ FROM (
|
|||
WHERE Y.user_id = u.id
|
||||
SQL
|
||||
|
||||
execute <<SQL
|
||||
execute <<SQL
|
||||
UPDATE users u
|
||||
SET
|
||||
topic_reply_count = Z.topic_reply_count
|
||||
|
@ -60,7 +59,6 @@ FROM (
|
|||
WHERE
|
||||
Z.user_id = u.id
|
||||
SQL
|
||||
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
class CreateAdminLogs < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
create_table :admin_logs, force: true do |t|
|
||||
t.integer :action, null: false
|
||||
t.integer :admin_id, null: false
|
||||
t.integer :action, null: false
|
||||
t.integer :admin_id, null: false
|
||||
t.integer :target_user_id
|
||||
t.text :details
|
||||
t.text :details
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,6 @@ class GroupUsers < ActiveRecord::Migration[4.2]
|
|||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :group_users, [:group_id, :user_id], unique: true
|
||||
add_index :group_users, %i[group_id user_id], unique: true
|
||||
end
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue