Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Database handler #34

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Database handler #34

wants to merge 15 commits into from

Conversation

Mattemagikern
Copy link

  • Created a Database handler.

This commit closes in parts the issue #31
Implemented a Database handler and wrote a test, which should fail until
database is created with a test subject with id = 1.

The Database handler uses preparedstatments.
Database.js exports a number of suggested skeleton functions to be
implemented if @Admin agrees with its usefulness.

The query function in the Database.js is a bit complicated and could use
a bit of improvement, but I have failed in finding a more suitable option.

Mattemagikern and others added 5 commits July 2, 2017 22:27
This commit closes in parts the issue #31
Implemented a Database handler and wrote a test, wich should fail untill
database is created with a test subject with id = 1.

The Database handler uses preparedstatments.
Database.js exports a number of suggested skeleton functions to be
implemented if @Admin agrees with its usefullness.

The query function in the Database.js is a bit complicated and could use
a bit of improvment, but I have faild in finding a more suitable option.
@Oscar-Rydh
Copy link
Contributor

Cool, looks like a good start! Though, maybe we should just make some tests that actually work, just as a principle before we merge?

Database.js Outdated
},

getUser : function (params,callback) {
var sql = "select * from user where id = ?";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tables should have plural names

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@Mattemagikern
Copy link
Author

Mattemagikern commented Jul 6, 2017

closes #31
closes #35
After this merge all users need to do the following:
Create a user 'dapi'@'localhost' with password "password"
create 3 databases: dapi_development, dapi_test and dapi_production
install dependencies

Going to write an issue where I state that we need a setup.md file which describes what needs to be done for a user to be able to start developing code on the backend.

@joelklint
Copy link

Nu ser det bättre ut @Mattemagikern! Databas-setup borde dock också vara implementerat av repot. Det är delvis detta migrations är till för. Finns att läsa hur man gör här.

Med migrations ska utvecklare kunna sätta up databas-miljön genom att bara ha tillgång till en databas, och sedan köra sequelize db:migrate.

Jag misstänker att sequelize db:init kommer vara väldigt hjälpsamt

@Oscar-Rydh
Copy link
Contributor

Oscar-Rydh commented Jul 6, 2017

Kommentar på @joelklint , vi hitta inte hur man skapa en database i sequelize! Vi titta på samma länk som du visa, men deras api verkar inte ha en createdatabase funktion

@eHammarstrom
Copy link
Contributor

eHammarstrom commented Jul 6, 2017

@Oscar-Rydh stöds tydligen inte än, se sequelize/cli#70. Öppen sedan 2014 (:

@joelklint
Copy link

Sails skapar väl databaser åt en? Kanske finns nåt att plocka därifrån

@ErikBjare
Copy link

ErikBjare commented Jul 6, 2017

Kan man inte bara köra https://github.com/Dsek-LTH/dAPI/blob/master/database/create_database.sql (eller delar av det) vid initialisering?

@ErikBjare
Copy link

Did a quick skim, looks like a decent start.

Travis fails though, you should probably try to fix that.

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

Successfully merging this pull request may close these issues.

5 participants