waterline-adapter-tests
Version:
Integration tests for waterline adapters
128 lines (112 loc) • 2.55 kB
JavaScript
module.exports.user_resource = {
tableName: 'user_resourceTable',
identity: 'user_resource',
connection: 'associations',
primaryKey: 'id',
fetchRecordsOnUpdate: true,
fetchRecordsOnDestroy: false,
fetchRecordsOnCreate: true,
fetchRecordsOnCreateEach: true,
attributes: {
// Primary Key
id: {
type: Adapter.identity === 'sails-mongo' ? 'string' : 'number',
columnName: '_id',
autoMigrations: {
columnType: Adapter.identity === 'sails-mongo' ? '_stringkey' : '_numberkey',
autoIncrement: Adapter.identity === 'sails-mongo' ? false : true,
unique: true
}
},
name: {
type: 'string',
autoMigrations: {
columnType: 'varchar'
}
},
quantity: {
type: 'number',
autoMigrations: {
columnType: 'integer'
}
},
profile: {
model: 'profile',
columnName: 'profile_id',
autoMigrations: {
columnType: 'integer'
}
},
// Timestamps
updatedAt: {
type: 'number',
autoUpdatedAt: true,
autoMigrations: {
columnType: 'bigint'
}
},
createdAt: {
type: 'number',
autoCreatedAt: true,
autoMigrations: {
columnType: 'bigint'
}
}
}
};
module.exports.profile = {
tableName: 'profileTable',
identity: 'profile',
connection: 'associations',
primaryKey: 'id',
fetchRecordsOnUpdate: true,
fetchRecordsOnDestroy: false,
fetchRecordsOnCreate: true,
fetchRecordsOnCreateEach: true,
attributes: {
// Primary Key
id: {
type: Adapter.identity === 'sails-mongo' ? 'string' : 'number',
columnName: '_id',
autoMigrations: {
columnType: Adapter.identity === 'sails-mongo' ? '_stringkey' : '_numberkey',
autoIncrement: Adapter.identity === 'sails-mongo' ? false : true,
unique: true
}
},
name: {
type: 'string',
autoMigrations: {
columnType: 'varchar'
}
},
level: {
type: 'number',
autoMigrations: {
columnType: 'integer'
}
},
user: {
model: 'user_resource',
columnName: 'user_resource_id',
autoMigrations: {
columnType: 'integer'
}
},
// Timestamps
updatedAt: {
type: 'number',
autoUpdatedAt: true,
autoMigrations: {
columnType: 'bigint'
}
},
createdAt: {
type: 'number',
autoCreatedAt: true,
autoMigrations: {
columnType: 'bigint'
}
}
}
};