diff --git a/db/create-organisation-add-migration.js b/db/create-organisation-add-migration.js index 8b74853..a9fee93 100644 --- a/db/create-organisation-add-migration.js +++ b/db/create-organisation-add-migration.js @@ -1,11 +1,15 @@ const fs = require("fs"); + +// To make all add organisation migration run after the initial migration +const ADD_ORG_MIGRATION_OFFSET = 10000000000; // More than 317 years! + exports.default = function createOrganisationAddMigration( organisationName, schemaId, authorizedAttestor, color = null ) { - const timestamp = new Date().getTime(); + const timestamp = new Date().getTime() + ADD_ORG_MIGRATION_OFFSET; const fileName = `${timestamp}-Add${organisationName}.js`; const className = `Add${organisationName.replace(/ /g, "")}${timestamp}`; diff --git a/db/migrations/1715254645149-AddTrace.js b/db/migrations/1715254645149-AddTrace.js deleted file mode 100644 index 4049345..0000000 --- a/db/migrations/1715254645149-AddTrace.js +++ /dev/null @@ -1,25 +0,0 @@ - -module.exports = class AddTrace1715254645149 { - name = "AddTrace1715254645149"; - - async up(db) { - // add organisation with name "Trace" and schema id "0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722" - await db.query( - `INSERT INTO "organisation" ("id", "name", "issuer", "color") - VALUES ( - '0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722', - 'Trace', - '0xf23ea0b5f14afcbe532a1df273f7b233ebe41c78', - '#ff0000' - )` - ); - } - - async down(db) { - // remove organisation with name "Trace" and schema id "0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722" - await db.query( - `DELETE FROM "organisation" WHERE "id" = '0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722'` - ); - } -}; - \ No newline at end of file diff --git a/db/migrations/1715344741698-AddGiveth Verification Team.js b/db/migrations/1715344741698-AddGiveth Verification Team.js deleted file mode 100644 index d643965..0000000 --- a/db/migrations/1715344741698-AddGiveth Verification Team.js +++ /dev/null @@ -1,25 +0,0 @@ - -module.exports = class AddGivethVerificationTeam1715344741698 { - name = "AddGivethVerificationTeam1715344741698"; - - async up(db) { - // add organisation with name "Giveth Verification Team" and schema id "0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404" - await db.query( - `INSERT INTO "organisation" ("id", "name", "issuer", "color") - VALUES ( - '0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404', - 'Giveth Verification Team', - '0x826976d7c600d45fb8287ca1d7c76fc8eb732030', - '#7f64cb' - )` - ); - } - - async down(db) { - // remove organisation with name "Giveth Verification Team" and schema id "0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404" - await db.query( - `DELETE FROM "organisation" WHERE "id" = '0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404'` - ); - } -}; - \ No newline at end of file diff --git a/db/migrations/1725254645149-AddTrace.js b/db/migrations/1725254645149-AddTrace.js new file mode 100644 index 0000000..a81539b --- /dev/null +++ b/db/migrations/1725254645149-AddTrace.js @@ -0,0 +1,23 @@ +module.exports = class AddTrace1725254645149 { + name = "AddTrace1725254645149"; + + async up(db) { + // add organisation with name "Trace" and schema id "0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722" + await db.query( + `INSERT INTO "organisation" ("id", "name", "issuer", "color") + VALUES ( + '0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722', + 'Trace', + '0xf23ea0b5f14afcbe532a1df273f7b233ebe41c78', + '#ff0000' + )` + ); + } + + async down(db) { + // remove organisation with name "Trace" and schema id "0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722" + await db.query( + `DELETE FROM "organisation" WHERE "id" = '0x2e22df9a11e06c306ed8f64ca45ceae02efcf8a443371395a78371bc4fb6f722'` + ); + } +}; diff --git a/db/migrations/1725344741698-AddGiveth Verification Team.js b/db/migrations/1725344741698-AddGiveth Verification Team.js new file mode 100644 index 0000000..7e1148b --- /dev/null +++ b/db/migrations/1725344741698-AddGiveth Verification Team.js @@ -0,0 +1,23 @@ +module.exports = class AddGivethVerificationTeam1725344741698 { + name = "AddGivethVerificationTeam1725344741698"; + + async up(db) { + // add organisation with name "Giveth Verification Team" and schema id "0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404" + await db.query( + `INSERT INTO "organisation" ("id", "name", "issuer", "color") + VALUES ( + '0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404', + 'Giveth Verification Team', + '0x826976d7c600d45fb8287ca1d7c76fc8eb732030', + '#7f64cb' + )` + ); + } + + async down(db) { + // remove organisation with name "Giveth Verification Team" and schema id "0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404" + await db.query( + `DELETE FROM "organisation" WHERE "id" = '0xf63f2a7159ee674aa6fce42196a8bb0605eafcf20c19e91a7eafba8d39fa0404'` + ); + } +};