Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

SQLite3 Adapter #3

Open
wants to merge 85 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a97d754
Updated title and main description
AndrewJo Nov 15, 2013
7a94377
Updated package name and authorship information
AndrewJo Nov 15, 2013
9a6497a
Added sqlite3 as dependency
AndrewJo Nov 15, 2013
c23a09b
Added underscore.js
AndrewJo Nov 19, 2013
2f3493b
Added disclaimer
AndrewJo Nov 19, 2013
5bf9283
Initial commit
AndrewJo Nov 22, 2013
bc26744
Added reference to Query objects
AndrewJo Nov 22, 2013
74cee91
Initial commit
AndrewJo Nov 22, 2013
964fb11
Added buildSelectStatement function
AndrewJo Nov 22, 2013
8c04bdc
Initial commit
AndrewJo Nov 22, 2013
3e3746a
Initial commit
AndrewJo Nov 23, 2013
1da61e7
Added unit test packages
AndrewJo Nov 23, 2013
dc22894
Fixed namespace typo
AndrewJo Nov 23, 2013
2bb54ef
Initial commit
AndrewJo Nov 23, 2013
2ad9477
Removed index.js
AndrewJo Nov 23, 2013
72e0b0c
Fixed a typo in the regular expression and added a return statement
AndrewJo Nov 24, 2013
61b4878
Prevent raising errors for dropping tables that don't exist
AndrewJo Nov 24, 2013
4fff0e7
Switched to named parameters for index list query and fixed callback …
AndrewJo Nov 24, 2013
375ec9d
Switched to named parameters for index list query and fixed callback …
AndrewJo Nov 24, 2013
296a80a
Initial commit
AndrewJo Nov 25, 2013
32a7a23
Initial unit test commit
AndrewJo Nov 25, 2013
f53c208
Fixed bugs found from unit tests
AndrewJo Nov 25, 2013
e5f7b1b
Updated async version
AndrewJo Nov 25, 2013
852fcd5
Added sqlite3 module and typo fix to db config
AndrewJo Nov 25, 2013
44c4f56
Added new method and typo fix for closing db
AndrewJo Nov 25, 2013
a76dcd2
Major bug fixes found from unit tests
AndrewJo Nov 25, 2013
befb698
Initial commit
AndrewJo Nov 26, 2013
12ada0b
Fixed find(), update() bugs
AndrewJo Nov 26, 2013
f18f935
Added Seed() method
AndrewJo Nov 26, 2013
245daca
Fixed a bug in destroy() method
AndrewJo Nov 26, 2013
6f3447f
Fixed a bug with creating index
AndrewJo Nov 26, 2013
3e3036b
Indexing unit test
AndrewJo Nov 26, 2013
5d2ebf8
Aggregate unit tests
AndrewJo Nov 26, 2013
23b6c11
Added query unit tests
AndrewJo Nov 26, 2013
64c8226
Added aggregate query unit tests
AndrewJo Nov 26, 2013
19c1636
Fixed a spacing typo
AndrewJo Nov 26, 2013
d3a19a2
tested and working copy, has been running stable for a few years now
dasilva333 Jun 12, 2017
bbf1e1d
removed all comments and unused code
dasilva333 Jan 29, 2018
95e3ddf
Merge pull request #3 from dasilva333/master
AndrewJo Jan 29, 2018
b9230bc
Upgrading sqlite3 to avoid windows install error
kcappieg Dec 1, 2018
7392023
Add waterline-errors to dependencies
kcappieg Dec 1, 2018
5f7977f
updating package.json for sails 1.x
kcappieg Dec 1, 2018
6e03d90
start refactor for waterline adapter api version 1
kcappieg Dec 1, 2018
25d5d51
add missing require
kcappieg Dec 1, 2018
a66ecb4
attempt define method
kcappieg Dec 2, 2018
b0d9fe9
add drop function
kcappieg Dec 2, 2018
bee3faf
async bug
kcappieg Dec 2, 2018
ad4a537
wrap drop call in spawn
kcappieg Dec 2, 2018
f418c05
minor bug fixes, notes on other bugs
kcappieg Dec 2, 2018
a8d0360
updates to util for creating tables
kcappieg Dec 2, 2018
c42892a
bug fixes
kcappieg Dec 2, 2018
d78ee1e
get describes in prep for create
kcappieg Dec 2, 2018
d2c6eda
modify describe call
kcappieg Dec 3, 2018
8d4abac
merge from remote
kcappieg Dec 3, 2018
4720a7f
implement most of create
kcappieg Dec 3, 2018
67ce012
bugfix async
kcappieg Dec 3, 2018
1b02e97
bug fixes and create method
kcappieg Dec 4, 2018
5015ced
start update implementation
kcappieg Dec 4, 2018
569b3f8
bug fix update
kcappieg Dec 4, 2018
51d4853
an attempt at find
kcappieg Dec 7, 2018
800b582
Basic find works
kcappieg Dec 7, 2018
cbf871a
refactor create into createEach
kcappieg Dec 7, 2018
0dad649
bug fix find, update, createEach
kcappieg Dec 8, 2018
98e6730
Begin refactor query.where
kcappieg Dec 8, 2018
6847f1d
Finish an implementation of where
kcappieg Dec 12, 2018
e45bc65
Query.where bug fixes
kcappieg Dec 12, 2018
88e4b32
destroy method
kcappieg Dec 15, 2018
4ddafc0
bug fixes
kcappieg Dec 15, 2018
9d47301
refactor for sequential writes
kcappieg Dec 16, 2018
3f85426
Prepping for new tests
kcappieg Dec 16, 2018
11e715f
Merge branch 'master' of github.com:kcappieg/sails-sqlite3
kcappieg Dec 16, 2018
b4c1fae
Start testing w/ waterline tests
kcappieg Dec 19, 2018
6f5d3e7
Bug fix createEach fetch
kcappieg Dec 19, 2018
7f4d771
Fix NOT IN error
kcappieg Dec 20, 2018
8d0c251
Passing all waterline tests
kcappieg Dec 21, 2018
fe06efe
Bug fixes for Associations
kcappieg Dec 21, 2018
cdba3b0
Clean unused code, update readme
kcappieg Dec 21, 2018
ffb22bf
readme updates
kcappieg Jan 5, 2019
7b1b1b7
Merge pull request #4 from kcappieg/master
AndrewJo Jan 8, 2019
737b278
update repo
kcappieg Jan 12, 2019
2716f2a
0.1.1
kcappieg Jan 12, 2019
9965eb1
bug fix create method
kcappieg Jan 21, 2019
ca04deb
0.1.2
kcappieg Jan 21, 2019
13e27cd
update package versions
kcappieg Aug 17, 2019
f7c1968
0.1.3
kcappieg Aug 17, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ ssl
*~
.idea
nbproject
npm-debug.log
npm-debug.log

