不要怂,就是干,撸起袖子干!

Commit 7d601f32 by Mick Hansen

[ci skip] docs on docs on docs

1 parent c2ffae57
Sequelize is available via NPM.
```bash
$ npm install --save sequelize
# And one of the following:
$ npm install --save pg
$ npm install --save mysql
$ npm install --save mariasql
$ npm install --save sqlite3
```
## Setting up a connection
Sequelize will setup a connection pool on initialization so you should ideally only ever create on instance per application.
```js
var sequelize = new Sequelize('database', 'username', 'password', {
host: 'localhost',
dialect: 'mysql'|'mariadb'|'sqlite'|'postgres'
});
// Or you can simply use a connection uri
var sequelize = new Sequelize('postgress://user:pass@example.com:5432/dbname');
```
The Sequelize constructor takes a whole slew of options that are available via the [API reference](http://sequelize.readthedocs.org/en/latest/api/sequelize/).
\ No newline at end of file
While out of the box Sequelize will seem a bit opinionated it's trivial to both legacy and forward proof your application by defining (otherwise generated) table and field names.
## Tables
## Fields
## Foreign keys
## Join tables
\ No newline at end of file
## sequelize.sync()
`sequelize.sync()` will, based on your model definitions, create any missing tables. If `force: true` it will first drop tables before recreating them.
## Migrations / Manual schema changes
Sequelize has a [sister library](https://github.com/sequelize/umzug) for handling execution and logging of migration tasks.
Sequelize provides a list of ways to programmaticaly create or change a table schema.
### createTable
### addColumn
### changeColumn
### removeColumn
### addIndex
### removeIndex
### addConstraint
### removeConstraint
\ No newline at end of file
The Sequelize library provides easy access to MySQL, MariaDB, SQLite or PostgreSQL databases by mapping database entries to objects and vice versa. To put it in a nutshell, it's an ORM (Object-Relational-Mapper). The library is written entirely in JavaScript and can be used in the Node.JS environment. Sequelize is a promise-based Node.js ORM for Postgres, MySQL, SQLite and MariaDB. It features solid transaction support, relations, read replication and more.
## Installation ## Installation
```bash ```bash
$ npm install sequelize $ npm install sequelize --save
$ npm install mysql|pg|sqlite
# And one of the following:
$ npm install pg
$ npm install mysql
$ npm install mariasql
$ npm install sqlite3
``` ```
## Example usage ## Example usage
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!