public-accountability / oligrapher

JavaScript app for displaying annotated network graphs based on data from LittleSis
https://littlesis.org/oligrapher
GNU General Public License v3.0
101 stars 22 forks source link

Littlesis-rails issue ! #134

Closed domguard closed 8 months ago

domguard commented 1 year ago

Hello sorry to bother you here As there is no issue manager for the littlesis repo, i'm posting this here I followed the developer document to install through docker, I'm on debian 12 (testing) Everything runs smooth except in the end http://localhost:8080 (or 8081) gives me an error about db migrations :+1:


ActiveRecord::PendingMigrationError
Migrations are pending. To resolve this issue, run:
bin/rails db:migrate RAILS_ENV=development
You have 197 pending migrations:
20180117165745_change_int_length_for_address_category.rb
20180117190400_add_index_on_created_at_to_versions.rb
20180122192339_create_government_advisory_and_research_institute_enity_extensions.rb
20180123184642_add_new_fields_to_business.rb
20180123192048_create_cmp_entities.rb

(follow 197 migrations)

If i run a shell to try the migration, I get

bin/rails db:migrate RAILS_ENV=development
== 20180117165745 ChangeIntLengthForAddressCategory: migrating ================
-- remove_foreign_key(:address, :address_category)
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Table 'address' has no foreign key for address_category
/littlesis/db/migrate/20180117165745_change_int_length_for_address_category.rb:3:in 'change'

Caused by:
ArgumentError: Table 'address' has no foreign key for address_category
/littlesis/db/migrate/20180117165745_change_int_length_for_address_category.rb:3:in 'change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I'd like to setup a local littlesis version to work offline and perhaps, one day, help others with your tool

aepyornis commented 1 year ago

try db:schema:load or db:reset instead of running the migratations

aepyornis commented 1 year ago

This would be referring to the owner of the postgres database. You are using docker compose correct? if so you can use bin/littlesis rails db:reset instead of bin/rails. Using bin/littlesis should execute the correct docker command: docker compose -e RAILS_ENV=development app /littlesis/bin/rails db:reset