# Waterline
sailssqlite.db
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
MOCHA_OPTS= --check-leaks
REPORTER = spec

test: test-unit test-integration

test-unit:
@NODE_ENV=test ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
$(MOCHA_OPTS) \
test/unit/**

test-integration:
@NODE_ENV=test node test/integration/runner.js

test-load:
@NODE_ENV=test ./node_modules/.bin/mocha \
--reporter $(REPORTER) \
$(MOCHA_OPTS) \
test/load/**
69 changes: 51 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,63 @@
![[email protected]](http://i.imgur.com/RIvu9.png)
![[email protected]](http://i.imgur.com/RIvu9.png)

# BoilerplateAdapter
# SQLite3 Sails/Waterline Adapter

This template exists to make it easier for you to get started writing an official adapter for Sails.js.
A [Waterline](https://github.com/balderdashy/waterline) adapter for SQLite3. May be used in a [Sails](https://github.com/balderdashy/sails) app or anything using Waterline for the ORM.


## Disclaimers
- SQLite3 adapter is not optimized for performance. Native joins are not implemented (among other issues).
- This codebase contains no unit tests, though all integration tests with the waterline api (v1) pass. (See below for supported interfaces)

#### People who can use this package as is:
Those prototyping apps with sailsjs 1.x and looking to use sqlite for a test database.

For anyone looking to use this adapter in production, contributions welcome!

## Getting started
It's usually pretty easy to add your own adapters for integrating with proprietary systems or existing open APIs. For most things, it's as easy as `require('some-module')` and mapping the appropriate methods to match waterline semantics. To get started:
To use this in your sails app, install using:

> npm install --save sails-sqlite3

In your `config\datastores.js` file, add a property with your datastore name. Supported configuration:

```js
default: {
adapter: 'sails-sqlite3',
filename: '[YOUR DATABASE].db',
mode: sqlite3.OPEN_READWRITE | sqlite3.OPEN_CREATE,
verbose: false
}
```

For more information on the `mode` configuration property, see the [driver documentation](https://github.com/mapbox/node-sqlite3/wiki/API#new-sqlite3databasefilename-mode-callback).

#### Example with Modes
To use different database modes, import the `sqlite3` module, which is a dependency of this pacakge:

```js
const sqlite3 = require('sqlite3');

const config = {
filename: 'testdb.db',
mode: sqlite3.OPEN_READONLY,
verbose: true
};
```

## Testing

1. Fork this repository
2. Set up your README and package.json file. Sails.js adapter module names are of the form sails-*, where * is the name of the datastore or service you're integrating with.
3. Build your adapter.
> npm test

## How to test your adapter
1. Run `npm link` in this adapter's directory
2. Clone the sails.js core and modify the tests to use your new adapter.
3. Run `npm link sails-boilerplate`
4. From the sails.js core directory, run `npm test`.
Currently only `waterline-adapter-tests` are hooked up. Passing interfaces:

## Submitting your adapter
1. Do a pull request to this repository (make sure you attribute yourself as the author set the license in the package.json to "MIT") Please let us know about any special instructions for usage/testing.
2. We'll run the tests one last time. If there are any issues, we'll let you know.
3. When it's ready, we'll update the documentation with information about your new adapter
4. Then we'll tweet and post about it on our blog, adoring you with lavish praises.
5. Mike will send you jelly beans.
- semantic
- queryable
- associations
- migratable

## Acknowledgements
This is a rewrite from a fork of the sails-sqlite3 adapter written for sailsjs < 1.0.0 originally by [Andrew Jo](https://github.com/AndrewJo). I borrowed most of the structure of the code and a lot of the sql querying from the original codebase.

## About Sails.js and Waterline
http://SailsJs.com
Expand Down
223 changes: 0 additions & 223 deletions index.js

This file was deleted.

Loading