Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run migrations from scratch in Rails 8.0 #53991

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
run migrations from scratch in Rails 8.0
  • Loading branch information
S-surendrasingh committed Dec 18, 2024
commit 211bb385324decdb82267b5b3b664435c5e50df3
21 changes: 17 additions & 4 deletions .github/workflows/devcontainer-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
imageTag: sqlite3
push: ${{ github.repository == 'rails/rails' && 'filter' || 'never' }}
refFilterForPush: refs/heads/main
runCmd: bin/rails g scaffold Post && bin/rails db:migrate && bin/rails test
runCmd: |
bin/rails g scaffold Post
rails db:migrate_without_schema
bin/rails test

- name: Stop all containers
run: docker ps -q | xargs docker stop
Expand All @@ -59,7 +62,11 @@ jobs:
imageTag: postgresql
push: ${{ github.repository == 'rails/rails' && 'filter' || 'never' }}
refFilterForPush: refs/heads/main
runCmd: bin/rails g scaffold Post && bin/rails db:migrate && bin/rails test && bin/rails test:system
runCmd: |
bin/rails g scaffold Post
rails db:migrate_without_schema
bin/rails test
bin/rails test:system

- name: Stop all containers
run: docker ps -q | xargs docker stop
Expand All @@ -76,7 +83,10 @@ jobs:
imageTag: mysql
push: ${{ github.repository == 'rails/rails' && 'filter' || 'never' }}
refFilterForPush: refs/heads/main
runCmd: bin/rails g scaffold Post && bin/rails db:migrate && bin/rails test
runCmd: |
bin/rails g scaffold Post
rails db:migrate_without_schema
bin/rails test

- name: Stop all containers
run: docker ps -q | xargs docker stop
Expand All @@ -93,7 +103,10 @@ jobs:
imageTag: trilogy
push: ${{ github.repository == 'rails/rails' && 'filter' || 'never' }}
refFilterForPush: refs/heads/main
runCmd: bin/rails g scaffold Post && bin/rails db:migrate && bin/rails test
runCmd: |
bin/rails g scaffold Post
rails db:migrate_without_schema
bin/rails test

- name: Stop all containers
run: docker ps -q | xargs docker stop
6 changes: 6 additions & 0 deletions railties/lib/rails/tasks/db_migrate_without_schema.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace :db do
desc "Run migrations without loading schema.rb"
task migrate_without_schema: :environment do
ActiveRecord::Tasks::DatabaseTasks.migrate(skip_initialize: true)
end
end
Loading