DB Seeds Fail On New Deployment Of 0.26.1
Introduction
This article discusses an issue encountered during the deployment of Dawarich 0.26.1, where the DB seeds fail to complete due to an ActiveModel::UnknownAttributeError
. The error occurs when trying to create a user, indicating that the attribute 'active' is unknown for the User model.
Environment and Versions
The issue was encountered on a test environment running Debian 12 with 4x vCPUs on a Ryzen 3900X processor and 4GB of RAM. The version of Dawarich being deployed is 0.26.1.
Describe the Bug
The bug is caused by an ActiveModel::UnknownAttributeError
when trying to create a user. The error message indicates that the attribute 'active' is unknown for the User model. This suggests that the attribute 'active' has been removed or renamed in the User model, but the seeds are still trying to use it.
To Reproduce
To reproduce the issue, follow these steps:
- Deploy a fresh instance of Dawarich 0.26.1.
- Run the
db:seed
task to execute the seeds.
Expected Behavior
The expected behavior is that the seeds should complete successfully without any errors.
Logs
The logs from the deployment are provided below:
⚠️ Starting Rails environment: production ⚠️
Attempting to create database dawarich if it doesn't exist...
Note: Database may already exist or couldn't be created now
⏳ Waiting for database to be ready...
✅ PostgreSQL is ready!
PostgreSQL is ready. Running database migrations...
Running DATA migrations...
I, [2025-05-18T16:38:15.747282 #22] INFO -- : Migrating to BindExistingPointsToFirstUser (20240525110530)
== 20240525110530 BindExistingPointsToFirstUser: migrating ====================
== 20240525110530 BindExistingPointsToFirstUser: migrated (0.0326s) ===========
I, [2025-05-18T16:38:15.788040 #22] INFO -- : Migrating to RemovePointsWithoutCoordinates (20240610170930)
== 20240610170930 RemovePointsWithoutCoordinates: migrating ===================
I, [2025-05-18T16:38:15.857946 #22] INFO -- : Found 0 points without coordinates...
I, [2025-05-18T16:38:15.865129 #22] INFO -- : Points without coordinates removed.
2025-05-18T16:38:15.887Z pid=22 tid=1u6 INFO: Sidekiq 7.3.9 connecting to Redis with options {size: 10, pool_name: "internal", url: "redis://dawarich-redis:6379/0"}
I, [2025-05-18T16:38:15.893065 #22] INFO -- : Enqueued BulkStatsCalculatingJob (Job ID: aac6022e-23fd-4691-95b0-e0ec762b88eb) to Sidekiq(stats)
== 20240610170930 RemovePointsWithoutCoordinates: migrated (0.1046s) ==========
I, [2025-05-18T16:38:15.893908 #22] INFO -- : Migrating to AddFogOfWarMetersToSettings (20240625201842)
== 20240625201842 AddFogOfWarMetersToSettings: migrating ======================
== 20240625201842 AddFogOfWarMetersToSettings: migrated (0.0129s) =============
I, [2025-05-18T16:38:15.908197 #22] INFO -- : Migrating to MakeFirstUserAdmin (20240713103122)
== 20240713103122 MakeFirstUserAdmin: migrating ===============================
== 20240713103122 MakeFirstUserAdmin: migrated (0.0029s) ======================
I, [2025-05-18T16:38:15.911844 #22] INFO -- : Migrating to AddVisitSettingsToUser (20240724141417)
== 20240724141417 AddVisitSettingsToUser: migrating ===========================
== 20240724141417 AddVisitSettingsToUser: migrated (0.0047s) ==================
I, [2025-05-18T16:38:15.917506 #22] INFO -- : Migrating to AddRouteOpacityToSettings (20240730130922)
== 20240730130922 AddRouteOpacityToSettings: migrating ========================
== 20240730130922 AddRouteOpacityToSettings: migrated (0.0005s) ===============
I, [2025-05-18T16:38:15.918682 #22] INFO -- : Migrating to RunInitialVisitSuggestion (20240808133112)
== 20240808133112 RunInitialVisitSuggestion: migrating ========================
== 20240808133112 RunInitialVisitSuggestion: migrated (0.0266s) ===============
I, [2025-05-18T16:38:15.952086 #22] INFO -- : Migrating to AddOwntracksPointsData (20240815174852)
== 20240815174852 AddOwntracksPointsData: migrating ===========================
I, [2025-05-18T16:38:15.974996 #22] INFO -- : Updating 0 owntracks imports points
I, [2025-05-18T16:38:15.975514 #22] INFO -- : 0 points updated from owntracks imports
I, [2025-05-18T16:38:15.976731 #22] INFO -- : Updating 0 points
I, [2025-05-18T16:38:15.977082 #22] INFO -- : 0 points updated
== 20240815174852 AddOwntracksPointsData: migrated (0.0239s) ==================
I, [2025-05-18T16:38:16.002801 #22] INFO -- : Migrating to AddCounterCacheToImports (20240822094532)
== 20240822094532 AddCounterCacheToImports: migrating =========================
== 20240822094532 AddCounterCacheToImports: migrated (0.0361s) ================
I, [2025-05-18T16:38:16.073014 #22] INFO -- : Migrating to AddPointsRenderingModeToSettings (20241022100309)
== 20241022100309 AddPointsRenderingModeToSettings: migrating =================
== 20241022100309 AddPointsRenderingModeToSettings: migrated (0.0041s) ========
I, [2025-05-18T16:38:16.078334 #22] INFO -- : Migrating to AddLiveMapEnabledToSettings (20241107112451)
== 20241107112451 AddLiveMapEnabledToSettings: migrating ======================
== 20241107112451 AddLiveMapEnabledToSettings: migrated (0.0011s) =============
I, [2025-05-18T16:38:16.080249 #22] INFO -- : Migrating to SetReverseGeocodedAtForPoints (20241202125248)
== 20241202125248 SetReverseGeocodedAtForPoints: migrating ====================
I, [2025-05-18T16:38:16.083120 #22] INFO -- : Enqueued DataMigrations::SetReverseGeocodedAtForPointsJob (Job ID: c5ff5f31-735e-4307-b698-88aeeea2f38b) to Sidekiq(default)
== 20241202125248 SetReverseGeocodedAtForPoints: migrated (0.0026s) ===========
I, [2025-05-18T16:38:16.083923 #22] INFO -- : Migrating to CreateTelemetryNotification (20241206163450)
== 20241206163450 CreateTelemetryNotification: migrating ======================
== 20241206163450 CreateTelemetryNotification: migrated (0.0000s) =============
I, [2025-05-18T16:38:16.084700 #22] INFO -- : Migrating to CreatePhotonLoadNotification (20250104204852)
== 20250104204852 CreatePhotonLoadNotification: migrating =====================
== 20250104204852 CreatePhotonLoadNotification: migrated (0.0010s) ============
I, [2025-05-18T16:38:16.086499 #22] INFO -- : Migrating to RemoveDuplicatePoints (20250120154554)
== 20250120154554 RemoveDuplicatePoints: migrating ============================
Duplicate groups found: 0
== 20250120154554 RemoveDuplicatePoints: migrated (0.0359s) ===================
I, [2025-05-18T16:38:16.123728 #22] INFO -- : Migrating to CreatePathsForTrips (20250123151849)
== 20250123151849 CreatePathsForTrips: migrating ==============================
== 20250123151849 CreatePaths<br/>
# DB Seeds Fail on New Deployment of 0.26.1: Q&A
## Q: What is the issue with the DB seeds in Dawarich 0.26.1?
A: The issue is that the DB seeds are failing to complete due to an `ActiveModel::UnknownAttributeError`. This error occurs when trying to create a user, indicating that the attribute 'active' is unknown for the User model.
## Q: What is the cause of the `ActiveModel::UnknownAttributeError`?
A: The cause of the error is that the attribute 'active' has been removed or renamed in the User model, but the seeds are still trying to use it.
## Q: How can I reproduce the issue?
A: To reproduce the issue, follow these steps:
1. Deploy a fresh instance of Dawarich 0.26.1.
2. Run the `db:seed` task to execute the seeds.
## Q: What is the expected behavior?
A: The expected behavior is that the seeds should complete successfully without any errors.
## Q: What are the logs from the deployment?
A: The logs from the deployment are provided below:
```markdown
⚠️ Starting Rails environment: production ⚠️
Attempting to create database dawarich if it doesn't exist...
Note: Database may already exist or couldn't be created now
⏳ Waiting for database to be ready...
✅ PostgreSQL is ready!
PostgreSQL is ready. Running database migrations...
Running DATA migrations...
I, [2025-05-18T16:38:15.747282 #22] INFO -- : Migrating to BindExistingPointsToFirstUser (20240525110530)
== 20240525110530 BindExistingPointsToFirstUser: migrating ====================
== 20240525110530 BindExistingPointsToFirstUser: migrated (0.0326s) ===========
I, [2025-05-18T16:38:15.788040 #22] INFO -- : Migrating to RemovePointsWithoutCoordinates (20240610170930)
== 20240610170930 RemovePointsWithoutCoordinates: migrating ===================
I, [2025-05-18T16:38:15.857946 #22] INFO -- : Found 0 points without coordinates...
I, [2025-05-18T16:38:15.865129 #22] INFO -- : Points without coordinates removed.
2025-05-18T16:38:15.887Z pid=22 tid=1u6 INFO: Sidekiq 7.3.9 connecting to Redis with options {size: 10, pool_name: "internal", url: "redis://dawarich-redis:6379/0"}
I, [2025-05-18T16:38:15.893065 #22] INFO -- : Enqueued BulkStatsCalculatingJob (Job ID: aac6022e-23fd-4691-95b0-e0ec762b88eb) to Sidekiq(stats)
== 20240610170930 RemovePointsWithoutCoordinates: migrated (0.1046s) ==========
I, [2025-05-18T16:38:15.893908 #22] INFO -- : Migrating to AddFogOfWarMetersToSettings (20240625201842)
== 20240625201842 AddFogOfWarMetersToSettings migrating ======================
== 20240625201842 AddFogOfWarMetersToSettings: migrated (0.0129s) =============
I, [2025-05-18T16:38:15.908197 #22] INFO -- : Migrating to MakeFirstUserAdmin (20240713103122)
== 20240713103122 MakeFirstUserAdmin: migrating ===============================
== 20240713103122 MakeFirstUserAdmin: migrated (0.0029s) ======================
I, [2025-05-18T16:38:15.911844 #22] INFO -- : Migrating to AddVisitSettingsToUser (20240724141417)
== 20240724141417 AddVisitSettingsToUser: migrating ===========================
== 20240724141417 AddVisitSettingsToUser: migrated (0.0047s) ==================
I, [2025-05-18T16:38:15.917506 #22] INFO -- : Migrating to AddRouteOpacityToSettings (20240730130922)
== 20240730130922 AddRouteOpacityToSettings: migrating ========================
== 20240730130922 AddRouteOpacityToSettings: migrated (0.0005s) ===============
I, [2025-05-18T16:38:15.918682 #22] INFO -- : Migrating to RunInitialVisitSuggestion (20240808133112)
== 20240808133112 RunInitialVisitSuggestion: migrating ========================
== 20240808133112 RunInitialVisitSuggestion: migrated (0.0266s) ===============
I, [2025-05-18T16:38:15.952086 #22] INFO -- : Migrating to AddOwntracksPointsData (20240815174852)
== 20240815174852 AddOwntracksPointsData: migrating ===========================
I, [2025-05-18T16:38:15.974996 #22] INFO -- : Updating 0 owntracks imports points
I, [2025-05-18T16:38:15.975514 #22] INFO -- : 0 points updated from owntracks imports
I, [2025-05-18T16:38:15.976731 #22] INFO -- : Updating 0 points
I, [2025-05-18T16:38:15.977082 #22] INFO -- : 0 points updated
== 20240815174852 AddOwntracksPointsData: migrated (0.0239s) ==================
I, [2025-05-18T16:38:16.002801 #22] INFO -- : Migrating to AddCounterCacheToImports (20240822094532)
== 20240822094532 AddCounterCacheToImports: migrating =========================
== 20240822094532 AddCounterCacheToImports: migrated (0.0361s) ================
I, [2025-05-18T16:38:16.073014 #22] INFO -- : Migrating to AddPointsRenderingModeToSettings (20241022100309)
== 20241022100309 AddPointsRenderingModeToSettings: migrating =================
== 20241022100309 AddPointsRenderingModeToSettings: migrated (0.0041s) ========
I, [2025-05-18T16:38:16.334 #22] INFO -- : Migrating to AddLiveMapEnabledToSettings (20241107112451)
== 20241107112451 AddLiveMapEnabledToSettings: migrating ======================
== 20241107112451 AddLiveMapEnabledToSettings: migrated (0.0011s) =============
I, [2025-05-18T16:38:16.080249 #22] INFO -- : Migrating to SetReverseGeocodedAtForPoints (20241202125248)
== 20241202125248 SetReverseGeocodedAtForPoints: migrating ====================
I, [2025-05-18T16:38:16.083120 #22] INFO -- : Enqueued DataMigrations::SetReverseGeocodedAtForPointsJob (Job ID: c5ff5f31-735e-4307-b698-88aeeea2f38b) to Sidekiq(default)
== 20241202125248 SetReverseGeocodedAtForPoints: migrated (0.0026s) ===========
I, [2025-05-18T16:38:16.083923 #22] INFO -- : Migrating to CreateTelemetryNotification (20241206163450)
== 20241206163450 CreateTelemetryNotification: migrating ======================
== 20241206163450 CreateTelemetryNotification: migrated (0.0000s) =============
I, [2025-05-18T16:38:16.084700 #22] INFO -- : Migrating to CreatePhotonLoadNotification (20250104204852)
== 20250104204852 CreatePhotonLoadNotification: migrating =====================
== 20250104204852 CreatePhotonLoadNotification: migrated (0.0010s) ============
I, [2025-05-18T16:38:16.086499 #22] INFO -- : Migrating to RemoveDuplicatePoints (20250120154554)
== 20250120154554 RemoveDuplicatePoints: migrating ============================
Duplicate groups found: 0
== 20250120154554 RemoveDuplicatePoints: migrated (0.0359s) ===================
I, [2025-05-18T16:38:16.123728 #22] INFO -- : Migrating to CreatePathsForTrips (20250123151849)
== 20250123151849 CreatePathsForTrips: migrating ==============================
== 20250123151849 CreatePathsForTrips: migrated (0.0301s) =====================
I, [2025-05-18T16:38:16.156550 #22] INFO -- : Migr