このコミットが含まれているのは:
@@ -0,0 +1,22 @@
|
||||
class CreateMaterialSyncSources < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :material_sync_sources do |t|
|
||||
t.string :name, null: false
|
||||
t.string :source_kind, null: false
|
||||
t.string :source_uri
|
||||
t.string :source_path
|
||||
t.string :source_file_id
|
||||
t.string :profile, null: false, default: 'legacy_drive'
|
||||
t.boolean :enabled, null: false, default: true
|
||||
t.string :default_tag_name
|
||||
t.string :export_path_prefix
|
||||
t.datetime :last_synced_at
|
||||
t.references :created_by_user, foreign_key: { to_table: :users }
|
||||
t.references :updated_by_user, foreign_key: { to_table: :users }
|
||||
t.timestamps
|
||||
|
||||
t.index :enabled
|
||||
t.index :source_kind
|
||||
end
|
||||
end
|
||||
end
|
||||
生成ファイル
+24
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2026_06_25_000000) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2026_06_25_010000) do
|
||||
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "record_type", null: false
|
||||
@@ -155,6 +155,27 @@ ActiveRecord::Schema[8.0].define(version: 2026_06_25_000000) do
|
||||
t.index ["created_by_user_id"], name: "index_material_import_blocks_on_created_by_user_id"
|
||||
end
|
||||
|
||||
create_table "material_sync_sources", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "source_kind", null: false
|
||||
t.string "source_uri"
|
||||
t.string "source_path"
|
||||
t.string "source_file_id"
|
||||
t.string "profile", default: "legacy_drive", null: false
|
||||
t.boolean "enabled", default: true, null: false
|
||||
t.string "default_tag_name"
|
||||
t.string "export_path_prefix"
|
||||
t.datetime "last_synced_at"
|
||||
t.bigint "created_by_user_id"
|
||||
t.bigint "updated_by_user_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["created_by_user_id"], name: "index_material_sync_sources_on_created_by_user_id"
|
||||
t.index ["enabled"], name: "index_material_sync_sources_on_enabled"
|
||||
t.index ["source_kind"], name: "index_material_sync_sources_on_source_kind"
|
||||
t.index ["updated_by_user_id"], name: "index_material_sync_sources_on_updated_by_user_id"
|
||||
end
|
||||
|
||||
create_table "material_sync_suppressions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "source_kind", null: false
|
||||
t.string "source_uri"
|
||||
@@ -607,6 +628,8 @@ ActiveRecord::Schema[8.0].define(version: 2026_06_25_000000) do
|
||||
add_foreign_key "material_export_items", "materials"
|
||||
add_foreign_key "material_export_items", "users", column: "created_by_user_id"
|
||||
add_foreign_key "material_import_blocks", "users", column: "created_by_user_id"
|
||||
add_foreign_key "material_sync_sources", "users", column: "created_by_user_id"
|
||||
add_foreign_key "material_sync_sources", "users", column: "updated_by_user_id"
|
||||
add_foreign_key "material_sync_suppressions", "users", column: "created_by_user_id"
|
||||
add_foreign_key "material_versions", "materials"
|
||||
add_foreign_key "material_versions", "materials", column: "parent_id"
|
||||
|
||||
@@ -7,3 +7,21 @@
|
||||
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
|
||||
# MovieGenre.find_or_create_by!(name: genre_name)
|
||||
# end
|
||||
|
||||
material_sync_source_uri = ENV['MATERIAL_SYNC_SOURCE_URI']
|
||||
material_sync_source_tag_name = ENV['MATERIAL_SYNC_SOURCE_TAG_NAME']
|
||||
|
||||
if material_sync_source_uri.present? && material_sync_source_tag_name.present?
|
||||
source = MaterialSyncSource.find_or_initialize_by(
|
||||
name: ENV.fetch('MATERIAL_SYNC_SOURCE_NAME', 'Legacy URI material sync'))
|
||||
source.assign_attributes(
|
||||
source_kind: ENV.fetch('MATERIAL_SYNC_SOURCE_KIND', 'uri'),
|
||||
source_uri: material_sync_source_uri,
|
||||
source_path: ENV['MATERIAL_SYNC_SOURCE_PATH'],
|
||||
source_file_id: ENV['MATERIAL_SYNC_SOURCE_FILE_ID'],
|
||||
profile: ENV.fetch('MATERIAL_SYNC_SOURCE_PROFILE', 'legacy_drive'),
|
||||
enabled: ENV.fetch('MATERIAL_SYNC_SOURCE_ENABLED', 'true') != 'false',
|
||||
default_tag_name: material_sync_source_tag_name,
|
||||
export_path_prefix: ENV['MATERIAL_SYNC_EXPORT_PATH_PREFIX'])
|
||||
source.save!
|
||||
end
|
||||
|
||||
新しい課題から参照
ユーザをブロックする