1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- var Test = require('../../support/test-runner');
- describe('Query Generation ::', function() {
- describe('LEFT JOINS ::', function() {
- it('should generate a basic left join query', function(done) {
- Test({
- query: {
- select: ['users.id', 'contacts.phone'],
- from: 'users',
- leftJoin: [
- {
- from: 'contacts',
- on: {
- users: 'id',
- contacts: 'user_id'
- }
- }
- ]
- },
- outcomes: [
- {
- dialect: 'postgresql',
- sql: 'select "users"."id", "contacts"."phone" from "users" left join "contacts" on "users"."id" = "contacts"."user_id"',
- bindings: []
- },
- {
- dialect: 'mysql',
- sql: 'select `users`.`id`, `contacts`.`phone` from `users` left join `contacts` on `users`.`id` = `contacts`.`user_id`',
- bindings: []
- },
- {
- dialect: 'sqlite3',
- sql: 'select "users"."id", "contacts"."phone" from "users" left join "contacts" on "users"."id" = "contacts"."user_id"',
- bindings: []
- },
- {
- dialect: 'oracle',
- sql: 'select "users"."id", "contacts"."phone" from "users" left join "contacts" on "users"."id" = "contacts"."user_id"',
- bindings: []
- },
- {
- dialect: 'mariadb',
- sql: 'select `users`.`id`, `contacts`.`phone` from `users` left join `contacts` on `users`.`id` = `contacts`.`user_id`',
- bindings: []
- }
- ]
- }, done);
- });
- });
- });
|