fix errors in migration scripts

This commit is contained in:
Thomas Peetz
2025-06-28 18:19:14 +02:00
parent 1be2dcbdfc
commit eab74a62f7
12 changed files with 128 additions and 6 deletions
+1
View File
@@ -54,6 +54,7 @@ end
group :development do group :development do
# Use console on exceptions pages [https://github.com/rails/web-console] # Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console" gem "web-console"
gem "rails-erd"
end end
group :test do group :test do
+9
View File
@@ -94,6 +94,7 @@ GEM
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0) regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2) xpath (~> 3.2)
choice (0.2.0)
concurrent-ruby (1.3.5) concurrent-ruby (1.3.5)
connection_pool (2.5.3) connection_pool (2.5.3)
crass (1.0.6) crass (1.0.6)
@@ -230,6 +231,11 @@ GEM
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
minitest minitest
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-erd (1.7.2)
activerecord (>= 4.2)
activesupport (>= 4.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.6.2) rails-html-sanitizer (1.6.2)
loofah (~> 2.21) loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
@@ -278,6 +284,8 @@ GEM
rubocop (>= 1.72) rubocop (>= 1.72)
rubocop-performance (>= 1.24) rubocop-performance (>= 1.24)
rubocop-rails (>= 2.30) rubocop-rails (>= 2.30)
ruby-graphviz (1.2.5)
rexml
ruby-progressbar (1.13.0) ruby-progressbar (1.13.0)
rubyzip (2.4.1) rubyzip (2.4.1)
securerandom (0.4.1) securerandom (0.4.1)
@@ -369,6 +377,7 @@ DEPENDENCIES
propshaft propshaft
puma (>= 5.0) puma (>= 5.0)
rails (~> 8.0.2) rails (~> 8.0.2)
rails-erd
rubocop-rails-omakase rubocop-rails-omakase
selenium-webdriver selenium-webdriver
solid_cable solid_cable
@@ -0,0 +1,4 @@
class PublisherController < ApplicationController
def index
end
end
@@ -0,0 +1,2 @@
module PublisherHelper
end
+1
View File
@@ -1,3 +1,4 @@
class Publisher < ApplicationRecord class Publisher < ApplicationRecord
has_many :imprints, class_name: "Publisher", foreign_key: "parent_publisher_id"
has_many :comics has_many :comics
end end
@@ -0,0 +1,2 @@
<h1>Publisher#index</h1>
<p>Find me in app/views/publisher/index.html.erb</p>
+1
View File
@@ -1,4 +1,5 @@
Rails.application.routes.draw do Rails.application.routes.draw do
get "/comic/publishers/", to: "publisher#index"
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
@@ -6,7 +6,7 @@ class CreatePublishers < ActiveRecord::Migration[8.0]
t.integer :version t.integer :version
t.string :name t.string :name
t.string :weblink t.string :weblink
t.belongs_to :publisher, optional: true t.string :parent_publisher_id
end end
change_column :publishers, :id, :string change_column :publishers, :id, :string
end end
@@ -8,7 +8,7 @@ class CreateComics < ActiveRecord::Migration[8.0]
t.boolean :current_order t.boolean :current_order
t.boolean :completed t.boolean :completed
t.string :weblink t.string :weblink
t.belongs_to :publisher, foreign_key: true t.belongs_to :publisher
end end
change_column :comics, :id, :string change_column :comics, :id, :string
end end
@@ -9,9 +9,9 @@ class CreateIssues < ActiveRecord::Migration[8.0]
t.datetime :published_on t.datetime :published_on
t.boolean :in_stock t.boolean :in_stock
t.boolean :is_read t.boolean :is_read
t.belongs_to :comic, foreign_key: true t.belongs_to :comic
t.belongs_to :volume, foreign_key: true t.belongs_to :volume
t.belongs_to :story_arc, foreign_key: true t.belongs_to :story_arc
end end
change_column :issues, :id, :string change_column :issues, :id, :string
end end
+95 -1
View File
@@ -10,5 +10,99 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 0) do ActiveRecord::Schema[8.0].define(version: 2025_06_26_100213) do
create_table "artists", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "comic_works", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "comics", id: false, force: :cascade do |t|
t.string "id"
t.datetime "created_date"
t.datetime "last_modified_date"
t.integer "version"
t.string "title"
t.boolean "current_order"
t.boolean "completed"
t.string "weblink"
t.integer "publisher_id"
t.index ["publisher_id"], name: "index_comics_on_publisher_id"
end
create_table "issue_works", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "issues", id: false, force: :cascade do |t|
t.string "id"
t.datetime "created_date"
t.datetime "last_modified_date"
t.integer "version"
t.string "issueNumber"
t.string "title"
t.datetime "published_on"
t.boolean "in_stock"
t.boolean "is_read"
t.integer "comic_id"
t.integer "volume_id"
t.integer "story_arc_id"
t.index ["comic_id"], name: "index_issues_on_comic_id"
t.index ["story_arc_id"], name: "index_issues_on_story_arc_id"
t.index ["volume_id"], name: "index_issues_on_volume_id"
end
create_table "publishers", id: false, force: :cascade do |t|
t.string "id"
t.datetime "created_date"
t.datetime "last_modified_date"
t.integer "version"
t.string "name"
t.string "weblink"
t.string "parent_publisher_id"
end
create_table "story_arcs", id: false, force: :cascade do |t|
t.string "id"
t.datetime "created_date"
t.datetime "last_modified_date"
t.integer "version"
t.string "name"
t.integer "comic_id"
t.index ["comic_id"], name: "index_story_arcs_on_comic_id"
end
create_table "trade_paperbacks", id: false, force: :cascade do |t|
t.string "id"
t.datetime "created_date"
t.datetime "last_modified_date"
t.integer "version"
t.string "name"
t.integer "issue_start"
t.integer "issue_end"
t.integer "comic_id"
t.index ["comic_id"], name: "index_trade_paperbacks_on_comic_id"
end
create_table "volumes", id: false, force: :cascade do |t|
t.string "id"
t.datetime "created_date"
t.datetime "last_modified_date"
t.integer "version"
t.string "name"
t.integer "comic_id"
t.index ["comic_id"], name: "index_volumes_on_comic_id"
end
create_table "worktypes", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end end
@@ -0,0 +1,8 @@
require "test_helper"
class PublisherControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get publisher_index_url
assert_response :success
end
end