2016-06-20 00:18:03 -07:00
|
|
|
module.exports = {
|
2017-04-26 21:47:03 -07:00
|
|
|
up: function(queryInterface, Sequelize) {
|
2016-06-23 00:12:41 -07:00
|
|
|
queryInterface.createTable('teams', {
|
2016-06-22 00:01:57 -07:00
|
|
|
id: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: false,
|
2017-04-26 21:47:03 -07:00
|
|
|
primaryKey: true,
|
2016-06-22 00:01:57 -07:00
|
|
|
},
|
|
|
|
name: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
2016-06-23 00:12:41 -07:00
|
|
|
slackId: {
|
2016-06-22 00:01:57 -07:00
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: true,
|
2017-04-26 21:47:03 -07:00
|
|
|
unique: true,
|
2016-06-22 00:01:57 -07:00
|
|
|
},
|
2016-06-23 00:12:41 -07:00
|
|
|
slackData: {
|
2016-06-22 00:01:57 -07:00
|
|
|
type: 'JSONB',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
|
|
|
createdAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
updatedAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
2017-04-26 21:47:03 -07:00
|
|
|
},
|
2016-06-20 00:18:03 -07:00
|
|
|
});
|
|
|
|
|
2016-06-23 00:12:41 -07:00
|
|
|
queryInterface.createTable('atlases', {
|
2016-06-22 00:01:57 -07:00
|
|
|
id: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: false,
|
2017-04-26 21:47:03 -07:00
|
|
|
primaryKey: true,
|
2016-06-22 00:01:57 -07:00
|
|
|
},
|
|
|
|
name: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
2016-06-23 00:12:41 -07:00
|
|
|
description: {
|
2016-06-22 00:01:57 -07:00
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
2016-06-23 00:12:41 -07:00
|
|
|
type: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
2016-06-26 21:56:14 -07:00
|
|
|
navigationTree: {
|
2016-06-22 00:01:57 -07:00
|
|
|
type: 'JSONB',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
|
|
|
createdAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
updatedAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
2016-06-23 00:12:41 -07:00
|
|
|
},
|
|
|
|
teamId: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: false,
|
|
|
|
// references: {
|
|
|
|
// model: "teams",
|
|
|
|
// key: "id",
|
|
|
|
// }
|
2017-04-26 21:47:03 -07:00
|
|
|
},
|
2016-06-22 00:01:57 -07:00
|
|
|
});
|
2016-06-20 00:18:03 -07:00
|
|
|
|
|
|
|
queryInterface.createTable('users', {
|
2016-06-22 00:01:57 -07:00
|
|
|
id: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: false,
|
2017-04-26 21:47:03 -07:00
|
|
|
primaryKey: true,
|
2016-06-22 00:01:57 -07:00
|
|
|
},
|
|
|
|
email: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
username: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
name: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
isAdmin: {
|
|
|
|
type: 'BOOLEAN',
|
|
|
|
allowNull: true,
|
|
|
|
defaultValue: false,
|
|
|
|
},
|
|
|
|
slackAccessToken: {
|
|
|
|
type: 'bytea',
|
2017-04-26 21:47:03 -07:00
|
|
|
allowNull: true,
|
|
|
|
},
|
2016-06-22 00:01:57 -07:00
|
|
|
slackId: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
unique: true,
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
slackData: {
|
|
|
|
type: 'JSONB',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
|
|
|
jwtSecret: {
|
|
|
|
type: 'bytea',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
|
|
|
createdAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
updatedAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
teamId: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: true,
|
2016-06-23 00:12:41 -07:00
|
|
|
// references: {
|
|
|
|
// model: "teams",
|
|
|
|
// key: "id",
|
|
|
|
// }
|
2017-04-26 21:47:03 -07:00
|
|
|
},
|
2016-06-23 00:12:41 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
queryInterface.createTable('documents', {
|
2017-04-26 21:47:03 -07:00
|
|
|
id: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: false,
|
|
|
|
primaryKey: true,
|
|
|
|
},
|
|
|
|
urlId: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: false,
|
|
|
|
unique: true,
|
|
|
|
},
|
|
|
|
private: {
|
|
|
|
type: 'BOOLEAN',
|
|
|
|
allowNull: false,
|
|
|
|
defaultValue: true,
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: 'CHARACTER VARYING',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
type: 'TEXT',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
|
|
|
html: {
|
|
|
|
type: 'TEXT',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
|
|
|
preview: {
|
|
|
|
type: 'TEXT',
|
|
|
|
allowNull: true,
|
|
|
|
},
|
|
|
|
createdAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
|
|
|
},
|
|
|
|
updatedAt: {
|
|
|
|
type: 'TIMESTAMP WITH TIME ZONE',
|
|
|
|
allowNull: false,
|
2016-06-23 00:12:41 -07:00
|
|
|
},
|
|
|
|
userId: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: true,
|
|
|
|
// references: {
|
|
|
|
// model: "users",
|
|
|
|
// key: "id",
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
atlasId: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: true,
|
|
|
|
// references: {
|
|
|
|
// model: "atlases",
|
|
|
|
// key: "id",
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
teamId: {
|
|
|
|
type: 'UUID',
|
|
|
|
allowNull: true,
|
|
|
|
// references: {
|
|
|
|
// model: "teams",
|
|
|
|
// key: "id",
|
|
|
|
// }
|
2017-04-26 21:47:03 -07:00
|
|
|
},
|
2016-06-20 00:18:03 -07:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-04-26 21:47:03 -07:00
|
|
|
down: function(queryInterface, Sequelize) {
|
2016-06-20 00:18:03 -07:00
|
|
|
queryInterface.dropAllTables();
|
2017-04-26 21:47:03 -07:00
|
|
|
},
|
2016-06-20 00:18:03 -07:00
|
|
|
};
|