Structures for atlases

This commit is contained in:
Jori Lallo
2016-06-22 00:01:57 -07:00
parent cbdf6b517d
commit db16e71c5e
5 changed files with 198 additions and 224 deletions

View File

@@ -3,252 +3,193 @@
module.exports = {
up: function (queryInterface, Sequelize) {
queryInterface.createTable('atlases', {
id:
{ type: 'UUID',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: true },
name:
{ type: 'CHARACTER VARYING',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
description:
{ type: 'CHARACTER VARYING',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
type:
{ type: 'CHARACTER VARYING',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
atlasStructure:
{ type: 'JSONB',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
createdAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
updatedAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
teamId:
{ type: 'UUID',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false } }
);
id: {
type: 'UUID',
allowNull: false,
primaryKey: true
},
name: {
type: 'CHARACTER VARYING',
allowNull: true,
},
description: {
type: 'CHARACTER VARYING',
allowNull: true,
},
type: {
type: 'CHARACTER VARYING',
allowNull: true,
},
atlasStructure: {
type: 'JSONB',
allowNull: true,
},
createdAt: {
type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
},
updatedAt: {
type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
},
teamId: {
type: 'UUID',
allowNull: false,
references: {
model: "teams",
key: "id",
}
}
});
// documents
queryInterface.createTable('documents', {
id:
{ type: 'UUID',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: true },
urlId:
{ type: 'CHARACTER VARYING',
allowNull: false,
unique: true,
defaultValue: null,
special: [],
primaryKey: false },
unique: true, },
private:
{ type: 'BOOLEAN',
allowNull: false,
defaultValue: true,
special: [],
primaryKey: false },
},
title:
{ type: 'CHARACTER VARYING',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
},
text:
{ type: 'TEXT',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
},
html:
{ type: 'TEXT',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
},
preview:
{ type: 'TEXT',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
},
createdAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
},
updatedAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
userId:
{ type: 'UUID',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
atlasId:
{ type: 'UUID',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
parentDocumentForId:
{ type: 'UUID',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
teamId:
{ type: 'UUID',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false }
},
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",
}
}
});
queryInterface.createTable('teams', {
id:
{ type: 'UUID',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: true },
name:
{ type: 'CHARACTER VARYING',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
slackId:
{ type: 'CHARACTER VARYING',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: true },
slackData:
{ type: 'JSONB',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
createdAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
updatedAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false } }
);
id: {
type: 'UUID',
allowNull: false,
primaryKey: true
},
name: {
type: 'CHARACTER VARYING',
allowNull: true,
},
slackId: {
type: 'CHARACTER VARYING',
allowNull: true,
unique: true
},
slackData: {
type: 'JSONB',
allowNull: true,
},
createdAt: {
type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
},
updatedAt: {
type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
}
});
queryInterface.createTable('users', {
id:
{ type: 'UUID',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: true },
email:
{ type: 'CHARACTER VARYING',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
username:
{ type: 'CHARACTER VARYING',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
name:
{ type: 'CHARACTER VARYING',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
isAdmin:
{ type: 'BOOLEAN',
allowNull: true,
defaultValue: false,
special: [],
primaryKey: false },
slackAccessToken:
{ type: 'bytea',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
slackId:
{ type: 'CHARACTER VARYING',
allowNull: false,
defaultValue: null,
unique: true,
special: [],
primaryKey: false },
slackData:
{ type: 'JSONB',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
jwtSecret:
{ type: 'bytea',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false },
createdAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
updatedAt:
{ type: 'TIMESTAMP WITH TIME ZONE',
allowNull: false,
defaultValue: null,
special: [],
primaryKey: false },
teamId:
{ type: 'UUID',
allowNull: true,
defaultValue: null,
special: [],
primaryKey: false }
id: {
type: 'UUID',
allowNull: false,
primaryKey: true
},
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',
allowNull: true, },
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,
references: {
model: "teams",
key: "id",
}
}
});
},