build-your-own-backend's People
build-your-own-backend's Issues
Not allowing songs to have an id that connects to albums
Background
- I updated initial migration to add a foreign key in 'song' referencing album_id
- Did so by rollback to edit initial migration
The Problem
- With how the seed file was initially made (with an albums_id key in songs that would ideally connect song to album), now it's throwing an error that it doesn't fit constraints of foreign key
- Because of this error, the data was not updating to database
- Comment the line out where it declares songs to have the key of albums_id (in the seed file), and everything works besides now there's nothing connecting the two tables (I think)
Migration/Schema relationship
What's Wrong
- Within songs schema, there is no relationship addition to link songs to albums (should be based on album_id)
Why it's not fixed yet
- Cannot figure out how to reliably edit the column to include foreign/references
- Don't want to delete & redo database incase there is a fix that doesn't require this
Next steps
Either:
- figure out a way to edit column without having
Or: - delete/redo the database all together, which is very not ideal
Solution (within migration file in the songs schema) will end up adding something like:
table.integer('album_id').unsigned()
table.foreign('album_id').references('album.id')
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.