-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathmodel-sync.js
More file actions
40 lines (32 loc) · 992 Bytes
/
model-sync.js
File metadata and controls
40 lines (32 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var _ = require('lodash');
var should = require('should');
var helper = require('../support/spec_helper');
var ORM = require('../../');
var common = require('../common');
describe("Model.sync", function () {
var db = null;
this.timeout(5000);
before(function(done) {
helper.connect(function (connection) {
db = connection;
done();
});
});
after(function () {
db.close();
});
// SQLite scopes index names to a database and NOT a table, so
// index name collisions were possible. This tests the workaround.
it("should work with multiple same-named indexes", function (done) {
var A, B, C;
A = db.define('a', { name: String });
B = db.define('b', { name: String });
C = db.define('c', { name: String });
A.hasMany('bees', B, {}, { reverse: 'eighs' });
A.hasMany('cees', C, {}, { reverse: 'eighs' });
helper.dropSync([A, B, C], function (err) {
should.not.exist(err);
done();
});
});
});