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

Database migration error #84

Open
kromonos opened this issue Oct 25, 2023 · 8 comments
Open

Database migration error #84

kromonos opened this issue Oct 25, 2023 · 8 comments

Comments

@kromonos
Copy link

-- Starting database migration from AdonisJS v4 to v5 --
Updating value from 'database/migrations/database/migrations/database/migrations/1503250034279_user' to 'database/migrations/database/migrations/database/migrations/database/migrations/1503250034279_user'
Updating value from 'database/migrations/database/migrations/database/migrations/1503250034280_token' to 'database/migrations/database/migrations/database/migrations/database/migrations/1503250034280_token'
Updating value from 'database/migrations/database/migrations/database/migrations/1566385379883_service_schema' to 'database/migrations/database/migrations/database/migrations/database/migrations/1566385379883_service_schema'
Updating value from 'database/migrations/database/migrations/database/migrations/1566554231482_recipe_schema' to 'database/migrations/database/migrations/database/migrations/database/migrations/1566554231482_recipe_schema'
Updating value from 'database/migrations/database/migrations/database/migrations/1566554359294_workspace_schema' to 'database/migrations/database/migrations/database/migrations/database/migrations/1566554359294_workspace_schema'
Updating value from 'database/migrations/database/migrations/database/migrations/1612629845398_users_update_schema' to 'database/migrations/database/migrations/database/migrations/database/migrations/1612629845398_users_update_schema'
❯ error database/migrations/1503250034279_user
❯ migrating database/migrations/1696110557648_jwt_tokens
[ error ]  create table "users" ("id" serial primary key, "username" varchar(80) not null, "email" varchar(254) not null, "password" varchar(60) not null, "settings" json, "created_at" timestamptz, "updated_at" timestamptz) - relation "users" already exists
    at Parser.parseErrorMessage (/app/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:369:69)
    at Parser.handlePacket (/app/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:188:21)
    at Parser.parse (/app/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/parser.ts:103:30)
    at Socket.<anonymous> (/app/node_modules/.pnpm/[email protected]/node_modules/pg-protocol/src/index.ts:7:48)
    at Socket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:335:12)
    at readableAddChunk (node:internal/streams/readable:308:9)
    at Socket.Readable.push (node:internal/streams/readable:245:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

Using Ferdium-Server via Docker with tag latest

@SpecialAro
Copy link
Member

Hello 👋 which tag were you using before updating?

@kromonos
Copy link
Author

kromonos commented Oct 25, 2023

I always was on latest.

Edit: I tried the tags 2.0.2 and 2.0.1. Both throw the same. I had to fall back to 1.3.16, that it works again.

@SpecialAro
Copy link
Member

Can you manually access the database and delete the database/migrations/database/migrations/database/migrations/database/migrations/ on all rows on the adonis migration table ? That seems to be the issue.
It should be just 1503250034279_user and the script would add database/migrations/ by itself

If this is too technical and you don't mind DM me (on discord perhaps) the sqlite database I can fix it for you!

@kromonos
Copy link
Author

hmm 🤔
Looks like I don't have that table:
image

I'm using Ferdium with a PostgreSQL database.

@SpecialAro
Copy link
Member

hmm 🤔 Looks like I don't have that table: image

I'm using Ferdium with a PostgreSQL database.

It should be the adonis_schema table (I think)

@kromonos
Copy link
Author

kromonos commented Nov 7, 2023

Apologies for my delayed response, I was a bit busy these days.
After removing anything from this table, I now get other errors:
image

@kromonos
Copy link
Author

kromonos commented Nov 7, 2023

Also maybe important:

109.250.235.143 - - [07/Nov/2023:22:39:56 +0100] "GET /user/login HTTP/2.0" 500 2057 "https://ferdi.bka.li/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
119.0.0.0 Safari/537.36"
109.250.235.143 - - [07/Nov/2023:22:39:56 +0100] "GET /favicon.ico HTTP/2.0" 302 16 "https://ferdi.bka.li/user/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko
) Chrome/119.0.0.0 Safari/537.36"
109.250.235.143 - - [07/Nov/2023:22:39:56 +0100] "GET / HTTP/2.0" 200 3385 "https://ferdi.bka.li/user/login" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
119.0.0.0 Safari/537.36"
109.250.235.143 - - [07/Nov/2023:22:39:57 +0100] "GET /v1/me HTTP/2.0" 401 69 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36.0 (KHTML, like Gecko) Chrome/118.0.5993.89 Safari/537.
36.0"
109.250.235.143 - - [07/Nov/2023:22:39:57 +0100] "GET /v1/me/services HTTP/2.0" 401 69 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36.0 (KHTML, like Gecko) Chrome/118.0.5993.89 Sa
fari/537.36.0"

EDIT: Solution for this: #86 (comment)

I've deleted all tables and started from fresh. This is, what I get now, with a “clean” install.

image

As well as:

**** Generating recipes for first run ****
Cloning into 'recipes'...
npm WARN using --force Recommended protections disabled.

added 1 package in 2s

1 package is looking for funding
  run `npm fund` for details
npm notice
npm notice New major version of npm available! 9.8.1 -> 10.2.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.3>
npm notice Run `npm install -g [email protected]` to update!
npm notice
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your Node version is incompatible with "/app/recipes".

Expected version: 20.9.0
Got: v18.18.0

@kromonos
Copy link
Author

kromonos commented Nov 7, 2023

This is my docker compose:

version: "3.8"
services:
  ferdium-server:
    #image: ferdium/ferdium-server:1.3.16
    image: ferdium/ferdium-server:latest
    container_name: ferdium-server
    environment:
      TZ: 'Europe/Berlin'
      #NODE_ENV: 'development'
      NODE_ENV: 'production'
      APP_URL: 'https://<url>'
      DB_CONNECTION: 'pg'
      DB_HOST: '127.0.0.1'
      DB_PORT: 5432
      DB_USER: 'ferdium'
      DB_PASSWORD: '<pw>'
      DB_DATABASE: '<db>'
      DB_SSL: false
      MAIL_CONNECTION: 'smtp'
      SMTP_HOST: '<mail.srv>'
      SMTP_PORT: 465
      MAIL_SSL: true
      MAIL_USERNAME: '<un>'
      MAIL_PASSWORD: '<p>'
      MAIL_SENDER: '[email protected]'
      IS_CREATION_ENABLED: true
      IS_DASHBOARD_ENABLED: true
      IS_REGISTRATION_ENABLED: true
      CONNECT_WITH_FRANZ: false
      DATA_DIR: '/data'
      HOST: 192.168.8.3
      PORT: 3017
      JWT_USE_PEM: true

    volumes:
      - ferdium-database:/data
      - ferdium-recipes:/app/build/recipes
    restart: unless-stopped
    privileged: true
    network_mode: host

volumes:
  ferdium-recipes:
  ferdium-database:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants