Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var dbm;
- var type;
- var seed;
- /**
- * We receive the dbmigrate dependency from dbmigrate initially.
- * This enables us to not have to rely on NODE_PATH.
- */
- exports.setup = function(options, seedLink) {
- dbm = options.dbmigrate;
- type = dbm.dataType;
- seed = seedLink;
- };
- exports.up = function(db) {
- db.createTable('appointments', {
- columns: {
- id: {type: 'int', primaryKey: true, autoIncrement: true},
- title: {type: 'string', length: 255, notNull: true},
- description: {type: 'string', length: 255},
- startTime: {type: 'datetime', notNull: true},
- endTime: {type: 'datetime'},
- userId: {type: 'int', length: 11, notNull: true},
- createdAt: {type: 'datetime'},
- updatedAt: {type: 'datetime'}
- },
- ifNotExists: true
- });
- db.createTable('users', {
- columns: {
- id: {type: 'int', primaryKey: true, autoIncrement: true},
- email: {type: 'string', length: 255, notNull: true},
- password: {type: 'string', length: 255, notNull: true},
- firstName: {type: 'string', length: 255},
- lastName: {type: 'string', length: 255},
- addressOne: {type: 'string', length: 255},
- addressTwo: {type: 'string', length: 255},
- city: {type: 'string', length: 255},
- state: {type: 'string', length: 255},
- zip: {type: 'string', length: 255},
- country: {type: 'string', length: 255},
- phone: {type: 'string', length: 255},
- createdAt: {type: 'datetime'},
- updatedAt: {type: 'datetime'}
- },
- ifNotExists: true
- });
- db.createTable('contacts', {
- columns: {
- id: {type: 'int', primaryKey: true, autoIncrement: true},
- email: {type: 'string', length: 255, notNull: true},
- firstName: {type: 'string', length: 255},
- lastName: {type: 'string', length: 255},
- addressOne: {type: 'string', length: 255},
- addressTwo: {type: 'string', length: 255},
- city: {type: 'string', length: 255},
- state: {type: 'string', length: 255},
- zip: {type: 'string', length: 255},
- country: {type: 'string', length: 255},
- phone: {type: 'string', length: 255},
- createdAt: {type: 'datetime'},
- updatedAt: {type: 'datetime'}
- },
- ifNotExists: true
- });
- db.createTable('notes', {
- columns: {
- id: {type: 'int', primaryKey: true, autoIncrement: true},
- appointmentId: {type: 'int', length: 11},
- contactId: {type: 'int', length: 11},
- title: {type: 'string', length: 255, notNull: true},
- content: {type: 'text'},
- createdAt: {type: 'datetime'},
- updatedAt: {type: 'datetime'}
- },
- ifNotExists: true
- });
- db.createTable('appointment_contacts', {
- columns: {
- id: {type: 'int', primaryKey: true, autoIncrement: true},
- appointmentId: {type: 'int', length: 11, notNull: true},
- contactId: {type: 'int', length: 11, notNull: true},
- createdAt: {type: 'datetime'},
- updatedAt: {type: 'datetime'}
- },
- ifNotExists: true
- });
- };
- exports.down = function(db) {
- db.dropTable('appointments');
- db.dropTable('users');
- db.dropTable('contacts');
- db.dropTable('notes');
- db.dropTable('appointment_contacts');
- };
- exports._meta = {
- "version": 1
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement