Separate Prettier and ESLint according to best practices (#9565)

* Separate Prettier and ESLint according to best practices

- Create standalone .prettierrc configuration file
- Remove eslint-plugin-prettier integration from ESLint config
- Replace with eslint-config-prettier to disable conflicting rules
- Remove eslint-plugin-prettier dependency
- Add dedicated format and format:check scripts
- Update lint-staged to run Prettier and ESLint separately
- Format entire codebase with new Prettier configuration

This follows the recommended approach from Prettier documentation:
https://prettier.io/docs/integrating-with-linters#notes

* Remove test comment

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
This commit is contained in:
codegen-sh[bot]
2025-07-08 18:01:48 -04:00
committed by GitHub
parent 68f87f7254
commit 97f8d0f265
123 changed files with 1291 additions and 1081 deletions
+3 -12
View File
@@ -21,10 +21,7 @@
[
"transform-inline-environment-variables",
{
"include": [
"SOURCE_COMMIT",
"SOURCE_VERSION"
]
"include": ["SOURCE_COMMIT", "SOURCE_VERSION"]
}
],
"tsconfig-paths-module-resolver"
@@ -39,16 +36,10 @@
}
]
],
"ignore": [
"**/__mocks__",
"**/*.test.ts"
]
"ignore": ["**/__mocks__", "**/*.test.ts"]
},
"development": {
"ignore": [
"**/__mocks__",
"**/*.test.ts"
]
"ignore": ["**/__mocks__", "**/*.test.ts"]
},
"test": {
"presets": [
+1 -8
View File
@@ -15,7 +15,7 @@
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended"
"prettier"
],
"plugins": [
"es",
@@ -162,13 +162,6 @@
}
]
}
],
"prettier/prettier": [
"error",
{
"printWidth": 80,
"trailingComma": "es5"
}
]
},
"settings": {
+1 -1
View File
@@ -2,7 +2,7 @@ name: Auto Close Unsigned PRs
on:
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC
- cron: "0 0 * * *" # Run daily at midnight UTC
jobs:
close-unsigned-prs:
+6 -6
View File
@@ -30,7 +30,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
@@ -43,7 +43,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn lint
@@ -55,7 +55,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn tsc
@@ -93,7 +93,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn test:${{ matrix.test-group }}
@@ -135,7 +135,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn sequelize db:migrate
- name: Run server tests
@@ -152,7 +152,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
cache: "yarn"
- run: yarn install --frozen-lockfile
- name: Set environment to production
run: echo "NODE_ENV=production" >> $GITHUB_ENV
+2 -2
View File
@@ -18,7 +18,7 @@ on:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '28 15 * * 2'
- cron: "28 15 * * 2"
jobs:
analyze:
@@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
+2 -2
View File
@@ -20,11 +20,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn lint --fix
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Applied automatic fixes'
commit_message: "Applied automatic fixes"
+4
View File
@@ -0,0 +1,4 @@
{
"printWidth": 80,
"trailingComma": "es5"
}
+1 -1
View File
@@ -1 +1 @@
export default '';
export default "";
+1 -1
View File
@@ -2,7 +2,7 @@ const storage = {};
export default {
setItem: function (key, value) {
storage[key] = value || '';
storage[key] = value || "";
},
getItem: function (key) {
return key in storage ? storage[key] : null;
+1 -7
View File
@@ -3,13 +3,7 @@
"description": "Open source wiki and knowledge base for growing teams",
"website": "https://www.getoutline.com/",
"repository": "https://github.com/outline/outline",
"keywords": [
"wiki",
"team",
"node",
"markdown",
"slack"
],
"keywords": ["wiki", "team", "node", "markdown", "slack"],
"success_url": "/",
"formation": {
"web": {
+4 -4
View File
@@ -1,12 +1,12 @@
/* eslint-disable */
import stores from "~/stores";
describe('Collection model', () => {
test('should initialize with data', () => {
describe("Collection model", () => {
test("should initialize with data", () => {
const collection = stores.collections.add({
id: "123",
name: 'Engineering'
name: "Engineering",
});
expect(collection.name).toBe('Engineering');
expect(collection.name).toBe("Engineering");
});
});
+5 -3
View File
@@ -1,11 +1,13 @@
/* eslint-disable */
export const client = {
post: jest.fn(() => Promise.resolve({
post: jest.fn(() =>
Promise.resolve({
data: {
user: {},
team: {},
groups: [],
groupUsers: [],
}
}))
},
})
),
};
+1 -1
View File
@@ -1,4 +1,4 @@
commit_message: 'fix: New %language% translations from Crowdin [ci skip]'
commit_message: "fix: New %language% translations from Crowdin [ci skip]"
append_commit_message:
files:
- source: /shared/i18n/locales/en_US/translation.json
+10 -10
View File
@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
+2 -1
View File
@@ -1,7 +1,8 @@
export default {
// Efficiently run prettier and translation updates on changes to JS and
// Run prettier first for formatting, then eslint for linting, and translation updates on changes to JS and
// TypeScript files
"**/*.[tj]s?(x)": [
(f) => `prettier --write ${f.join(" ")}`,
(f) => (f.length > 20 ? `yarn lint --fix` : `eslint ${f.join(" ")} --fix`),
() => `yarn build:i18n`,
() => "git add shared/i18n/locales/en_US/translation.json",
+2 -1
View File
@@ -15,6 +15,8 @@
"dev:watch": "NODE_ENV=development yarn concurrently -n backend,frontend \"yarn dev:backend\" \"yarn vite:dev\"",
"lint": "eslint app server shared plugins",
"lint:changed": "git diff --name-only --diff-filter=ACMRTUXB | grep -E '\\.(js|jsx|ts|tsx)$' | xargs -r yarn eslint --fix",
"format": "prettier --write .",
"format:check": "prettier --check .",
"prepare": "husky install",
"postinstall": "yarn patch-package",
"install-local-ssl": "node ./server/scripts/install-local-ssl.js",
@@ -356,7 +358,6 @@
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.5.1",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^8.0.3",
+1 -4
View File
@@ -3,8 +3,5 @@
"name": "Umami",
"priority": 50,
"description": "Adds support for reporting analytics to a Umami server.",
"deployments": [
"community",
"enterprise"
]
"deployments": ["community", "enterprise"]
}
@@ -1,8 +1,7 @@
module.exports = {
up: async (queryInterface, Sequelize) => {
const [teams, metaData] = await queryInterface.sequelize.query(
`SELECT * FROM teams`
);
const [teams, metaData] =
await queryInterface.sequelize.query(`SELECT * FROM teams`);
const teamIds = teams.map((team) => team.id);
await Promise.all(
@@ -2,12 +2,15 @@
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeIndex("documents", "documents_id_atlas_id_deleted_at");
await queryInterface.removeIndex(
"documents",
"documents_id_atlas_id_deleted_at"
);
await queryInterface.removeIndex("apiKeys", "api_keys_secret_deleted_at");
await queryInterface.removeIndex("groups", "groups_deleted_at");
},
down: async (queryInterface, Sequelize) => {
// noop
}
},
};
@@ -57,10 +57,13 @@ module.exports = {
await queryInterface.addIndex("pins", ["collectionId"]);
const createdAt = new Date();
const [documents] = await queryInterface.sequelize.query(`SELECT "id","collectionId","teamId","pinnedById" FROM documents WHERE "pinnedById" IS NOT NULL`);
const [documents] = await queryInterface.sequelize.query(
`SELECT "id","collectionId","teamId","pinnedById" FROM documents WHERE "pinnedById" IS NOT NULL`
);
for (const document of documents) {
await queryInterface.sequelize.query(`
await queryInterface.sequelize.query(
`
INSERT INTO pins (
"id",
"documentId",
@@ -79,7 +82,8 @@ module.exports = {
:createdAt,
:updatedAt
)
`, {
`,
{
replacements: {
id: v4(),
documentId: document.id,
@@ -89,7 +93,8 @@ module.exports = {
updatedAt: createdAt,
createdAt,
},
});
}
);
}
},
down: async (queryInterface, Sequelize) => {
@@ -26,16 +26,28 @@ module.exports = {
// somehow these indexes were being used sometimes, but i'll never know how.
// Note: These are not recreated in the down method
await queryInterface.removeIndex("documents", "documents_id_atlas_id_published_at");
await queryInterface.removeIndex("documents", "documents_id_team_id_deleted_at");
await queryInterface.removeIndex(
"documents",
"documents_id_atlas_id_published_at"
);
await queryInterface.removeIndex(
"documents",
"documents_id_team_id_deleted_at"
);
await queryInterface.removeIndex("documents", "documents_id_deleted_at");
await queryInterface.removeIndex("collections", "atlases_id_deleted_at");
await queryInterface.removeIndex("collections", "atlases_id_team_id_deleted_at");
await queryInterface.removeIndex(
"collections",
"atlases_id_team_id_deleted_at"
);
},
down: async (queryInterface) => {
await queryInterface.removeIndex("views", "views_last_editing_at");
await queryInterface.removeIndex("pins", "pins_team_id");
await queryInterface.removeIndex("collections", "collections_team_id_deleted_at");
await queryInterface.removeIndex(
"collections",
"collections_team_id_deleted_at"
);
await queryInterface.removeIndex("stars", "stars_user_id_document_id");
await queryInterface.removeIndex("documents", "documents_collection_id");
await queryInterface.removeIndex("documents", "documents_published_at");
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -11,5 +11,5 @@ module.exports = {
down: async (queryInterface, Sequelize) => {
await queryInterface.removeColumn("teams", "defaultCollectionId");
}
},
};
@@ -6,58 +6,58 @@ module.exports = {
id: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true
primaryKey: true,
},
data: {
type: Sequelize.JSONB,
allowNull: false
allowNull: false,
},
documentId: {
type: Sequelize.UUID,
allowNull: false,
onDelete: "cascade",
references: {
model: "documents"
}
model: "documents",
},
},
parentCommentId: {
type: Sequelize.UUID,
allowNull: true,
onDelete: "cascade",
references: {
model: "comments"
}
model: "comments",
},
},
createdById: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users"
}
model: "users",
},
},
resolvedAt: {
type: Sequelize.DATE,
allowNull: true
allowNull: true,
},
resolvedById: {
type: Sequelize.UUID,
allowNull: true,
references: {
model: "users"
}
model: "users",
},
},
createdAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
deletedAt: {
type: Sequelize.DATE,
allowNull: true
}
allowNull: true,
},
});
await queryInterface.addIndex("comments", ["documentId"]);
@@ -66,5 +66,5 @@ module.exports = {
down: async (queryInterface, Sequelize) => {
queryInterface.dropTable("comments");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -16,6 +16,9 @@ module.exports = {
down: async (queryInterface, Sequelize) => {
await queryInterface.removeIndex("views", "views_updated_at");
await queryInterface.removeIndex("views", "views_user_id");
await queryInterface.removeIndex("collection_users", "collection_users_user_id");
}
await queryInterface.removeIndex(
"collection_users",
"collection_users_user_id"
);
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -9,5 +9,5 @@ module.exports = {
down: async (queryInterface, Sequelize) => {
await queryInterface.removeIndex("events", "events_created_at");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -11,5 +11,5 @@ module.exports = {
down: async (queryInterface, Sequelize) => {
await queryInterface.removeColumn("teams", "memberCollectionCreate");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -8,7 +8,7 @@ module.exports = {
allowNull: true,
references: {
model: "shares",
key: "id"
key: "id",
},
});
},
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -23,7 +23,7 @@ module.exports = {
});
await queryInterface.changeColumn("stars", "documentId", {
type: Sequelize.UUID,
allowNull: true
allowNull: true,
});
await queryInterface.changeColumn("stars", "documentId", {
type: Sequelize.UUID,
@@ -46,9 +46,9 @@ module.exports = {
await queryInterface.removeColumn("stars", "collectionId");
await queryInterface.changeColumn("stars", "documentId", {
type: Sequelize.UUID,
allowNull: false
allowNull: false,
});
await queryInterface.removeConstraint("stars", "stars_documentId_fkey")
await queryInterface.removeConstraint("stars", "stars_userId_fkey")
}
await queryInterface.removeConstraint("stars", "stars_documentId_fkey");
await queryInterface.removeConstraint("stars", "stars_userId_fkey");
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -10,5 +10,5 @@ module.exports = {
down: async (queryInterface) => {
return queryInterface.removeColumn("users", "flags");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -13,5 +13,5 @@ module.exports = {
down: async (queryInterface) => {
return queryInterface.removeColumn("users", "invitedById");
}
},
};
@@ -1,11 +1,11 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn("teams", "inviteRequired", {
type: Sequelize.BOOLEAN,
defaultValue: false,
allowNull: false
allowNull: false,
});
},
down: async (queryInterface) => {
@@ -5,7 +5,9 @@ const { v4 } = require("uuid");
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable("team_domains", {
await queryInterface.createTable(
"team_domains",
{
id: {
type: Sequelize.UUID,
allowNull: false,
@@ -38,32 +40,45 @@ module.exports = {
type: Sequelize.DATE,
allowNull: false,
},
}, {
transaction
});
},
{
transaction,
}
);
await queryInterface.addIndex("team_domains", ["teamId", "name"], {
transaction,
unique: true,
});
const currentAllowedDomainsEnv = process.env.ALLOWED_DOMAINS || process.env.GOOGLE_ALLOWED_DOMAINS;
const currentAllowedDomains = currentAllowedDomainsEnv ? currentAllowedDomainsEnv.split(",") : [];
const currentAllowedDomainsEnv =
process.env.ALLOWED_DOMAINS || process.env.GOOGLE_ALLOWED_DOMAINS;
const currentAllowedDomains = currentAllowedDomainsEnv
? currentAllowedDomainsEnv.split(",")
: [];
if (currentAllowedDomains.length > 0) {
const [adminUserIDs] = await queryInterface.sequelize.query('select id from users where "isAdmin" = true limit 1', { transaction })
const adminUserID = adminUserIDs[0]?.id
const [adminUserIDs] = await queryInterface.sequelize.query(
'select id from users where "isAdmin" = true limit 1',
{ transaction }
);
const adminUserID = adminUserIDs[0]?.id;
if (adminUserID) {
const [teams] = await queryInterface.sequelize.query('select id from teams', { transaction })
const [teams] = await queryInterface.sequelize.query(
"select id from teams",
{ transaction }
);
const now = new Date();
for (const team of teams) {
for (const domain of currentAllowedDomains) {
await queryInterface.sequelize.query(`
await queryInterface.sequelize.query(
`
INSERT INTO team_domains ("id", "teamId", "createdById", "name", "createdAt", "updatedAt")
VALUES (:id, :teamId, :createdById, :name, :createdAt, :updatedAt)
`, {
`,
{
replacements: {
id: v4(),
teamId: team.id,
@@ -1,11 +1,11 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn("file_operations", "format", {
type: Sequelize.STRING,
defaultValue: "outline-markdown",
allowNull: false
allowNull: false,
});
},
down: async (queryInterface) => {
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface) => {
@@ -6,18 +6,21 @@ module.exports = {
while (again) {
console.log("Backfilling collection sort…");
const [, metadata] = await queryInterface.sequelize.query(`
const [, metadata] = await queryInterface.sequelize.query(
`
WITH rows AS (
SELECT id FROM collections WHERE "sort" IS NULL ORDER BY id LIMIT 1000
)
UPDATE collections
SET "sort" = :sort::jsonb
WHERE EXISTS (SELECT * FROM rows WHERE collections.id = rows.id)
`, {
`,
{
replacements: {
sort: JSON.stringify({ field: "title", direction: "asc" }),
},
}
});
);
again = metadata.rowCount;
}
@@ -25,5 +28,5 @@ WHERE EXISTS (SELECT * FROM rows WHERE collections.id = rows.id)
down: async () => {
// cannot be undone
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -6,13 +6,17 @@ module.exports = {
await queryInterface.addColumn("user_authentications", "expiresAt", {
type: Sequelize.DATE,
allowNull: true,
transaction
transaction,
});
await queryInterface.addColumn("user_authentications", "lastValidatedAt", {
await queryInterface.addColumn(
"user_authentications",
"lastValidatedAt",
{
type: Sequelize.DATE,
allowNull: true,
transaction
});
transaction,
}
);
});
},
down: async (queryInterface) => {
@@ -21,11 +25,11 @@ module.exports = {
"user_authentications",
"lastValidatedAt",
{
transaction
transaction,
}
);
await queryInterface.removeColumn("user_authentications", "expiresAt", {
transaction
transaction,
});
});
},
@@ -1,10 +1,10 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn("webhook_subscriptions", "deletedAt", {
type: Sequelize.DATE,
allowNull: true
allowNull: true,
});
},
down: async (queryInterface) => {
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface) {
@@ -16,7 +16,9 @@ module.exports = {
);
if (teams[0].count > 0 && authenticationProviders[0].count === 0) {
throw Error("Refusing to destroy deprecated columns without authentication providers");
throw Error(
"Refusing to destroy deprecated columns without authentication providers"
);
}
}
@@ -34,28 +36,28 @@ module.exports = {
type: Sequelize.STRING(4096),
allowNull: false,
defaultValue: "",
transaction
transaction,
});
await queryInterface.addColumn("users", "service", {
type: Sequelize.STRING,
allowNull: true,
transaction
transaction,
});
await queryInterface.addColumn("users", "serviceId", {
type: Sequelize.STRING,
allowNull: true,
transaction
transaction,
});
await queryInterface.addColumn("teams", "slackId", {
type: Sequelize.STRING,
allowNull: true,
transaction
transaction,
});
await queryInterface.addColumn("teams", "googleId", {
type: Sequelize.STRING,
allowNull: true,
transaction
transaction,
});
});
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -8,7 +8,7 @@ module.exports = {
await queryInterface.addColumn("events", "updatedAt", {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.fn('NOW'),
defaultValue: Sequelize.fn("NOW"),
});
}
},
};
@@ -1,21 +1,27 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.removeConstraint("authentication_providers", "authentication_providers_providerId_key");
await queryInterface.removeConstraint(
"authentication_providers",
"authentication_providers_providerId_key"
);
await queryInterface.addConstraint("authentication_providers", {
type: 'unique',
type: "unique",
fields: ["providerId", "teamId"],
name: "authentication_providers_providerId_teamId_uk"
name: "authentication_providers_providerId_teamId_uk",
});
},
async down(queryInterface, Sequelize) {
await queryInterface.removeConstraint("authentication_providers", "authentication_providers_providerId_teamId_uk");
await queryInterface.removeConstraint(
"authentication_providers",
"authentication_providers_providerId_teamId_uk"
);
await queryInterface.addConstraint("authentication_providers", {
type: 'unique',
type: "unique",
fields: ["providerId"],
name: "authentication_providers_providerId_key"
name: "authentication_providers_providerId_key",
});
}
},
};
@@ -1,21 +1,27 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.removeConstraint("user_authentications", "user_authentications_providerId_key");
await queryInterface.removeConstraint(
"user_authentications",
"user_authentications_providerId_key"
);
await queryInterface.addConstraint("user_authentications", {
type: 'unique',
type: "unique",
fields: ["providerId", "userId"],
name: "user_authentications_providerId_userId_uk"
name: "user_authentications_providerId_userId_uk",
});
},
async down(queryInterface, Sequelize) {
await queryInterface.removeConstraint("user_authentications", "user_authentications_providerId_userId_uk");
await queryInterface.removeConstraint(
"user_authentications",
"user_authentications_providerId_userId_uk"
);
await queryInterface.addConstraint("user_authentications", {
type: 'unique',
type: "unique",
fields: ["providerId"],
name: "user_authentications_providerId_key"
name: "user_authentications_providerId_key",
});
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface) {
@@ -7,5 +7,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeIndex("users", ["email"]);
}
},
};
@@ -1,10 +1,10 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn("shares", "views", {
type: Sequelize.INTEGER,
defaultValue: 0
defaultValue: 0,
});
},
down: async (queryInterface) => {
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -10,5 +10,5 @@ module.exports = {
async down(queryInterface, Sequelize) {
return queryInterface.removeColumn("users", "preferences");
}
},
};
@@ -1,12 +1,28 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeConstraint("notifications", "notifications_userId_fkey", { transaction })
await queryInterface.removeConstraint("notifications", "notifications_actorId_fkey", { transaction })
await queryInterface.removeConstraint("notifications", "notifications_teamId_fkey", { transaction })
await queryInterface.removeConstraint("notifications", "notifications_documentId_fkey", { transaction })
await queryInterface.removeConstraint(
"notifications",
"notifications_userId_fkey",
{ transaction }
);
await queryInterface.removeConstraint(
"notifications",
"notifications_actorId_fkey",
{ transaction }
);
await queryInterface.removeConstraint(
"notifications",
"notifications_teamId_fkey",
{ transaction }
);
await queryInterface.removeConstraint(
"notifications",
"notifications_documentId_fkey",
{ transaction }
);
});
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn("notifications", "userId", {
@@ -49,10 +65,26 @@ module.exports = {
down: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeConstraint("notifications", "notifications_userId_fkey", { transaction })
await queryInterface.removeConstraint("notifications", "notifications_actorId_fkey", { transaction })
await queryInterface.removeConstraint("notifications", "notifications_teamId_fkey", { transaction })
await queryInterface.removeConstraint("notifications", "notifications_documentId_fkey", { transaction })
await queryInterface.removeConstraint(
"notifications",
"notifications_userId_fkey",
{ transaction }
);
await queryInterface.removeConstraint(
"notifications",
"notifications_actorId_fkey",
{ transaction }
);
await queryInterface.removeConstraint(
"notifications",
"notifications_teamId_fkey",
{ transaction }
);
await queryInterface.removeConstraint(
"notifications",
"notifications_documentId_fkey",
{ transaction }
);
});
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.changeColumn("notifications", "userId", {
@@ -87,5 +119,5 @@ module.exports = {
transaction,
});
});
}
},
};
@@ -10,5 +10,5 @@ module.exports = {
async down(queryInterface, Sequelize) {
return queryInterface.removeColumn("webhook_subscriptions", "secret");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -29,5 +29,5 @@ module.exports = {
transaction,
});
});
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -15,5 +15,5 @@ module.exports = {
await queryInterface.changeColumn("users", "teamId", {
type: Sequelize.UUID,
});
}
},
};
@@ -20,29 +20,28 @@ module.exports = {
transaction,
});
await queryInterface.addIndex("documents", ["importId"], {
transaction
transaction,
});
await queryInterface.addIndex("collections", ["importId"], {
transaction
transaction,
});
});
},
async down(queryInterface) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeIndex("collections", ["importId"], {
transaction
transaction,
});
await queryInterface.removeIndex("documents", ["importId"], {
transaction
transaction,
});
await queryInterface.removeColumn("collections", "importId", {
transaction
transaction,
});
await queryInterface.removeColumn("documents", "importId", {
transaction
transaction,
});
});
}
},
};
@@ -9,14 +9,18 @@ module.exports = {
transaction,
});
await queryInterface.addIndex("attachments", ["expiresAt"], {
transaction
transaction,
});
});
},
down: async (queryInterface) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn("attachments", "expiresAt", { transaction });
await queryInterface.removeIndex("attachments", ["expiresAt"], { transaction });
await queryInterface.removeColumn("attachments", "expiresAt", {
transaction,
});
await queryInterface.removeIndex("attachments", ["expiresAt"], {
transaction,
});
});
},
};
@@ -4,15 +4,11 @@ module.exports = {
async up(queryInterface, Sequelize) {
try {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"shares",
"urlId",
{
await queryInterface.addColumn("shares", "urlId", {
type: Sequelize.STRING,
allowNull: true,
transaction,
},
);
});
await queryInterface.addConstraint("shares", {
fields: ["urlId", "teamId"],
@@ -1,8 +1,11 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("webhook_subscriptions", "webhook_subscriptions_teamId_fkey")
await queryInterface.removeConstraint(
"webhook_subscriptions",
"webhook_subscriptions_teamId_fkey"
);
await queryInterface.changeColumn("webhook_subscriptions", "teamId", {
type: Sequelize.UUID,
allowNull: false,
@@ -14,7 +17,10 @@ module.exports = {
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("webhook_subscriptions", "webhook_subscriptions_teamId_fkey")
await queryInterface.removeConstraint(
"webhook_subscriptions",
"webhook_subscriptions_teamId_fkey"
);
await queryInterface.changeColumn("webhook_subscriptions", "teamId", {
type: Sequelize.UUID,
allowNull: false,
@@ -22,5 +28,5 @@ module.exports = {
model: "teams",
},
});
}
},
};
@@ -1,8 +1,11 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("integrations", "integrations_collectionId_fkey")
await queryInterface.removeConstraint(
"integrations",
"integrations_collectionId_fkey"
);
await queryInterface.changeColumn("integrations", "collectionId", {
type: Sequelize.UUID,
allowNull: true,
@@ -11,7 +14,10 @@ module.exports = {
model: "collections",
},
});
await queryInterface.removeConstraint("integrations", "integrations_teamId_fkey")
await queryInterface.removeConstraint(
"integrations",
"integrations_teamId_fkey"
);
await queryInterface.changeColumn("integrations", "teamId", {
type: Sequelize.UUID,
allowNull: false,
@@ -23,7 +29,10 @@ module.exports = {
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("integrations", "integrations_collectionId_fkey")
await queryInterface.removeConstraint(
"integrations",
"integrations_collectionId_fkey"
);
await queryInterface.changeColumn("integrations", "collectionId", {
type: Sequelize.UUID,
allowNull: true,
@@ -31,7 +40,10 @@ module.exports = {
model: "collections",
},
});
await queryInterface.removeConstraint("integrations", "integrations_teamId_fkey")
await queryInterface.removeConstraint(
"integrations",
"integrations_teamId_fkey"
);
await queryInterface.changeColumn("integrations", "teamId", {
type: Sequelize.UUID,
allowNull: false,
@@ -39,5 +51,5 @@ module.exports = {
model: "teams",
},
});
}
},
};
@@ -1,8 +1,8 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("stars", "stars_collectionId_fkey")
await queryInterface.removeConstraint("stars", "stars_collectionId_fkey");
await queryInterface.changeColumn("stars", "collectionId", {
type: Sequelize.UUID,
allowNull: true,
@@ -14,7 +14,7 @@ module.exports = {
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("stars", "stars_collectionId_fkey")
await queryInterface.removeConstraint("stars", "stars_collectionId_fkey");
await queryInterface.changeColumn("stars", "collectionId", {
type: Sequelize.UUID,
allowNull: true,
@@ -22,5 +22,5 @@ module.exports = {
model: "collections",
},
});
}
},
};
@@ -1,11 +1,19 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addIndex("integrations", ["teamId", "type", "service"]);
await queryInterface.addIndex("integrations", [
"teamId",
"type",
"service",
]);
},
async down(queryInterface, Sequelize) {
await queryInterface.removeIndex("integrations", ["teamId", "type", "service"]);
}
await queryInterface.removeIndex("integrations", [
"teamId",
"type",
"service",
]);
},
};
@@ -20,7 +20,7 @@ module.exports = {
"SELECT id FROM users",
{
type: queryInterface.sequelize.QueryTypes.SELECT,
transaction
transaction,
}
);
@@ -30,13 +30,12 @@ module.exports = {
{
type: queryInterface.sequelize.QueryTypes.SELECT,
replacements: { userId: user.id },
transaction
transaction,
}
);
const eventTypes = settings.map((setting) => setting.event);
if (eventTypes.length > 0) {
const notificationSettings = {};
@@ -52,7 +51,7 @@ module.exports = {
userId: user.id,
notificationSettings: JSON.stringify(notificationSettings),
},
transaction
transaction,
}
);
}
@@ -62,5 +61,5 @@ module.exports = {
async down(queryInterface) {
return queryInterface.removeColumn("users", "notificationSettings");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
@@ -31,8 +31,8 @@ module.exports = {
},
down: async (queryInterface) => {
await queryInterface.removeColumn("notifications", "collectionId")
await queryInterface.removeColumn("notifications", "revisionId")
await queryInterface.removeColumn("notifications", "commentId")
}
await queryInterface.removeColumn("notifications", "collectionId");
await queryInterface.removeColumn("notifications", "revisionId");
await queryInterface.removeColumn("notifications", "commentId");
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface) {
@@ -52,5 +52,5 @@ module.exports = {
type: queryInterface.sequelize.QueryTypes.SELECT,
}
);
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -6,6 +6,6 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
throw new Error("Cannot undo this migration.")
}
throw new Error("Cannot undo this migration.");
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -11,5 +11,5 @@ module.exports = {
async down(queryInterface, Sequelize) {
await queryInterface.removeColumn("file_operations", "includeAttachments");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -11,5 +11,5 @@ module.exports = {
async down(queryInterface, Sequelize) {
await queryInterface.removeColumn("documents", "insightsEnabled");
}
},
};
@@ -1,57 +1,93 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeConstraint("file_operations", "file_operations_collectionId_fkey", { transaction });
await queryInterface.changeColumn("file_operations", "collectionId", {
await queryInterface.removeConstraint(
"file_operations",
"file_operations_collectionId_fkey",
{ transaction }
);
await queryInterface.changeColumn(
"file_operations",
"collectionId",
{
type: Sequelize.UUID,
allowNull: true,
onDelete: "cascade",
references: {
model: "collections",
},
}, {
},
{
transaction,
});
}
);
await queryInterface.removeConstraint("file_operations", "file_operations_teamId_fkey", { transaction });
await queryInterface.changeColumn("file_operations", "teamId", {
await queryInterface.removeConstraint(
"file_operations",
"file_operations_teamId_fkey",
{ transaction }
);
await queryInterface.changeColumn(
"file_operations",
"teamId",
{
type: Sequelize.UUID,
allowNull: false,
onDelete: "cascade",
references: {
model: "teams",
},
}, {
transaction
});
},
{
transaction,
}
);
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeConstraint("file_operations", "file_operations_collectionId_fkey", { transaction });
await queryInterface.changeColumn("file_operations", "collectionId", {
await queryInterface.removeConstraint(
"file_operations",
"file_operations_collectionId_fkey",
{ transaction }
);
await queryInterface.changeColumn(
"file_operations",
"collectionId",
{
type: Sequelize.UUID,
allowNull: true,
references: {
model: "collections",
},
}, {
},
{
transaction,
});
}
);
await queryInterface.removeConstraint("file_operations", "file_operations_teamId_fkey", { transaction });
await queryInterface.changeColumn("file_operations", "teamId", {
await queryInterface.removeConstraint(
"file_operations",
"file_operations_teamId_fkey",
{ transaction }
);
await queryInterface.changeColumn(
"file_operations",
"teamId",
{
type: Sequelize.UUID,
allowNull: false,
references: {
model: "teams",
},
}, {
},
{
transaction,
});
});
}
);
});
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -10,5 +10,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeColumn("revisions", "emoji");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -10,5 +10,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeColumn("file_operations", "deletedAt");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -11,5 +11,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeColumn("shares", "domain");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -10,5 +10,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeColumn("documents", "sourceMetadata");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -15,5 +15,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeColumn("revisions", "content");
await queryInterface.removeColumn("documents", "content");
}
},
};
@@ -1,8 +1,11 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("webhook_subscriptions", "webhook_subscriptions_createdById_fkey")
await queryInterface.removeConstraint(
"webhook_subscriptions",
"webhook_subscriptions_createdById_fkey"
);
await queryInterface.changeColumn("webhook_subscriptions", "createdById", {
type: Sequelize.UUID,
onDelete: "cascade",
@@ -13,12 +16,15 @@ module.exports = {
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("webhook_subscriptions", "webhook_subscriptions_createdById_fkey")
await queryInterface.removeConstraint(
"webhook_subscriptions",
"webhook_subscriptions_createdById_fkey"
);
await queryInterface.changeColumn("webhook_subscriptions", "createdById", {
type: Sequelize.UUID,
references: {
model: "users",
},
});
}
},
};
@@ -11,7 +11,10 @@ module.exports = {
allowNull: true,
});
await queryInterface.removeConstraint("user_permissions", "user_permissions_documentId_fkey")
await queryInterface.removeConstraint(
"user_permissions",
"user_permissions_documentId_fkey"
);
await queryInterface.changeColumn("user_permissions", "documentId", {
type: Sequelize.UUID,
onDelete: "cascade",
@@ -21,7 +24,10 @@ module.exports = {
});
},
async down(queryInterface) {
await queryInterface.removeConstraint("user_permissions", "user_permissions_documentId_fkey")
await queryInterface.removeConstraint(
"user_permissions",
"user_permissions_documentId_fkey"
);
await queryInterface.changeColumn("user_permissions", "documentId", {
type: Sequelize.UUID,
references: {
@@ -1,8 +1,11 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("comments", "comments_createdById_fkey")
await queryInterface.removeConstraint(
"comments",
"comments_createdById_fkey"
);
await queryInterface.changeColumn("comments", "createdById", {
type: Sequelize.UUID,
onDelete: "cascade",
@@ -11,7 +14,10 @@ module.exports = {
},
});
await queryInterface.removeConstraint("comments", "comments_resolvedById_fkey")
await queryInterface.removeConstraint(
"comments",
"comments_resolvedById_fkey"
);
await queryInterface.changeColumn("comments", "resolvedById", {
type: Sequelize.UUID,
onDelete: "set null",
@@ -22,7 +28,10 @@ module.exports = {
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("comments", "comments_resolvedById_fkey")
await queryInterface.removeConstraint(
"comments",
"comments_resolvedById_fkey"
);
await queryInterface.changeColumn("comments", "resolvedById", {
type: Sequelize.UUID,
references: {
@@ -30,12 +39,15 @@ module.exports = {
},
});
await queryInterface.removeConstraint("comments", "comments_createdById_fkey")
await queryInterface.removeConstraint(
"comments",
"comments_createdById_fkey"
);
await queryInterface.changeColumn("comments", "createdById", {
type: Sequelize.UUID,
references: {
model: "users",
},
});
}
},
};
@@ -6,7 +6,6 @@ module.exports = {
type: Sequelize.JSONB,
allowNull: true,
});
},
async down(queryInterface) {
await queryInterface.removeColumn("events", "changes");
@@ -1,8 +1,11 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("search_queries", "search_queries_shareId_fkey")
await queryInterface.removeConstraint(
"search_queries",
"search_queries_shareId_fkey"
);
await queryInterface.changeColumn("search_queries", "shareId", {
type: Sequelize.UUID,
allowNull: true,
@@ -14,7 +17,10 @@ module.exports = {
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeConstraint("search_queries", "search_queries_shareId_fkey")
await queryInterface.removeConstraint(
"search_queries",
"search_queries_shareId_fkey"
);
await queryInterface.changeColumn("search_queries", "shareId", {
type: Sequelize.UUID,
allowNull: true,
@@ -22,5 +28,5 @@ module.exports = {
model: "shares",
},
});
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -10,5 +10,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeColumn("authentications", "refreshToken");
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
@@ -42,5 +42,5 @@ module.exports = {
transaction,
});
});
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
@@ -37,5 +37,5 @@ module.exports = {
async down(queryInterface) {
await queryInterface.removeColumn("users", "role");
}
},
};
@@ -1,15 +1,15 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.query(
'ALTER TABLE users ALTER COLUMN role SET NOT NULL;'
"ALTER TABLE users ALTER COLUMN role SET NOT NULL;"
);
},
async down(queryInterface) {
await queryInterface.sequelize.query(
'ALTER TABLE users ALTER COLUMN role DROP NOT NULL;'
"ALTER TABLE users ALTER COLUMN role DROP NOT NULL;"
);
}
},
};
@@ -1,4 +1,4 @@
'use strict';
"use strict";
module.exports = {
async up(queryInterface) {
@@ -38,5 +38,5 @@ module.exports = {
}
);
});
}
},
};
@@ -3,7 +3,7 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"documents",
"icon",
@@ -69,7 +69,7 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn("documents", "icon", { transaction });
await queryInterface.removeColumn("revisions", "icon", { transaction });
await queryInterface.removeColumn("documents", "color", { transaction });
@@ -3,14 +3,14 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn("documents", "emoji", { transaction });
await queryInterface.removeColumn("revisions", "emoji", { transaction });
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"documents",
"emoji",
@@ -11,7 +11,10 @@ module.exports = {
allowNull: true,
});
await queryInterface.removeConstraint("group_permissions", "group_permissions_documentId_fkey")
await queryInterface.removeConstraint(
"group_permissions",
"group_permissions_documentId_fkey"
);
await queryInterface.changeColumn("group_permissions", "documentId", {
type: Sequelize.UUID,
onDelete: "cascade",
@@ -21,7 +24,10 @@ module.exports = {
});
},
async down(queryInterface) {
await queryInterface.removeConstraint("group_permissions", "group_permissions_documentId_fkey")
await queryInterface.removeConstraint(
"group_permissions",
"group_permissions_documentId_fkey"
);
await queryInterface.changeColumn("group_permissions", "documentId", {
type: Sequelize.UUID,
references: {
@@ -1,4 +1,4 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
@@ -10,5 +10,5 @@ module.exports = {
async down() {
// No reverting possible
}
},
};
@@ -1,9 +1,9 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.removeColumn('group_users', 'deletedAt');
await queryInterface.removeColumn("group_users", "deletedAt");
// Cleanup any rows with duplicate groupId + userId
await queryInterface.sequelize.query(`
@@ -16,21 +16,24 @@ module.exports = {
`);
// Add groupId + userId as primary key
await queryInterface.addConstraint('group_users', {
fields: ['groupId', 'userId'],
type: 'primary key',
name: 'group_users_pkey'
await queryInterface.addConstraint("group_users", {
fields: ["groupId", "userId"],
type: "primary key",
name: "group_users_pkey",
});
await queryInterface.removeIndex("group_users", "group_users_group_id_user_id");
await queryInterface.removeIndex(
"group_users",
"group_users_group_id_user_id"
);
},
async down(queryInterface, Sequelize) {
await queryInterface.addIndex("group_users", ["groupId", "userId"]);
await queryInterface.removeConstraint('group_users', 'group_users_pkey');
await queryInterface.addColumn('group_users', 'deletedAt', {
await queryInterface.removeConstraint("group_users", "group_users_pkey");
await queryInterface.addColumn("group_users", "deletedAt", {
type: Sequelize.DATE,
allowNull: true
allowNull: true,
});
}
},
};
@@ -1,12 +1,12 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addIndex('notifications', ['teamId', 'userId']);
await queryInterface.addIndex("notifications", ["teamId", "userId"]);
},
async down(queryInterface, Sequelize) {
await queryInterface.removeIndex('notifications', ['teamId', 'userId']);
}
await queryInterface.removeIndex("notifications", ["teamId", "userId"]);
},
};
@@ -1,12 +1,15 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addIndex('user_permissions', ['documentId', 'userId']);
await queryInterface.addIndex("user_permissions", ["documentId", "userId"]);
},
async down(queryInterface, Sequelize) {
await queryInterface.removeIndex('user_permissions', ['documentId', 'userId']);
}
await queryInterface.removeIndex("user_permissions", [
"documentId",
"userId",
]);
},
};
@@ -1,12 +1,12 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addIndex('user_authentications', ['userId']);
await queryInterface.addIndex("user_authentications", ["userId"]);
},
async down(queryInterface, Sequelize) {
await queryInterface.removeIndex('user_authentications', ['userId']);
}
await queryInterface.removeIndex("user_authentications", ["userId"]);
},
};
@@ -1,35 +1,55 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.addColumn("apiKeys", "hash", {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"apiKeys",
"hash",
{
type: Sequelize.STRING,
allowNull: true,
unique: true,
}, { transaction });
},
{ transaction }
);
await queryInterface.addColumn("apiKeys", "last4", {
await queryInterface.addColumn(
"apiKeys",
"last4",
{
type: Sequelize.STRING(4),
allowNull: true,
}, { transaction });
},
{ transaction }
);
await queryInterface.changeColumn("apiKeys", "secret", {
await queryInterface.changeColumn(
"apiKeys",
"secret",
{
type: Sequelize.STRING,
allowNull: true,
}, { transaction });
},
{ transaction }
);
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn("apiKeys", "hash", { transaction });
await queryInterface.removeColumn("apiKeys", "last4", { transaction });
await queryInterface.changeColumn("apiKeys", "secret", {
await queryInterface.changeColumn(
"apiKeys",
"secret",
{
type: Sequelize.STRING,
allowNull: false,
}, { transaction });
},
{ transaction }
);
});
}
},
};
@@ -3,7 +3,7 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable(
"reactions",
{
@@ -64,7 +64,7 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
queryInterface.sequelize.transaction(async transaction => {
queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.dropTable("reactions", { transaction });
await queryInterface.removeColumn("comments", "reactions", {
transaction,
@@ -3,19 +3,32 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.addColumn("teams", "approximateTotalAttachmentsSize", {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"teams",
"approximateTotalAttachmentsSize",
{
type: Sequelize.BIGINT,
defaultValue: 0,
}, { transaction });
await queryInterface.addIndex("attachments", ["createdAt"], { transaction });
},
{ transaction }
);
await queryInterface.addIndex("attachments", ["createdAt"], {
transaction,
});
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.removeIndex("attachments", ["createdAt"], { transaction });
await queryInterface.removeColumn("teams", "approximateTotalAttachmentsSize", { transaction });
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeIndex("attachments", ["createdAt"], {
transaction,
});
await queryInterface.removeColumn(
"teams",
"approximateTotalAttachmentsSize",
{ transaction }
);
});
},
};
@@ -3,22 +3,39 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.addColumn("groups", "externalId", {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"groups",
"externalId",
{
type: Sequelize.STRING,
}, { transaction });
},
{ transaction }
);
await queryInterface.addIndex("groups", ["externalId"], { transaction });
await queryInterface.addIndex("group_permissions", ["documentId"], { transaction });
await queryInterface.addIndex("group_permissions", ["sourceId"], { transaction });
await queryInterface.addIndex("group_permissions", ["documentId"], {
transaction,
});
await queryInterface.addIndex("group_permissions", ["sourceId"], {
transaction,
});
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.removeIndex("group_permissions", ["sourceId"], { transaction });
await queryInterface.removeIndex("group_permissions", ["documentId"], { transaction });
await queryInterface.removeIndex("groups", ["externalId"], { transaction });
await queryInterface.removeColumn("groups", "externalId", { transaction });
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeIndex("group_permissions", ["sourceId"], {
transaction,
});
await queryInterface.removeIndex("group_permissions", ["documentId"], {
transaction,
});
await queryInterface.removeIndex("groups", ["externalId"], {
transaction,
});
await queryInterface.removeColumn("groups", "externalId", {
transaction,
});
});
},
};
@@ -3,16 +3,21 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.addColumn("apiKeys", "scope", {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"apiKeys",
"scope",
{
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
}, { transaction });
},
{ transaction }
);
});
},
async down(queryInterface) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn("apiKeys", "scope", { transaction });
});
},
@@ -3,7 +3,7 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"subscriptions",
"collectionId",
@@ -30,7 +30,7 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeIndex(
"subscriptions",
["userId", "collectionId", "event"],
@@ -1,19 +1,19 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(
`CREATE EXTENSION IF NOT EXISTS "pg_trgm";`,
`CREATE EXTENSION IF NOT EXISTS "pg_trgm";`
);
await queryInterface.sequelize.query(
`CREATE INDEX CONCURRENTLY documents_title_idx ON documents USING GIN (title gin_trgm_ops);`,
`CREATE INDEX CONCURRENTLY documents_title_idx ON documents USING GIN (title gin_trgm_ops);`
);
},
async down(queryInterface) {
await queryInterface.sequelize.query(
`DROP INDEX CONCURRENTLY documents_title_idx;`,
`DROP INDEX CONCURRENTLY documents_title_idx;`
);
}
},
};
@@ -3,11 +3,16 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.addColumn("teams", "previousSubdomains", {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"teams",
"previousSubdomains",
{
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
}, { transaction });
},
{ transaction }
);
await queryInterface.sequelize.query(
`CREATE INDEX teams_previous_subdomains ON teams USING GIN ("previousSubdomains");`,
{ transaction }
@@ -16,12 +21,14 @@ module.exports = {
},
async down(queryInterface) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.sequelize.query(
`DROP INDEX teams_previous_subdomains;`,
{ transaction }
);
await queryInterface.removeColumn("teams", "previousSubdomains", { transaction });
await queryInterface.removeColumn("teams", "previousSubdomains", {
transaction,
});
});
},
};
@@ -4,7 +4,7 @@ const tableName = "team_domains";
const constraintNames = [
"team_domains_createdById_fkey",
"createdById_foreign_idx"
"createdById_foreign_idx",
];
module.exports = {
@@ -3,7 +3,7 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable(
"imports",
{
@@ -80,7 +80,7 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeIndex("imports", ["service", "teamId"], {
transaction,
});
@@ -3,7 +3,7 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable(
"import_tasks",
{
@@ -54,7 +54,7 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeIndex("import_tasks", ["importId"], {
transaction,
});
@@ -3,7 +3,7 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"collections",
"apiImportId",
@@ -39,7 +39,7 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeIndex("collections", [
"apiImportId",
{ transaction },
@@ -3,7 +3,7 @@
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"imports",
"error",
@@ -27,7 +27,7 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn("imports", "error", { transaction });
await queryInterface.removeColumn("import_tasks", "error", {
transaction,
@@ -4,31 +4,33 @@
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable("oauth_clients", {
await queryInterface.createTable(
"oauth_clients",
{
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false
allowNull: false,
},
name: {
type: Sequelize.STRING,
allowNull: false
allowNull: false,
},
description: {
type: Sequelize.STRING,
allowNull: true
allowNull: true,
},
developerName: {
type: Sequelize.STRING,
allowNull: true
allowNull: true,
},
developerUrl: {
type: Sequelize.STRING,
allowNull: true
allowNull: true,
},
avatarUrl: {
type: Sequelize.STRING,
allowNull: true
allowNull: true,
},
clientId: {
type: Sequelize.STRING,
@@ -37,12 +39,12 @@ module.exports = {
},
clientSecret: {
type: Sequelize.BLOB,
allowNull: false
allowNull: false,
},
published: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false
defaultValue: false,
},
teamId: {
type: Sequelize.UUID,
@@ -50,57 +52,61 @@ module.exports = {
model: "teams",
},
allowNull: false,
onDelete: "cascade"
onDelete: "cascade",
},
createdById: {
type: Sequelize.UUID,
references: {
model: "users",
},
allowNull: false
allowNull: false,
},
redirectUris: {
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: false,
defaultValue: []
defaultValue: [],
},
createdAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
deletedAt: {
type: Sequelize.DATE,
allowNull: true
allowNull: true,
},
},
{
transaction,
}
}, {
transaction
});
);
await queryInterface.createTable("oauth_authorization_codes", {
await queryInterface.createTable(
"oauth_authorization_codes",
{
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false
allowNull: false,
},
authorizationCodeHash: {
type: Sequelize.STRING,
allowNull: false
allowNull: false,
},
codeChallenge: {
type: Sequelize.STRING,
allowNull: true
allowNull: true,
},
codeChallengeMethod: {
type: Sequelize.STRING,
allowNull: true
allowNull: true,
},
scope: {
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: false
allowNull: false,
},
oauthClientId: {
type: Sequelize.UUID,
@@ -108,7 +114,7 @@ module.exports = {
model: "oauth_clients",
},
onDelete: "cascade",
allowNull: false
allowNull: false,
},
userId: {
type: Sequelize.UUID,
@@ -116,55 +122,59 @@ module.exports = {
model: "users",
},
onDelete: "cascade",
allowNull: false
allowNull: false,
},
redirectUri: {
type: Sequelize.STRING,
allowNull: false
allowNull: false,
},
expiresAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
},
{
transaction,
}
}, {
transaction
});
);
await queryInterface.createTable("oauth_authentications", {
await queryInterface.createTable(
"oauth_authentications",
{
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false
allowNull: false,
},
accessTokenHash: {
type: Sequelize.STRING,
allowNull: false,
unique: true
unique: true,
},
accessTokenExpiresAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
refreshTokenHash: {
type: Sequelize.STRING,
allowNull: false,
unique: true
unique: true,
},
refreshTokenExpiresAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
lastActiveAt: {
type: Sequelize.DATE,
allowNull: true
allowNull: true,
},
scope: {
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: false
allowNull: false,
},
oauthClientId: {
type: Sequelize.UUID,
@@ -172,7 +182,7 @@ module.exports = {
model: "oauth_clients",
},
onDelete: "cascade",
allowNull: false
allowNull: false,
},
userId: {
type: Sequelize.UUID,
@@ -180,33 +190,39 @@ module.exports = {
model: "users",
},
onDelete: "cascade",
allowNull: false
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false
allowNull: false,
},
deletedAt: {
type: Sequelize.DATE,
allowNull: true
allowNull: true,
},
},
{
transaction,
}
}, {
transaction
});
);
await queryInterface.addIndex("oauth_clients", ["teamId"], { transaction });
await queryInterface.addIndex("oauth_clients", ["teamId"], {
transaction,
});
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.dropTable("oauth_authentications", { transaction });
await queryInterface.dropTable("oauth_authorization_codes", { transaction });
await queryInterface.dropTable("oauth_authorization_codes", {
transaction,
});
await queryInterface.dropTable("oauth_clients", { transaction });
});
}
},
};
@@ -1,9 +1,9 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn('collections', 'commenting', {
await queryInterface.addColumn("collections", "commenting", {
type: Sequelize.BOOLEAN,
allowNull: true,
defaultValue: null,
@@ -11,7 +11,6 @@ module.exports = {
},
async down(queryInterface, Sequelize) {
await queryInterface.removeColumn('collections', 'commenting');
}
await queryInterface.removeColumn("collections", "commenting");
},
};
@@ -1,15 +1,15 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("revisions", "deletedAt", {
type: Sequelize.DATE,
allowNull: true
allowNull: true,
});
},
async down(queryInterface, Sequelize) {
await queryInterface.removeColumn("revisions", "deletedAt");
}
},
};

Some files were not shown because too many files have changed in this diff Show More