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

Implementation of new data model definitions #289

Merged
merged 11 commits into from
May 14, 2021
Merged
100 changes: 100 additions & 0 deletions server/migrations/20210512004505-BuildNewDatabaseSchema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
'use strict';

const fs = require('fs');

module.exports = {
up: queryInterface => {
return queryInterface.sequelize.transaction(transaction => {
return Promise.all([
queryInterface.dropTable('at_name', {
cascade: true,
transaction
}),
queryInterface.dropTable('browser', {
cascade: true,
transaction
}),
queryInterface.dropTable('at_version', {
cascade: true,
transaction
}),
queryInterface.dropTable('browser_version', {
cascade: true,
transaction
}),
queryInterface.dropTable('test_version', {
cascade: true,
transaction
}),
queryInterface.dropTable('run_status', {
cascade: true,
transaction
}),
queryInterface.dropTable('browser_version_to_at_version', {
cascade: true,
transaction
}),
queryInterface.dropTable('apg_example', {
cascade: true,
transaction
}),
queryInterface.dropTable('at', { cascade: true, transaction }),
queryInterface.dropTable('role', {
cascade: true,
transaction
}),
queryInterface.dropTable('users', {
cascade: true,
transaction
}),
queryInterface.dropTable('test_status', {
cascade: true,
transaction
}),
queryInterface.dropTable('run', { cascade: true, transaction }),
queryInterface.dropTable('test', {
cascade: true,
transaction
}),
queryInterface.dropTable('user_to_role', {
cascade: true,
transaction
}),
queryInterface.dropTable('user_to_at', {
cascade: true,
transaction
}),
queryInterface.dropTable('tester_to_run', {
cascade: true,
transaction
}),
queryInterface.dropTable('test_result', {
cascade: true,
transaction
}),
queryInterface.dropTable('test_issue', {
cascade: true,
transaction
}),
queryInterface.dropTable('test_to_at', {
cascade: true,
transaction
}),
Promise.resolve()
.then(() =>
fs.readFileSync(
__dirname + '/pg_dump_2021_05_new_schema.sql',
'utf-8'
)
)
.then(initialSchema =>
queryInterface.sequelize.query(initialSchema)
)
]);
});
},

down: queryInterface => {
return queryInterface.dropAllTables();
}
};
Loading