You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am just letting you know that the https://railseventstore.org/docs/v2/install/#existing-rails-application doesn't seem to work for existing Rails applications. I tested it locally both on one of my pet projects running on Rails 7.1.2 and on a fresh, vanilla Rails project generated with 7.1.3, so hopefully you'll be able to recreate it easily too.
The problem is that the app:template script creates duplicate migrations, as can be seen on the screenshot here:
and fails on trying to migrate them both:
bin/rails app:template LOCATION=https://railseventstore.org/new
apply https://railseventstore.org/new
gemfile rails_event_store (~> 2.14.0)
initializer rails_event_store.rb
route mount RailsEventStore::Browser => '/res' if Rails.env.development?
run bundle check from "."
Could not find gem 'rails_event_store (~> 2.14.0)' in locally installed gems.
Run `bundle install --gemfile /home/beu/FreelanceProjects/lol/Gemfile` to install missing gems.
run bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Fetching arkency-command_bus 0.4.1
Fetching ruby_event_store 2.14.0
Installing arkency-command_bus 0.4.1
Installing ruby_event_store 2.14.0
Fetching ruby_event_store-browser 2.14.0
Fetching ruby_event_store-active_record 2.14.0
Fetching aggregate_root 2.14.0
Installing aggregate_root 2.14.0
Installing ruby_event_store-active_record 2.14.0
Installing ruby_event_store-browser 2.14.0
Fetching rails_event_store_active_record 2.14.0
Installing rails_event_store_active_record 2.14.0
Fetching rails_event_store 2.14.0
Installing rails_event_store 2.14.0
Bundle complete! 16 Gemfile dependencies, 91 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
rails db:create
Created database 'storage/development.sqlite3'
Created database 'storage/test.sqlite3'
generate rails_event_store_active_record:migration --data-type=binary
rails generate rails_event_store_active_record:migration --data-type=binary
create db/migrate/20240215173726_create_event_store_events.rb
rails db:migrate
== 20240215173726 CreateEventStoreEvents: migrating ===========================
-- create_table(:event_store_events_in_streams, {:force=>false})
-> 0.0013s
-- add_index(:event_store_events_in_streams, [:stream, :position], {:unique=>true})
-> 0.0004s
-- add_index(:event_store_events_in_streams, [:stream, :event_id], {:unique=>true})
-> 0.0004s
-- add_index(:event_store_events_in_streams, [:event_id])
-> 0.0004s
-- create_table(:event_store_events, {:force=>false})
-> 0.0019s
-- add_foreign_key("event_store_events_in_streams", "event_store_events", {:column=>"event_id", :primary_key=>"event_id"})
-> 0.0106s
== 20240215173726 CreateEventStoreEvents: migrated (0.0150s) ==================
run bundle install
Bundle complete! 16 Gemfile dependencies, 91 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
rails db:create
Database 'storage/development.sqlite3' already exists
Database 'storage/test.sqlite3' already exists
generate rails_event_store_active_record:migration --data-type=binary
rails generate rails_event_store_active_record:migration --data-type=binary
create db/migrate/20240215173728_create_event_store_events.rb
rails db:migrate
bin/rails aborted!
ActiveRecord::DuplicateMigrationNameError:
Multiple migrations have the name CreateEventStoreEvents.
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Since Rails app:template command seems to execute the run_bundle and run_after_bundle_callbacks anyway, I quickfixed it for myself, by executing the provided template locally, with the following code part removed:
profile.for_existing_app do
run_after_bundle_callbacks
end
The text was updated successfully, but these errors were encountered:
It's been changed with the commit: rails/rails@83e69c2
I'll add a version check to the template and conditionally run `run_after_bundle_check' only for versions older than 7.1.
Hi,
I am just letting you know that the https://railseventstore.org/docs/v2/install/#existing-rails-application doesn't seem to work for existing Rails applications. I tested it locally both on one of my pet projects running on Rails 7.1.2 and on a fresh, vanilla Rails project generated with 7.1.3, so hopefully you'll be able to recreate it easily too.
The problem is that the app:template script creates duplicate migrations, as can be seen on the screenshot here:
and fails on trying to migrate them both:
Since Rails
app:template
command seems to execute therun_bundle
andrun_after_bundle_callbacks
anyway, I quickfixed it for myself, by executing the provided template locally, with the following code part removed:The text was updated successfully, but these errors were encountered: