-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9f69c6
commit 2a0ebe5
Showing
19 changed files
with
584 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const Sequelize = require("sequelize"); | ||
const connection = require("./database"); | ||
|
||
|
||
// Passando os parametros de criação da table 'questions' pelo método define do sequelize. | ||
const Question = connection.define('questions', { | ||
// passando os campos da tabela em formato JSON; | ||
username:{ | ||
type: Sequelize.STRING | ||
}, | ||
title:{ | ||
type: Sequelize.STRING, | ||
allowNull: false | ||
}, | ||
description:{ | ||
type: Sequelize.TEXT, | ||
allowNull: false | ||
}, | ||
description:{ | ||
type: Sequelize.TEXT, | ||
allowNull: false | ||
} | ||
}); | ||
|
||
// Sincronizando a tabela com o banco, e criando caso não exista, o "force" significa que não forçará uma nova criação se a tabela já existir | ||
Question.sync({force: false}).then(() => {}); | ||
|
||
module.exports = Question; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const Sequelize = require("sequelize"); | ||
const connection = require("./database"); | ||
|
||
const Response = connection.define('responses', { | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const Sequelize = require('sequelize'); | ||
|
||
const connection = new Sequelize( | ||
'devhelper', | ||
'root', | ||
'admin', | ||
{ | ||
host: 'localhost', | ||
dialect: 'mysql' | ||
}); | ||
|
||
module.exports = connection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.