mirror of
https://github.com/discourse/discourse.git
synced 2025-10-03 17:21:20 +08:00
DEV: Make SQL
constant in IntermediateDB models private (#34610)
This commit is contained in:
parent
9076fe4b54
commit
8f00667e83
25 changed files with 25 additions and 5 deletions
|
@ -33,6 +33,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(
|
||||
original_id:,
|
||||
|
|
|
@ -18,6 +18,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(original_id:, created_at: nil, description: nil, name:, position:)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -60,6 +60,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(
|
||||
original_id:,
|
||||
|
|
|
@ -16,6 +16,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(category_id:, name:, value: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(SQL, category_id, name, value)
|
||||
|
|
|
@ -17,6 +17,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(category_id:, user_id:, last_seen_at: nil, notification_level:)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -38,6 +38,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(
|
||||
original_id:,
|
||||
|
|
|
@ -18,6 +18,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(group_id:, user_id:, created_at: nil, notification_level: nil, owner: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -10,6 +10,7 @@ module Migrations::Database::IntermediateDB
|
|||
INSERT INTO log_entries (created_at, type, message, exception, details)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(created_at: Time.now, type:, message:, exception: nil, details: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -16,6 +16,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(created_at: nil, muted_user_id:, user_id:)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -6,6 +6,7 @@ module Migrations::Database::IntermediateDB
|
|||
INSERT INTO permalink_normalizations (normalization)
|
||||
VALUES (?)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(normalization:)
|
||||
::Migrations::Database::IntermediateDB.insert(SQL, normalization)
|
||||
|
|
|
@ -17,6 +17,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(original_id:, created_at: nil, description: nil, name:)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -18,6 +18,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(original_id:, created_at: nil, name:, one_per_topic: nil, parent_tag_id: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -16,6 +16,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(tag_group_id:, tag_id:, created_at: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -17,6 +17,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(group_id:, permission_type:, tag_group_id:, created_at: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -6,6 +6,7 @@ module Migrations::Database::IntermediateDB
|
|||
INSERT INTO tag_synonyms (synonym_tag_id, target_tag_id)
|
||||
VALUES (?, ?)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(synonym_tag_id:, target_tag_id:)
|
||||
::Migrations::Database::IntermediateDB.insert(SQL, synonym_tag_id, target_tag_id)
|
||||
|
|
|
@ -17,6 +17,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(tag_id:, user_id:, created_at: nil, notification_level:)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -16,6 +16,7 @@ module Migrations::Database::IntermediateDB
|
|||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create_for_file(
|
||||
path:,
|
||||
|
|
|
@ -41,6 +41,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(
|
||||
original_id:,
|
||||
|
|
|
@ -17,6 +17,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(email:, user_id:, created_at: nil, primary: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -26,6 +26,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(
|
||||
original_id:,
|
||||
|
|
|
@ -16,6 +16,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(user_field_id:, value:, created_at: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -79,6 +79,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(
|
||||
user_id:,
|
||||
|
|
|
@ -14,6 +14,7 @@ module Migrations::Database::IntermediateDB
|
|||
?, ?, ?, ?, ?
|
||||
)
|
||||
SQL
|
||||
private_constant :SQL
|
||||
|
||||
def self.create(user_id:, suspended_at:, suspended_till: nil, suspended_by_id: nil, reason: nil)
|
||||
::Migrations::Database::IntermediateDB.insert(
|
||||
|
|
|
@ -48,6 +48,7 @@ module Migrations::Database::Schema
|
|||
output_stream.puts value_placeholders(columns)
|
||||
output_stream.puts " )"
|
||||
output_stream.puts " SQL"
|
||||
output_stream.puts " private_constant :SQL"
|
||||
output_stream.puts
|
||||
output_stream.puts " def self.create("
|
||||
output_stream.puts method_parameters(columns)
|
||||
|
@ -64,7 +65,7 @@ module Migrations::Database::Schema
|
|||
private
|
||||
|
||||
def to_singular_classname(snake_case_string)
|
||||
snake_case_string.singularize.camelize
|
||||
snake_case_string.downcase.singularize.camelize
|
||||
end
|
||||
|
||||
def column_names(columns)
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.shared_examples "a database entity" do
|
||||
it "has SQL constant" do
|
||||
expect(subject).to have_constant(:SQL)
|
||||
end
|
||||
|
||||
it "responds to .create" do
|
||||
expect(subject).to respond_to(:create)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue