umami-software / umami

Umami is a simple, fast, privacy-focused alternative to Google Analytics.
https://umami.is
MIT License
21.85k stars 4.07k forks source link

prisma migrate deploy Error: P3009 #2645

Open HDBear opened 5 months ago

HDBear commented 5 months ago

Describe the Bug

Didn't have this issue on last UMAMI version. I deployed a fresh instance just 1 hour ago I'm facing an issue.

I have installed multiple instances and never faced an issue.

Database error: FUNCTION Webinoly_8DXefk0h.BIN_TO_UUID does not exist

Please check the query number 2 from the migration file.

✗ Command failed: prisma migrate deploy Error: P3018

A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Migration name: 05_add_visit_id

Database error code: 1305

Database error: FUNCTION Webinoly_8DXefk0h.BIN_TO_UUID does not exist

Please check the query number 2 from the migration file.

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ERROR: "check-db" exited with 1. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Database

MySQL

Relevant log output

No response

Which Umami version are you using? (if relevant)

latest

Which browser are you using? (if relevant)

Edge

How are you deploying your application? (if relevant)

VPS

franciscao633 commented 5 months ago

MySQL needs to generate random UUID's in the migration script. It looks like UUID support was introduced in MySQL 8.0. We bumped our minimum version to 8.0 not too far back for different reasons. Are you able to upgrade by any chance?

Alternatively you can replace the BIN_TO_UUID function in the migration script with something like below which also validates as UUIDv4.

SELECT LOWER(CONCAT(
    HEX(RANDOM_BYTES(4)), '-',
    HEX(RANDOM_BYTES(2)), '-4',
    SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3), '-',
    CONCAT(HEX(FLOOR(ASCII(RANDOM_BYTES(1)) / 64)+8),SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3)), '-',
    HEX(RANDOM_BYTES(6))
))
camponez commented 5 months ago

I'm using mysql 8.0. I had different error

$ npm-run-all check-db update-tracker start-server
$ node scripts/check-db.js
✓ DATABASE_URL is defined.
✓ Database connection successful.
✓ Database version check successful.
Error: P3009

migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https:/
/pris.ly/d/migrate-resolve
The `05_add_visit_id` migration started at 2024-04-04 23:54:45.543 UTC failed

✗ Command failed: prisma migrate deploy
Error: P3009

migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https:/
/pris.ly/d/migrate-resolve
The `05_add_visit_id` migration started at 2024-04-04 23:54:45.543 UTC failed
camponez commented 5 months ago

I'm using mysql 8.0. I had different error

$ npm-run-all check-db update-tracker start-server
$ node scripts/check-db.js
✓ DATABASE_URL is defined.
✓ Database connection successful.
✓ Database version check successful.
Error: P3009

migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https:/
/pris.ly/d/migrate-resolve
The `05_add_visit_id` migration started at 2024-04-04 23:54:45.543 UTC failed

✗ Command failed: prisma migrate deploy
Error: P3009

migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https:/
/pris.ly/d/migrate-resolve
The `05_add_visit_id` migration started at 2024-04-04 23:54:45.543 UTC failed

btw, I'm running a docker version. Not sure exactly what to do to recover com this.

HDBear commented 5 months ago

after amending as you mentioned its smooth sailing

-- AlterTable ALTER TABLE website_event ADD COLUMN visit_id VARCHAR(36) NULL;

-- Update with UUIDv4 UPDATE website_event we JOIN ( SELECT DISTINCT s.session_id, s.visit_time, LOWER(CONCAT( HEX(RANDOM_BYTES(4)), '-', HEX(RANDOM_BYTES(2)), '-4', SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3), '-', CONCAT(HEX(FLOOR(ASCII(RANDOM_BYTES(1)) / 64)+8),SUBSTR(HEX(RANDOM_BYTES(2)), 2, 3)), '-', HEX(RANDOM_BYTES(6)) )) AS uuid FROM ( SELECT DISTINCT session_id, DATE_FORMAT(created_at, '%Y-%m-%d %H:00:00') visit_time FROM website_event ) s ) a ON we.session_id = a.session_id AND DATE_FORMAT(we.created_at, '%Y-%m-%d %H:00:00') = a.visit_time SET we.visit_id = a.uuid WHERE we.visit_id IS NULL;

-- ModifyColumn ALTER TABLE website_event MODIFY visit_id VARCHAR(36) NOT NULL;

-- CreateIndex CREATE INDEX website_event_visit_id_idx ON website_event(visit_id);

-- CreateIndex CREATE INDEX website_event_website_id_visit_id_created_at_idx ON website_event(website_id, visit_id, created_at);

franciscao633 commented 5 months ago

@camponez thats the prisma error. You could find the migration error inside the _prisma_migrations table if you're able to query it.

For docker you can specify the version if you need to roll back instead of using latest, but it's best to just resolve the migration error.

camponez commented 5 months ago

@camponez thats the prisma error. You could find the migration error inside the _prisma_migrations table if you're able to query it.

For docker you can specify the version if you need to roll back instead of using latest, but it's best to just resolve the migration error.

I could not find error in that table.

I have tried to use last version. It didn't work. I get the same error.

camponez commented 5 months ago

I have tried to run sql code pasted above, but I think now I'm in a state where I don't know if it's fully applied or not

mobeicanyue commented 5 months ago

Describe the Bug

Didn't have this issue on last UMAMI version. I deployed a fresh instance just 1 hour ago I'm facing an issue.

Database

MySQL

Which Umami version are you using? (if relevant)

latest

What's your origin umami versions?

franciscao633 commented 5 months ago

You can check if the code applied by checking if you have a populated visit_id column in the website_event table.

If so you can run the code below inside the umami container to resolve the migration error.

npx prisma migrate resolve --applied "05_add_visit_id"

louis-l commented 5 months ago

Im running 10.11.2-MariaDB-1:10.11.2+maria~ubu2204 and having same issue.

...
Migration name: 05_add_visit_id

Database error code: 1305

Database error:
FUNCTION db_name.BIN_TO_UUID does not exist
...
philipreichert commented 5 months ago

Im running mariadb:11.2 and having same issue.

TaiYouWeb commented 5 months ago

I am facing the same issue as well, and the word 'visits' remains untranslated in the Chinese version.

milouse commented 5 months ago

Same error here, when using the last docker image and a mariadb server on host (the BIN_TO_UUID is not defined in mariadb). I tryied to create the missing function with https://gist.github.com/jamesgmarks/56502e46e29a9576b0f5afea3a0f595c, but the error still occurs (I’m not a db export, thus not sure if I did things right).

Most importantly, since the error I cannot rollback as trying to restart last working docker image report the same error :/ Is there a way to properly rollback the broken migration to restart old version until a fix is found?

yibudak commented 5 months ago

Here is the compatible version for MariaDB < 10.10.0 instances. Thanks for @HDBear

Run this commands with mariadb/mysql client, it can throw an error on line 2, simply comment it out:

-- AlterTable
ALTER TABLE website_event ADD COLUMN visit_id VARCHAR(36) NULL;

-- Update with UUIDv4
UPDATE website_event we
JOIN (
SELECT DISTINCT
s.session_id,
s.visit_time,
LOWER(CONCAT(
HEX(SUBSTR(MD5(RAND()), 1, 4)), '-',
HEX(SUBSTR(MD5(RAND()), 1, 2)), '-4',
SUBSTR(HEX(SUBSTR(MD5(RAND()), 1, 2)), 2, 3), '-',
CONCAT(HEX(FLOOR(ASCII(SUBSTR(MD5(RAND()), 1, 1)) / 64)+8),SUBSTR(HEX(SUBSTR(MD5(RAND()), 1, 2)), 2, 3)), '-',
HEX(SUBSTR(MD5(RAND()), 1, 6))
)) AS uuid
FROM (
SELECT DISTINCT session_id,
DATE_FORMAT(created_at, '%Y-%m-%d %H:00:00') visit_time
FROM website_event
) s
) a ON we.session_id = a.session_id AND DATE_FORMAT(we.created_at, '%Y-%m-%d %H:00:00') = a.visit_time
SET we.visit_id = a.uuid
WHERE we.visit_id IS NULL;

-- ModifyColumn
ALTER TABLE website_event MODIFY visit_id VARCHAR(36) NOT NULL;

-- CreateIndex
CREATE INDEX website_event_visit_id_idx ON website_event(visit_id);

-- CreateIndex
CREATE INDEX website_event_website_id_visit_id_created_at_idx ON website_event(website_id, visit_id, created_at);

Then resolve the migration in Umami folder: npx prisma migrate resolve --applied "05_add_visit_id"

milouse commented 5 months ago

I confirm it works as expected! Thank you very much for your help @yibudak

If you are using docker like me / or don’t want to / cannot use prisma for whatever reason, resolving the migration is as easy as doing the following:

UPDATE _prisma_migrations
SET finished_at = NOW(), logs = NULL, applied_steps_count = 1 
WHERE migration_name = '05_add_visit_id';
MichaelBelgium commented 5 months ago

Yeah having the same error with MariaDB but technically Umami doesn't support mariadb, only mysql - as mentioned in the readme. Mariadb doesn't have that function

chris-lily commented 5 months ago

same error with 10.4.33-MariaDB-1:10.4.33+maria~deb10-log

Database error: FUNCTION Webinoly_8DXefk0h.BIN_TO_UUID does not exist

;-(

orhun commented 5 months ago

I'm running ghcr.io/umami-software/umami:postgresql-v2.11.0 and experiencing the same:

umami     | yarn run v1.22.19
umami     | $ npm-run-all check-db update-tracker start-server
umami     | $ node scripts/check-db.js
umami     | ✓ DATABASE_URL is defined.
umami     | ✓ Database connection successful.
umami     | ✓ Database version check successful.
umami_db  | 2024-04-05 11:06:31.962 UTC [120] LOG:  could not receive data from client: Connection reset by peer
umami     | Error: P3009
umami     |
umami     | migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
umami     | The `05_add_visit_id` migration started at 2024-04-05 11:02:55.305423 UTC failed
umami     |
umami     |
umami     | ✗ Command failed: prisma migrate deploy
umami     | Error: P3009
umami     |
umami     | migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
umami     | The `05_add_visit_id` migration started at 2024-04-05 11:02:55.305423 UTC failed
artfulrobot commented 5 months ago

In case this helps anyone else (or me in the future), on my Docker/postgres install the comment at https://github.com/umami-software/umami/issues/2645#issuecomment-2039235057 worked for me:

myserver$ docker exec -it umami_db_1 psql --user umami 
umami=# UPDATE _prisma_migrations SET finished_at = NOW(), logs = NULL, applied_steps_count = 1  WHERE migration_name = '05_add_visit_id';
UPDATE 1
umami=# exit
myserver$ docker-compose restart

(note that the UPDATE 1 line is output from the psql command, not something I typed.)

artfulrobot commented 5 months ago

Spoke too soon, it is started now, but it says: "Something went wrong".

image

In the browser console;

https://(mysite.com)/api/websites/e12341e9-405e-4e8e-123f-0e1f431e145c/stats?startAt=1712239200000&endAt=1712329199999
500 Internal Server Error

PrismaClientKnownRequestError:
Invalid prisma.websiteEvent.create() invocation:

The logs look like this - repeated lots:

The column `visit_id` does not exist in the current database.                                                                                
    at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6854)                                                  
    at In.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6188)                                            
    at In.request (/app/node_modules/@prisma/client/runtime/library.js:122:5896)                                                             
    at async l (/app/node_modules/@prisma/client/runtime/library.js:127:10871)                                                               
    at async h (/app/.next/server/pages/api/send.js:1:3092)                                                                                  
    at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16545)                                         
    at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16981)                                  
    at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:554:9)                                                 
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:266:37)                           
    at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:791:17) {                                   
  code: 'P2022',                                                                                                                             
  clientVersion: '5.11.0',                                                                                                                   
  meta: { modelName: 'WebsiteEvent', column: 'visit_id' }                                                                                    
}                                       

Glad I took a db dump before I did this. I was able to restore to a working version (2.10.0).

franciscao633 commented 5 months ago

@orhun not seeing much in that log on why it failed besides a connection error. If the error wasn't captured its hard to troubleshoot. The migration is fairly simple, its just adding a column, populating, and adding indexes. I would run the SQL code below on your db then resolve the prisma migration with either method, similar to @yibudak comment. If the code below produced an error please post.

Run this commands with psql client or IDE, it can throw an error on line 2, simply comment it out:

-- AlterTable
ALTER TABLE "website_event" ADD COLUMN "visit_id" UUID NULL;

UPDATE "website_event" we
SET visit_id = a.uuid
FROM (SELECT DISTINCT
        s.session_id,
        s.visit_time,
        gen_random_uuid() uuid
    FROM (SELECT DISTINCT session_id,
            date_trunc('hour', created_at) visit_time
        FROM "website_event") s) a
WHERE we.session_id = a.session_id 
    and date_trunc('hour', we.created_at) = a.visit_time;

ALTER TABLE "website_event" ALTER COLUMN "visit_id" SET NOT NULL;

-- CreateIndex
CREATE INDEX "website_event_visit_id_idx" ON "website_event"("visit_id");

-- CreateIndex
CREATE INDEX "website_event_website_id_visit_id_created_at_idx" ON "website_event"("website_id", "visit_id", "created_at");

Then resolve the migration in Umami folder: npx prisma migrate resolve --applied "05_add_visit_id"

OR if you want to just run a SQL statement

UPDATE _prisma_migrations
SET finished_at = NOW(), logs = NULL, applied_steps_count = 1 
WHERE migration_name = '05_add_visit_id';
orhun commented 5 months ago

I run the migration but now I'm getting the exact same error as @artfulrobot ("Something went wrong")

I gave up debugging this and downgraded, will wait for the solution to this / new release.

lightningspirit commented 5 months ago

I wanted to add my experience on doing this upgrade to PostgreSQL. We have a small-medium workload but a considerable database size already (website_event is 1.5GB). With default tuning (wal_size_maximum = 1GB) we had troubles during this upgrade spending almost 30 minutes running this migration.

We ended up increasing the default values for write workload but unable to rerun the migration so I'm not aware if the gains are significant (some articles mention that tuning for wal_size_maximum of 8GB can increase 2x the write performance).

franciscao633 commented 5 months ago

@lightningspirit Just curious, were you running the migration manually outside of prisma and it's still failing? I believe this is the first time we had to populate data on an existing table, which is a headache since some users can have million+ records. The migration is probably exceeding the statement_timeout config for their db and failing for some users.

madawei2699 commented 5 months ago

It took several hours to update the website_event which is almost 1GB, so I wrote a python script to upgrade it.

Here is it:

batch_size = 100000 last_created_at = '1970-01-01T00:00:00Z'

total_updated = 0

while True: conn = psycopg2.connect("postgres://DB_USER:DB_PASSWORD@DB_HOST/DB_NAME") cur = conn.cursor()

cur.execute("set statement_timeout = '2000 s';")
cur.execute("SET work_mem = '16MB';")

cur.execute("SET search_path TO public, public;")

cur.execute("SELECT last_processed_time, rows_updated FROM update_progress;")

update_progress_row = cur.fetchone()

if update_progress_row:
    last_created_at, total_updated = update_progress_row

cur.execute(f"""
    WITH upd AS (
        UPDATE public.website_event we
        SET visit_id = a.uuid
        FROM (
            SELECT
                s.session_id,
                s.visit_time,
                gen_random_uuid() AS uuid,
                s.created_at
            FROM (
                SELECT
                    session_id,
                    date_trunc('hour', created_at) AS visit_time,
                    created_at
                FROM public.website_event
                WHERE created_at > '{last_created_at}'
                ORDER BY created_at
                LIMIT {batch_size}
            ) s
        ) a
        WHERE we.session_id = a.session_id
          AND date_trunc('hour', we.created_at) = a.visit_time
          AND we.created_at = a.created_at
        RETURNING we.created_at
    )
    SELECT COUNT(*), MAX(created_at) FROM upd;
""")
row_count, new_last_created_at = cur.fetchone()

total_updated += row_count

if row_count > 0:
    cur.execute("TRUNCATE TABLE update_progress;")
    cur.execute("INSERT INTO update_progress (last_processed_time, rows_updated) VALUES (%s, %s);", (new_last_created_at, total_updated))
    conn.commit() 
    print(f"Updated {total_updated} rows, last processed at: {new_last_created_at}")
else:
    break

cur.close()
conn.close()

- Last, update the rest parts.

```sql
ALTER TABLE "website_event" ALTER COLUMN "visit_id" SET NOT NULL;

-- CreateIndex
CREATE INDEX "website_event_visit_id_idx" ON "website_event"("visit_id");

-- CreateIndex
CREATE INDEX "website_event_website_id_visit_id_created_at_idx" ON "website_event"("website_id", "visit_id", "created_at");

UPDATE _prisma_migrations
SET finished_at = NOW(), logs = NULL, applied_steps_count = 1 
WHERE migration_name = '05_add_visit_id';
xingpingcn commented 5 months ago

i deploy it on vercel and get p3009 error as well, but can't use cli to try to solve the problem

lightningspirit commented 5 months ago

@lightningspirit Just curious, were you running the migration manually outside of prisma and it's still failing? I believe this is the first time we had to populate data on an existing table, which is a headache since some users can have million+ records. The migration is probably exceeding the statement_timeout config for their db and failing for some users.

@franciscao633 Actually I had to run query statements manually (no changes to the script needed). Wasn't able to perform using Prisma migrate, so, yes, outside of Prisma migrate the provided statements work as expected.

zavan commented 4 months ago

Our website_event table is quite large and our DB server is not that powerful. When I attempted to run that migration (postgres), it locked up everything and failed every time.

So I did almost exactly what @madawei2699 did and created a script (but in Ruby) to do it in batches. It took some time to run but it worked and didn't lock everything up in the meanwhile.

We should probably be more careful with migrations that update or move data around, we don't know people's infrastructure and the amount of data they have.

franciscao633 commented 4 months ago

@zavan I agree, but new features will have to touch the schema of existing tables eventually. I think the alternative would be to not force people to populate existing data as part of the migration, but provide the option. This would mean the visitor metrics would be empty on all historic data as a default. I'm not sure this is the solution, but just throwing out ideas.

artfulrobot commented 4 months ago

Is there a plan to make this migration work? Is there a target milestone for this? I'm not confident using the python/ruby scripts.

At the mo I'm staying on 2.10.0 but I'd love to get the features in 2.11!

lightningspirit commented 4 months ago

@franciscao633 Digging into the migration script again, it seems to me, like for Postgres at least, the updates shouldn't completely block the app from use. Since it's just modifying existing rows and Postgres uses per-row locking, maybe a background migration is feasible. This could potentially allow immediate Umami upgrades without downtime. Just a thought... 💭

jrjake commented 4 months ago

You can check if the code applied by checking if you have a populated visit_id column in the website_event table.

If so you can run the code below inside the umami container to resolve the migration error.

npx prisma migrate resolve --applied "05_add_visit_id"

Hi, how do I do this in Docker? The Docker container will try to start a few times and shuts down after only 5 seconds of being alive. I try to open a shell, but I get instantly kicked out because the container exits.

Edit: I figured it out. In my docker compose file, I added to the umami block:

command: sh
stdin_open: true
tty: true

and started the container. I was then able to attach to it, and it did not exit because it was just basically running a shell instead of Umami start script.

jrjake commented 4 months ago

Spoke too soon, it is started now, but it says: "Something went wrong".

image

In the browser console;

https://(mysite.com)/api/websites/e12341e9-405e-4e8e-123f-0e1f431e145c/stats?startAt=1712239200000&endAt=1712329199999 500 Internal Server Error

PrismaClientKnownRequestError: Invalid prisma.websiteEvent.create() invocation:

The logs look like this - repeated lots:

The column `visit_id` does not exist in the current database.                                                                                
    at In.handleRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6854)                                                  
    at In.handleAndLogRequestError (/app/node_modules/@prisma/client/runtime/library.js:122:6188)                                            
    at In.request (/app/node_modules/@prisma/client/runtime/library.js:122:5896)                                                             
    at async l (/app/node_modules/@prisma/client/runtime/library.js:127:10871)                                                               
    at async h (/app/.next/server/pages/api/send.js:1:3092)                                                                                  
    at async K (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16545)                                         
    at async U.render (/app/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16981)                                  
    at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:554:9)                                                 
    at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/next/dist/server/next-server.js:266:37)                           
    at async NextNodeServer.handleRequestImpl (/app/node_modules/next/dist/server/base-server.js:791:17) {                                   
  code: 'P2022',                                                                                                                             
  clientVersion: '5.11.0',                                                                                                                   
  meta: { modelName: 'WebsiteEvent', column: 'visit_id' }                                                                                    
}                                       

Glad I took a db dump before I did this. I was able to restore to a working version (2.10.0).

I am getting this error too after doing the migration failed fix command. My system is on Postgres 16 though, so I don't even know why the migration failed initially.

artfulrobot commented 4 months ago

@jrjake my opinion on this (I'm posting in case (a) it's correct and useful to you, or (b) it's incorrect and hoping someone will correct me) is that the migration/upgrader is broken - I think this issue is still open because it's broken and needs fixing. But I don't know if any effort is directed at fixing this - there have been two point releases since 2.10.0 and neither made reference to having fixed this.

EDIT: the migration works for me now.

It didn't take too long for my 1GB data - a few minutes.

jrjake commented 4 months ago

Apologies for triple posting. I figured everything out wrong with my installation.

Failure mode: I performed the upgrade of my Docker container from 1.10.2 to 1.11.2. I thought it should be pretty quick like the previous upgrades, but Umami was not available even after about 10 minutes. I checked the logs of the container and it was seemingly stuck on "Database version check complete" or something like that, so I rebooted the container. I'm realizing now that it wasn't stuck rather it was performing a really huge migration (lots of data in my database).

After rebooting, it detected the failed migration so refused to boot.

So, to fix that:

  1. Turn off Umami (doesn't really matter since it won't start anyways)
  2. Run the migration SQL listed somewhere above by the developer. This took about an hour for me due to the massive amounts of data.
  3. Run the command provided by the developer above to mark the failed migration as complete.
  4. Start Umami. Everything should be good.

Mostly a skill issue on my part and not realizing any migrations for the upgrade would take so long.

Wolfhound905 commented 4 months ago

@jrjake I have done the exact same thing... It's funny how impatient people are haha.

For anyone wondering how I resolved this.

  1. Start the DB by itself. I use docker compose up db since DB is my service name in the compose file
  2. exec into the container with docker exec -it <container id> bash
  3. psql -U | Your username is prolly umami
  4. Follow this contributors instructions https://github.com/umami-software/umami/issues/2645#issuecomment-2040220385 (note that this will take a while depending on the size, wait)
baddate commented 4 months ago

You can check if the code applied by checking if you have a populated visit_id column in the website_event table.

If so you can run the code below inside the umami container to resolve the migration error.

npx prisma migrate resolve --applied "05_add_visit_id"

it also works on vercel deployment

xingpingcn commented 4 months ago

i use vercel to depley umami and in order to solve this error i change

"build-db": "npm-run-all copy-db-files build-db-client",

in package.json to

"build-db": "npm-run-all copy-db-files build-db-client resolve-db",
"resolve-db": "prisma migrate resolve --applied '05_add_visit_id'",

as @franciscao633 proposed above

it works for me, finally

sao-coding commented 3 months ago

i use vercel to depley umami and in order to solve this error i change

"build-db": "npm-run-all copy-db-files build-db-client",

in topackage.json

"build-db": "npm-run-all copy-db-files build-db-client resolve-db",
"resolve-db": "prisma migrate resolve --applied '05_add_visit_id'",

as @franciscao633 proposed above

it works for me, finally

I have tried, but it shows Something went wrong image

xingpingcn commented 3 months ago

@sao-coding it seens that your db has some problems, show your build log

sao-coding commented 3 months ago

use 10.11.6-MariaDB No visit_id field

MariaDB Tab

image image image

Vercel build log

[18:53:56.414] Running build in Washington, D.C., USA (East) – iad1
[18:53:56.647] Cloning github.com/sao-coding/umami (Branch: master, Commit: c5a788a)
[18:53:56.659] Skipping build cache, deployment was triggered without cache.
[18:53:57.715] Cloning completed: 1.066s
[18:53:59.616] Running "vercel build"
[18:54:00.598] Vercel CLI 34.2.2
[18:54:03.474] Installing dependencies...
[18:54:04.420] yarn install v1.22.19
[18:54:04.676] [1/4] Resolving packages...
[18:54:10.240] [2/4] Fetching packages...
[18:54:48.132] warning chart.js@4.4.2: The engine "pnpm" appears to be invalid.
[18:54:48.156] [3/4] Linking dependencies...
[18:54:48.159] warning " > @umami/prisma-client@0.14.0" has incorrect peer dependency "@prisma/client@^4.8.0".
[18:54:48.161] warning " > next-basics@0.39.0" has incorrect peer dependency "next@^13.4.0".
[18:54:48.164] warning " > react-simple-maps@2.3.0" has incorrect peer dependency "react@^16.8.0 || 17.x".
[18:54:48.164] warning " > react-simple-maps@2.3.0" has incorrect peer dependency "react-dom@^16.8.0 || 17.x".
[18:54:48.165] warning " > react-simple-maps@2.3.0" has unmet peer dependency "prop-types@^15.7.2".
[18:54:48.165] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/core@1.24.1" has unmet peer dependency "@opentelemetry/api@>=1.0.0 <1.9.0".
[18:54:48.165] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/sdk-trace-base@1.24.1" has unmet peer dependency "@opentelemetry/api@>=1.0.0 <1.9.0".
[18:54:48.166] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/resources@1.24.1" has unmet peer dependency "@opentelemetry/api@>=1.0.0 <1.9.0".
[18:54:48.166] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/otlp-transformer@0.50.0" has unmet peer dependency "@opentelemetry/api@>=1.3.0 <1.9.0".
[18:54:48.170] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/otlp-transformer > @opentelemetry/core@1.23.0" has unmet peer dependency "@opentelemetry/api@>=1.0.0 <1.9.0".
[18:54:48.170] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/otlp-transformer > @opentelemetry/resources@1.23.0" has unmet peer dependency "@opentelemetry/api@>=1.0.0 <1.9.0".
[18:54:48.170] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/otlp-transformer > @opentelemetry/sdk-trace-base@1.23.0" has unmet peer dependency "@opentelemetry/api@>=1.0.0 <1.9.0".
[18:54:48.171] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/otlp-transformer > @opentelemetry/sdk-metrics@1.23.0" has unmet peer dependency "@opentelemetry/api@>=1.3.0 <1.9.0".
[18:54:48.171] warning "@netlify/plugin-nextjs > @netlify/ipx > @netlify/functions > @netlify/serverless-functions-api > @opentelemetry/otlp-transformer > @opentelemetry/sdk-logs@0.50.0" has unmet peer dependency "@opentelemetry/api@>=1.4.0 <1.9.0".
[18:54:48.183] warning " > rollup-plugin-terser@7.0.2" has incorrect peer dependency "rollup@^2.0.0".
[18:54:48.184] warning "stylelint-config-css-modules > stylelint-scss@6.1.0" has incorrect peer dependency "stylelint@^16.0.2".
[18:54:48.184] warning " > stylelint-config-prettier@9.0.5" has incorrect peer dependency "stylelint@>= 11.x < 15".
[18:54:48.184] warning " > stylelint-config-recommended@14.0.0" has incorrect peer dependency "stylelint@^16.0.0".
[18:54:48.226] warning Workspaces can only be enabled in private projects.
[18:55:13.217] [4/4] Building fresh packages...
[18:55:32.772] success Saved lockfile.
[18:55:32.779] $ node -e "if (process.env.NODE_ENV !== 'production'){process.exit(1)} " || husky install
[18:55:33.104] husky - Git hooks installed
[18:55:33.117] Done in 88.70s.
[18:55:33.446] Detected Next.js version: 14.1.4
[18:55:33.452] Running "yarn run build"
[18:55:33.654] yarn run v1.22.19
[18:55:33.696] $ npm-run-all check-env build-db check-db build-tracker build-geo build-app
[18:55:34.087] $ node scripts/check-env.js
[18:55:34.372] $ npm-run-all copy-db-files build-db-client resolve-db
[18:55:34.743] $ node scripts/copy-db-files.js
[18:55:34.874] Database type detected: mysql
[18:55:34.883] Copied /vercel/path0/db/mysql to /vercel/path0/prisma
[18:55:35.129] $ prisma generate
[18:55:35.793] Prisma schema loaded from prisma/schema.prisma
[18:55:36.477] 
[18:55:36.478] ✔ Generated Prisma Client (v5.12.1) to ./node_modules/@prisma/client in 175ms
[18:55:36.478] 
[18:55:36.478] Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
[18:55:36.478] ```
[18:55:36.478] import { PrismaClient } from '@prisma/client'
[18:55:36.478] const prisma = new PrismaClient()
[18:55:36.478] ```
[18:55:36.478] or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
[18:55:36.478] ```
[18:55:36.478] import { PrismaClient } from '@prisma/client/edge'
[18:55:36.478] const prisma = new PrismaClient()
[18:55:36.478] ```
[18:55:36.478] 
[18:55:36.478] See other ways of importing Prisma Client: http://pris.ly/d/importing-client
[18:55:36.478] 
[18:55:36.478] ┌────────────────────────────────────────────────────────────────┐
[18:55:36.478] │  Supercharge your Prisma Client with global database caching,  │
[18:55:36.478] │  scalable connection pooling and real-time database events.    │
[18:55:36.478] │  Explore Prisma Accelerate: https://pris.ly/cli/-accelerate    │
[18:55:36.478] │  Explore Prisma Pulse: https://pris.ly/cli/-pulse              │
[18:55:36.479] └────────────────────────────────────────────────────────────────┘
[18:55:36.479] 
[18:55:36.894] $ prisma migrate resolve --applied '05_add_visit_id'
[18:55:37.560] Prisma schema loaded from prisma/schema.prisma
[18:55:37.577] Datasource "db": MySQL database "umami" at "sao-x.com:3306"
[18:55:43.504] 
[18:55:43.504] Migration 05_add_visit_id marked as applied.
[18:55:43.504] 
[18:55:43.547] ┌─────────────────────────────────────────────────────────┐
[18:55:43.548] │  Update available 5.12.1 -> 5.14.0                      │
[18:55:43.548] │  Run the following to update                            │
[18:55:43.548] │    yarn add --dev prisma@latest                         │
[18:55:43.548] │    yarn add @prisma/client@latest                       │
[18:55:43.548] └─────────────────────────────────────────────────────────┘
[18:55:43.880] $ node scripts/check-db.js
[18:55:43.998] ✓ DATABASE_URL is defined.
[18:55:44.958] ✓ Database connection successful.
[18:55:46.272] ✓ Database version check successful.
[18:57:32.534] Prisma schema loaded from prisma/schema.prisma
[18:57:32.535] Datasource "db": MySQL database "umami" at "sao-x.com:3306"
[18:57:32.535] 
[18:57:32.535] 6 migrations found in prisma/migrations
[18:57:32.535] 
[18:57:32.535] Applying migration `01_init`
[18:57:32.535] Applying migration `02_report_schema_session_data`
[18:57:32.535] Applying migration `03_metric_performance_index`
[18:57:32.535] Applying migration `04_team_redesign`
[18:57:32.535] Applying migration `06_session_data`
[18:57:32.535] 
[18:57:32.535] The following migration(s) have been applied:
[18:57:32.535] 
[18:57:32.535] migrations/
[18:57:32.535]   └─ 01_init/
[18:57:32.535]     └─ migration.sql
[18:57:32.535]   └─ 02_report_schema_session_data/
[18:57:32.535]     └─ migration.sql
[18:57:32.535]   └─ 03_metric_performance_index/
[18:57:32.535]     └─ migration.sql
[18:57:32.535]   └─ 04_team_redesign/
[18:57:32.535]     └─ migration.sql
[18:57:32.535]   └─ 06_session_data/
[18:57:32.535]     └─ migration.sql
[18:57:32.535]       
[18:57:32.535] All migrations have been successfully applied.
[18:57:32.535] 
[18:57:32.535] ✓ Database is up to date.
[18:57:32.846] $ rollup -c rollup.tracker.config.mjs
[18:57:33.032] 
[18:57:33.033] src/tracker/index.js → public/script.js...
[18:57:33.319] created public/script.js in 287ms
[18:57:33.574] $ node scripts/build-geo.js
[18:57:33.681] Vercel environment detected. Skipping geo setup.
[18:57:33.942] $ next build
[18:57:34.656] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[18:57:34.657] This information is used to shape Next.js' roadmap and prioritize features.
[18:57:34.658] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[18:57:34.658] https://nextjs.org/telemetry
[18:57:34.658] 
[18:57:34.754]    ▲ Next.js 14.1.4
[18:57:34.755] 
[18:57:34.838]    Creating an optimized production build ...
[18:57:38.660] Browserslist: caniuse-lite is outdated. Please run:
[18:57:38.660]   npx update-browserslist-db@latest
[18:57:38.661]   Why you should do it regularly: https://github.com/browserslist/update-db#readme
[18:58:17.192]  ✓ Compiled successfully
[18:58:17.194]    Skipping validation of types
[18:58:17.195]    Skipping linting
[18:58:17.551]    Collecting page data ...
[18:58:20.399]    Generating static pages (0/20) ...
[18:58:21.523] 
   Generating static pages (5/20) 
[18:58:22.152] 
   Generating static pages (10/20) 
[18:58:22.696] 
   Generating static pages (15/20) 
[18:58:23.279] 
 ✓ Generating static pages (20/20) 
[18:58:24.577]    Finalizing page optimization ...
[18:58:24.578]    Collecting build traces ...
[18:58:51.944] 
[18:58:51.954] Route (app)                                          Size     First Load JS
[18:58:51.954] ┌ ○ /                                                143 B          85.3 kB
[18:58:51.955] ├ ○ /_not-found                                      0 B                0 B
[18:58:51.955] ├ λ /console/[[...websiteId]]                        5.13 kB         588 kB
[18:58:51.955] ├ ○ /dashboard                                       2.63 kB         650 kB
[18:58:51.955] ├ ○ /login                                           2.13 kB         507 kB
[18:58:51.955] ├ ○ /logout                                          399 B           460 kB
[18:58:51.955] ├ ○ /profile                                         4.58 kB         517 kB
[18:58:51.955] ├ ○ /reports                                         2.77 kB         515 kB
[18:58:51.955] ├ λ /reports/[reportId]                              208 B           627 kB
[18:58:51.955] ├ ○ /reports/create                                  174 B           516 kB
[18:58:51.955] ├ ○ /reports/event-data                              175 B           526 kB
[18:58:51.955] ├ ○ /reports/funnel                                  173 B           527 kB
[18:58:51.955] ├ ○ /reports/insights                                1.19 kB         529 kB
[18:58:51.955] ├ ○ /reports/retention                               175 B           526 kB
[18:58:51.955] ├ ○ /reports/utm                                     225 B           618 kB
[18:58:51.955] ├ ○ /settings/teams                                  3.65 kB         524 kB
[18:58:51.955] ├ λ /settings/teams/[teamId]/members                 172 B           508 kB
[18:58:51.955] ├ λ /settings/teams/[teamId]/team                    169 B           516 kB
[18:58:51.955] ├ λ /settings/teams/[teamId]/websites                183 B           524 kB
[18:58:51.955] ├ ○ /settings/users                                  4.09 kB         516 kB
[18:58:51.955] ├ λ /settings/users/[userId]                         3.99 kB         524 kB
[18:58:51.955] ├ ○ /settings/websites                               2.8 kB          515 kB
[18:58:51.955] ├ λ /settings/websites/[websiteId]                   177 B           524 kB
[18:58:51.955] ├ λ /share/[...shareId]                              2.05 kB         663 kB
[18:58:51.956] ├ ○ /sso                                             3.49 kB         293 kB
[18:58:51.956] ├ λ /teams/[teamId]/dashboard                        2.63 kB         650 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports                          2.77 kB         515 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports/[reportId]               208 B           627 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports/create                   174 B           516 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports/event-data               175 B           526 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports/funnel                   173 B           527 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports/insights                 1.19 kB         529 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports/retention                175 B           526 kB
[18:58:51.956] ├ λ /teams/[teamId]/reports/utm                      225 B           618 kB
[18:58:51.956] ├ λ /teams/[teamId]/settings/members                 172 B           508 kB
[18:58:51.956] ├ λ /teams/[teamId]/settings/team                    169 B           516 kB
[18:58:51.956] ├ λ /teams/[teamId]/settings/websites                183 B           524 kB
[18:58:51.956] ├ λ /teams/[teamId]/settings/websites/[websiteId]    176 B           524 kB
[18:58:51.956] ├ λ /teams/[teamId]/websites                         2.77 kB         515 kB
[18:58:51.956] ├ λ /teams/[teamId]/websites/[websiteId]             232 B           662 kB
[18:58:51.957] ├ λ /teams/[teamId]/websites/[websiteId]/event-data  1.65 kB         543 kB
[18:58:51.957] ├ λ /teams/[teamId]/websites/[websiteId]/realtime    184 B           654 kB
[18:58:51.957] ├ λ /teams/[teamId]/websites/[websiteId]/reports     171 B           524 kB
[18:58:51.957] ├ ○ /websites                                        2.77 kB         515 kB
[18:58:51.957] ├ λ /websites/[websiteId]                            232 B           662 kB
[18:58:51.957] ├ λ /websites/[websiteId]/event-data                 1.65 kB         543 kB
[18:58:51.957] ├ λ /websites/[websiteId]/realtime                   184 B           654 kB
[18:58:51.957] └ λ /websites/[websiteId]/reports                    172 B           524 kB
[18:58:51.957] + First Load JS shared by all                        85.2 kB
[18:58:51.957]   ├ chunks/8069-411d9338b61625cd.js                  29.2 kB
[18:58:51.957]   ├ chunks/fd9d1056-dab1e306066697a6.js              53.4 kB
[18:58:51.957]   └ other shared chunks (total)                      2.61 kB
[18:58:51.957] 
[18:58:51.957] Route (pages)                                        Size     First Load JS
[18:58:51.957] ┌ λ /api/admin/users                                 0 B            84.5 kB
[18:58:51.957] ├ λ /api/admin/websites                              0 B            84.5 kB
[18:58:51.957] ├ λ /api/auth/login                                  0 B            84.5 kB
[18:58:51.957] ├ λ /api/auth/logout                                 0 B            84.5 kB
[18:58:51.957] ├ λ /api/auth/sso                                    0 B            84.5 kB
[18:58:51.957] ├ λ /api/auth/verify                                 0 B            84.5 kB
[18:58:51.957] ├ λ /api/config                                      0 B            84.5 kB
[18:58:51.957] ├ λ /api/event-data/events                           0 B            84.5 kB
[18:58:51.957] ├ λ /api/event-data/fields                           0 B            84.5 kB
[18:58:51.957] ├ λ /api/event-data/stats                            0 B            84.5 kB
[18:58:51.957] ├ λ /api/heartbeat                                   0 B            84.5 kB
[18:58:51.957] ├ λ /api/me                                          0 B            84.5 kB
[18:58:51.957] ├ λ /api/me/password                                 0 B            84.5 kB
[18:58:51.957] ├ λ /api/me/teams                                    0 B            84.5 kB
[18:58:51.957] ├ λ /api/me/websites                                 0 B            84.5 kB
[18:58:51.957] ├ λ /api/realtime/[websiteId]                        0 B            84.5 kB
[18:58:51.957] ├ λ /api/reports                                     0 B            84.5 kB
[18:58:51.957] ├ λ /api/reports/[reportId]                          0 B            84.5 kB
[18:58:51.957] ├ λ /api/reports/funnel                              0 B            84.5 kB
[18:58:51.957] ├ λ /api/reports/insights                            0 B            84.5 kB
[18:58:51.957] ├ λ /api/reports/retention                           0 B            84.5 kB
[18:58:51.957] ├ λ /api/reports/utm                                 0 B            84.5 kB
[18:58:51.957] ├ λ /api/scripts/telemetry                           0 B            84.5 kB
[18:58:51.957] ├ λ /api/send                                        0 B            84.5 kB
[18:58:51.958] ├ λ /api/share/[shareId]                             0 B            84.5 kB
[18:58:51.958] ├ λ /api/teams                                       0 B            84.5 kB
[18:58:51.958] ├ λ /api/teams/[teamId]                              0 B            84.5 kB
[18:58:51.958] ├ λ /api/teams/[teamId]/users                        0 B            84.5 kB
[18:58:51.958] ├ λ /api/teams/[teamId]/users/[userId]               0 B            84.5 kB
[18:58:51.958] ├ λ /api/teams/[teamId]/websites                     0 B            84.5 kB
[18:58:51.958] ├ λ /api/teams/join                                  0 B            84.5 kB
[18:58:51.958] ├ λ /api/users                                       0 B            84.5 kB
[18:58:51.958] ├ λ /api/users/[userId]                              0 B            84.5 kB
[18:58:51.958] ├ λ /api/users/[userId]/teams                        0 B            84.5 kB
[18:58:51.958] ├ λ /api/users/[userId]/usage                        0 B            84.5 kB
[18:58:51.958] ├ λ /api/users/[userId]/websites                     0 B            84.5 kB
[18:58:51.958] ├ λ /api/version                                     0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites                                    0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]                        0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/active                 0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/daterange              0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/events                 0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/metrics                0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/pageviews              0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/reports                0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/reset                  0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/stats                  0 B            84.5 kB
[18:58:51.958] ├ λ /api/websites/[websiteId]/transfer               0 B            84.5 kB
[18:58:51.958] └ λ /api/websites/[websiteId]/values                 0 B            84.5 kB
[18:58:51.958] + First Load JS shared by all                        84.5 kB
[18:58:51.958]   ├ chunks/framework-08aa667e5202eed8.js             45.2 kB
[18:58:51.958]   ├ chunks/main-9163f505c5366342.js                  36.8 kB
[18:58:51.958]   └ other shared chunks (total)                      2.58 kB
[18:58:51.960] 
[18:58:51.960] ○  (Static)   prerendered as static content
[18:58:51.960] λ  (Dynamic)  server-rendered on demand using Node.js
[18:58:51.961] 
[18:58:52.147] $ node scripts/postbuild.js
[18:58:52.791] Done in 199.14s.
[18:58:53.058] Traced Next.js server files in: 100.736ms
[18:58:58.929] Created all serverless functions in: 5.870s
[18:58:58.997] Collected static files (public/, static/, .next/static): 61.077ms
[18:58:59.170] Build Completed in /vercel/output [5m]
[18:58:59.680] Deploying outputs...
[18:59:04.855] Injected preview comments middleware, you can disable this in your project settings.
[18:59:15.952] 
[18:59:16.251] Deployment completed
[18:59:36.148] Uploading build cache [194.30 MB]...
[18:59:38.132] Build cache uploaded: 1.983s

package.json

{
  "name": "umami",
  "version": "2.11.2",
  "description": "A simple, fast, privacy-focused alternative to Google Analytics.",
  "author": "Umami Software, Inc. <hello@umami.is>",
  "license": "MIT",
  "homepage": "https://umami.is",
  "repository": {
    "type": "git",
    "url": "https://github.com/umami-software/umami.git"
  },
  "scripts": {
    "dev": "next dev -p 3000",
    "build": "npm-run-all check-env build-db check-db build-tracker build-geo build-app",
    "start": "next start",
    "build-docker": "npm-run-all build-db build-tracker build-geo build-app",
    "start-docker": "npm-run-all check-db update-tracker start-server",
    "start-env": "node scripts/start-env.js",
    "start-server": "node server.js",
    "build-app": "next build",
    "build-components": "rollup -c rollup.components.config.mjs",
    "build-tracker": "rollup -c rollup.tracker.config.mjs",
    "build-db": "npm-run-all copy-db-files build-db-client resolve-db",
    "resolve-db": "prisma migrate resolve --applied '05_add_visit_id'",
    "build-lang": "npm-run-all format-lang compile-lang clean-lang download-country-names download-language-names",
    "build-geo": "node scripts/build-geo.js",
    "build-db-schema": "prisma db pull",
    "build-db-client": "prisma generate",
    "update-tracker": "node scripts/update-tracker.js",
    "update-db": "prisma migrate deploy",
    "check-db": "node scripts/check-db.js",
    "check-env": "node scripts/check-env.js",
    "copy-db-files": "node scripts/copy-db-files.js",
    "extract-messages": "formatjs extract \"src/components/messages.ts\" --out-file build/extracted-messages.json",
    "merge-messages": "node scripts/merge-messages.js",
    "generate-lang": "npm-run-all extract-messages merge-messages",
    "format-lang": "node scripts/format-lang.js",
    "compile-lang": "formatjs compile-folder --ast build/messages public/intl/messages",
    "clean-lang": "prettier --write ./public/intl/messages/*.json",
    "check-lang": "node scripts/check-lang.js",
    "download-country-names": "node scripts/download-country-names.js",
    "download-language-names": "node scripts/download-language-names.js",
    "change-password": "node scripts/change-password.js",
    "lint": "next lint --quiet",
    "prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install",
    "postbuild": "node scripts/postbuild.js",
    "test": "jest",
    "cypress-open": "cypress open cypress run",
    "cypress-run": "cypress run cypress run"
  },
  "lint-staged": {
    "**/*.{js,jsx,ts,tsx}": [
      "prettier --write",
      "eslint"
    ],
    "**/*.css": [
      "stylelint --fix",
      "prettier --write"
    ],
    "**/*.json": [
      "prettier --write"
    ]
  },
  "cacheDirectories": [
    ".next/cache"
  ],
  "dependencies": {
    "@clickhouse/client": "^0.2.2",
    "@fontsource/inter": "^4.5.15",
    "@prisma/client": "5.12.1",
    "@prisma/extension-read-replicas": "^0.3.0",
    "@react-spring/web": "^9.7.3",
    "@tanstack/react-query": "^5.28.6",
    "@umami/prisma-client": "^0.14.0",
    "@umami/redis-client": "^0.18.0",
    "chalk": "^4.1.1",
    "chart.js": "^4.4.2",
    "chartjs-adapter-date-fns": "^3.0.0",
    "classnames": "^2.3.1",
    "colord": "^2.9.2",
    "cors": "^2.8.5",
    "cross-spawn": "^7.0.3",
    "date-fns": "^2.23.0",
    "date-fns-tz": "^1.1.4",
    "dateformat": "^5.0.3",
    "debug": "^4.3.4",
    "del": "^6.0.0",
    "detect-browser": "^5.2.0",
    "dotenv": "^10.0.0",
    "eslint-plugin-promise": "^6.1.1",
    "fs-extra": "^10.0.1",
    "immer": "^9.0.12",
    "ipaddr.js": "^2.0.1",
    "is-ci": "^3.0.1",
    "is-docker": "^3.0.0",
    "is-localhost-ip": "^1.4.0",
    "isbot": "^5.1.1",
    "kafkajs": "^2.1.0",
    "maxmind": "^4.3.6",
    "md5": "^2.3.0",
    "moment-timezone": "^0.5.35",
    "next": "14.1.4",
    "next-basics": "^0.39.0",
    "node-fetch": "^3.2.8",
    "npm-run-all": "^4.1.5",
    "prisma": "5.12.1",
    "react": "^18.2.0",
    "react-basics": "^0.123.0",
    "react-beautiful-dnd": "^13.1.0",
    "react-dom": "^18.2.0",
    "react-error-boundary": "^4.0.4",
    "react-intl": "^6.5.5",
    "react-simple-maps": "^2.3.0",
    "react-use-measure": "^2.0.4",
    "react-window": "^1.8.6",
    "request-ip": "^3.3.0",
    "semver": "^7.5.4",
    "thenby": "^1.3.4",
    "uuid": "^9.0.0",
    "yup": "^0.32.11",
    "zustand": "^4.3.8"
  },
  "devDependencies": {
    "@formatjs/cli": "^4.2.29",
    "@netlify/plugin-nextjs": "^4.41.3",
    "@rollup/plugin-alias": "^5.0.0",
    "@rollup/plugin-commonjs": "^25.0.4",
    "@rollup/plugin-json": "^6.0.0",
    "@rollup/plugin-node-resolve": "^15.2.0",
    "@rollup/plugin-replace": "^5.0.2",
    "@svgr/rollup": "^8.1.0",
    "@svgr/webpack": "^8.1.0",
    "@types/cypress": "^1.1.3",
    "@types/jest": "^29.5.12",
    "@types/node": "^20.9.0",
    "@types/react": "^18.2.41",
    "@types/react-dom": "^18.2.17",
    "@types/react-window": "^1.8.8",
    "@typescript-eslint/eslint-plugin": "^6.7.3",
    "@typescript-eslint/parser": "^6.7.3",
    "cross-env": "^7.0.3",
    "cypress": "^13.6.6",
    "esbuild": "^0.17.17",
    "eslint": "^8.33.0",
    "eslint-config-next": "^14.0.4",
    "eslint-config-prettier": "^8.5.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-plugin-css-modules": "^2.12.0",
    "eslint-plugin-cypress": "^2.15.1",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-jest": "^27.9.0",
    "eslint-plugin-prettier": "^4.0.0",
    "extract-react-intl-messages": "^4.1.1",
    "husky": "^8.0.3",
    "jest": "^29.7.0",
    "lint-staged": "^14.0.1",
    "postcss": "^8.4.31",
    "postcss-flexbugs-fixes": "^5.0.2",
    "postcss-import": "^15.1.0",
    "postcss-preset-env": "7.8.3",
    "postcss-rtlcss": "^4.0.1",
    "prettier": "^2.6.2",
    "prompts": "2.4.2",
    "rollup": "^3.28.0",
    "rollup-plugin-copy": "^3.4.0",
    "rollup-plugin-delete": "^2.0.0",
    "rollup-plugin-dts": "^5.3.1",
    "rollup-plugin-esbuild": "^5.0.0",
    "rollup-plugin-node-externals": "^6.1.1",
    "rollup-plugin-postcss": "^4.0.2",
    "rollup-plugin-terser": "^7.0.2",
    "stylelint": "^15.10.1",
    "stylelint-config-css-modules": "^4.4.0",
    "stylelint-config-prettier": "^9.0.3",
    "stylelint-config-recommended": "^14.0.0",
    "tar": "^6.1.2",
    "ts-jest": "^29.1.2",
    "ts-node": "^10.9.1",
    "typescript": "^5.4.3"
  }
}
tudor-cel-stan commented 2 months ago

Hello, I was having no issues in the build step, I've installed umami about 3-4 times before, but after this last commit I am getting exactly the Prima error in this thread :/

EDIT: Turns out the migration was erroring out because this time around I was installing on a MariaDB database rather than a MySQL one. I used phpMyAdmin to import the tables from one of my old installs to the new one and the whole installation process worked just fine. If this error is still being researched, maybe it helps to know that for some cases it only affects MariaDB. (I was installing Umami from source, not docker, on CloudPanel, a minimal server panel running on a Hetzner CPX21 server, with Ubuntu 24.04)

Laudierst commented 2 weeks ago

Olá pessoal. A solução é fácil amigo, é sô apaga a pasta migrate e depois dá um npx prisma migrate deve gerar uma nova migarte, lembrado que você tem que fazer isso em um banco de dados de teste, tipo rondando em um docker, por exemplo, ai depois você sobe o depoloy, e vai corrigir o erro ok.

rain64x commented 2 weeks ago

I installed on a temporary mysql:latest container and then exported the database to my production mariadb server Working fine now

Laudierst commented 2 weeks ago

Esse é o link do vídeo: https://download856.mediafire.com/ojirvigqee6gwWs1UejRQiOHZwqwckdE2Hq6FCLwnKXSlmG3ai0hWiZURDHdojIsHCLDSlAh16Qpg4uPBAfHyloGqZvbIsMsxgZLhwLpu3B1GOfh62HQnLH39-i-surtmoIxy31vwTxzbjQ1RkpsnKCkVQQGVMGdCGfloDFtl61x9Bg/ya6beihf7v0hpi8/cOMO+CONVERTER+IMAGEM+EM+PDF+EM+WORD.mp4

On Wed, Aug 21, 2024 at 2:47 PM Mahesh Anand Kadri @.***> wrote:

I installed on a temporary mysql:latest container and then exported the database to my production mariadb server

— Reply to this email directly, view it on GitHub https://github.com/umami-software/umami/issues/2645#issuecomment-2302639255, or unsubscribe https://github.com/notifications/unsubscribe-auth/BHOHKI5YBMPHPNZT32MAP3DZSTHDLAVCNFSM6AAAAABFYEYKROVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBSGYZTSMRVGU . You are receiving this because you commented.Message ID: @.***>