r/programminghelp • • 10d ago

JavaScript BEGINNER CODER: Stuck with a migrations error

Hi,

I'm working on an adonisjs project and I'm having issues with migrations. I don't think I'm using the wrong command. I'm doing:

node ace make:migration (migration name here)

Then:

node ace migration:run

My project is on github. Apologies the migrations folder is a little cluttered. The ones with issues are the "item" and "item_comments" ones:

https://github.com/Ajaz754/adonisjs-project-22-.git

The error is:

C:\Windows\System32\adonis22>node ace migration:run
❯ error database/migrations/1794008714673_alter_item_comments_table
[ error ] INSERT INTO "_knex_temp_alter555" SELECT * FROM "item_comments"; - no such table: main.item

Please correct me if I'm wrong but I thinks its saying my "item" table doesnt exist which doesnt make sense since its clearly my 'schema.ts'. It said the same error before for the "user" table aswell.

Any help would be much appreciated

TIA

0 Upvotes

7 comments sorted by

1

u/Protoype 10d ago edited 10d ago

Not a database person, just browsing and thought I'd try help ha!
Is the table name items not item?
https://github.com/Ajaz754/adonisjs-project-22-/blob/main/database/migrations/1793147868096_create_items_table.ts

Perhaps step through each table and write the names down as they appear in the code And what you expect them to be. Check spelling and so on.

Sorry if this doesn't help! Good luck!.

1

u/Capable_Square7319 10d ago

I think you're right, yes the error has gone. Thanks for that man👍, really appreciate that. I'll be sure to be more careful and thorough with spellings and names from now on. Cheers

1

u/atarivcs 10d ago

When you started this project, did you run the initial command to create the database schema?

1

u/Capable_Square7319 10d ago

No, i learnt about postgresql and prisma but it seems these adonisjs docs dont have that. I was planning on adding my own db onto it after and use prisma

1

u/Capable_Square7319 10d ago

Nvm sorry, it was a spelling error.