Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOROKA-131: Актуальные сидеры #36

Merged
merged 5 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sequelizerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path')

module.exports = {
'config': path.resolve('src', 'configs/db.mjs'),
'config': path.resolve('dist', 'configs/db.js'),
'models-path': path.resolve('src', 'models'),
'seeders-path': path.resolve('src', 'seeders'),
'migrations-path': path.resolve('src', 'migrations')
Expand Down
21 changes: 15 additions & 6 deletions src/seeders/001-data-types.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { Op } = require("sequelize");
'use strict';

module.exports = {
Expand All @@ -19,15 +20,23 @@ module.exports = {
name: 'GEO_POINT',
createdAt: new Date(),
updatedAt: new Date()
},
{
id: 4,
name: 'FILE',
createdAt: new Date(),
updatedAt: new Date()
},
{
id: 5,
name: 'RICH_TEXT',
createdAt: new Date(),
updatedAt: new Date()
}]);
},

async down (queryInterface, Sequelize) {
/**
* Add commands to revert seed here.
*
* Example:
* await queryInterface.bulkDelete('People', null, {});
*/
// Осторожно: удаляет все содержимое таблицы.
await queryInterface.bulkDelete('DataTypes', {}, {}, true);
}
};
134 changes: 121 additions & 13 deletions src/seeders/002-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ module.exports = {
async up (queryInterface, Sequelize) {
queryInterface.bulkInsert('Properties', [{
id: 1,
dataTypeId: 2,
dataTypeId: 1,
name: 'julianDate',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},{
id: 2,
dataTypeId: 2,
dataTypeId: 5,
name: 'address',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 3,
dataTypeId: 2,
dataTypeId: 5,
name: 'artisticText',
createdAt: new Date(),
updatedAt: new Date(),
Expand All @@ -35,15 +35,15 @@ module.exports = {
},
{
id: 5,
dataTypeId: 2,
dataTypeId: 5,
name: 'annotation',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 6,
dataTypeId: 2,
dataTypeId: 5,
name: 'quote',
createdAt: new Date(),
updatedAt: new Date(),
Expand All @@ -59,28 +59,136 @@ module.exports = {
},
{
id: 8,
dataTypeId: 2,
dataTypeId: 5,
name: 'sources',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 9,
dataTypeId: 2,
dataTypeId: 3,
name: 'geoPoint',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 10,
dataTypeId: 4,
name: 'media',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 11,
dataTypeId: 5,
name: 'creator',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 12,
dataTypeId: 5,
name: 'creationPlace',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 13,
dataTypeId: 5,
name: 'copyrightHolder',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 14,
dataTypeId: 5,
name: 'originalText',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 15,
dataTypeId: 5,
name: 'bibliography',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 16,
dataTypeId: 5,
name: 'refutation',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 17,
dataTypeId: 5,
name: 'url',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 18,
dataTypeId: 5,
name: 'participants',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 19,
dataTypeId: 5,
name: 'family',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 20,
dataTypeId: 5,
name: 'profession',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 21,
dataTypeId: 5,
name: 'format',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 22,
dataTypeId: 5,
name: 'storage',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
},
{
id: 23,
dataTypeId: 5,
name: 'socialNetworks',
createdAt: new Date(),
updatedAt: new Date(),
isLink: false
}]);
},

async down (queryInterface, Sequelize) {
/**
* Add commands to revert seed here.
*
* Example:
* await queryInterface.bulkDelete('People', null, {});
*/
// Осторожно: удаляет все содержимое таблицы.
await queryInterface.bulkDelete('Properties', {}, {}, true);
}
};
15 changes: 9 additions & 6 deletions src/seeders/003-user-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ module.exports = {
},
{
id: 3,
name: 'AUTHOR',
key: 'AUTHOR',
createdAt: new Date(),
updatedAt: new Date()
},
{
id: 4,
name: 'USER',
key: 'USER',
createdAt: new Date(),
Expand All @@ -26,11 +33,7 @@ module.exports = {
},

async down (queryInterface, Sequelize) {
/**
* Add commands to revert seed here.
*
* Example:
* await queryInterface.bulkDelete('People', null, {});
*/
// Осторожно: удаляет все содержимое таблицы.
await queryInterface.bulkDelete('UserRoles', {}, {}, true);
}
};