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
+4 -13
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": [
@@ -65,4 +56,4 @@
]
}
}
}
}
+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": {
+56 -56
View File
@@ -2,62 +2,62 @@ name: Bug report
description: File a bug to help us improve
labels: ["bug"]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
attributes:
label: This is not related to configuring Outline
description: I understand that questions related to configuring self-hosted Outline should be asked in the [community forum](https://github.com/outline/outline/discussions/categories/self-hosting).
options:
- label: The issue is not related to self-hosting config
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **Outline**: Outline 0.80.0
- **Browser**: Safari
value: |
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
attributes:
label: This is not related to configuring Outline
description: I understand that questions related to configuring self-hosted Outline should be asked in the [community forum](https://github.com/outline/outline/discussions/categories/self-hosting).
options:
- label: The issue is not related to self-hosting config
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **Outline**: Outline 0.80.0
- **Browser**: Safari
value: |
- Outline:
- Browser:
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
+2 -2
View File
@@ -2,9 +2,9 @@
addReviewers: true
# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
reviewers:
- tommoor
# A list of keywords to be skipped the process that add reviewers if pull requests include it
# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
- wip
+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:
+60 -60
View File
@@ -2,9 +2,9 @@ name: CI
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
env:
NODE_ENV: test
@@ -25,39 +25,39 @@ jobs:
node-version: [20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
lint:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn lint
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn lint
types:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn tsc
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn tsc
changes:
runs-on: ubuntu-latest
@@ -89,13 +89,13 @@ jobs:
matrix:
test-group: [app, shared]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn test:${{ matrix.test-group }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn test:${{ matrix.test-group }}
test-server:
needs: [build, changes]
@@ -115,7 +115,7 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:5.0
ports:
@@ -129,37 +129,37 @@ jobs:
strategy:
matrix:
shard: [1, 2, 3]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn sequelize db:migrate
- name: Run server tests
run: |
TESTFILES=$(find . -name "*.test.ts" -path "*/server/*" | sort | split -n -d -l $(($(find . -name "*.test.ts" -path "*/server/*" | wc -l)/${{ matrix.shard }})) - | sed -n "${{ matrix.shard }}p")
yarn test --maxWorkers=2 $TESTFILES
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn sequelize db:migrate
- name: Run server tests
run: |
TESTFILES=$(find . -name "*.test.ts" -path "*/server/*" | sort | split -n -d -l $(($(find . -name "*.test.ts" -path "*/server/*" | wc -l)/${{ matrix.shard }})) - | sed -n "${{ matrix.shard }}p")
yarn test --maxWorkers=2 $TESTFILES
bundle-size:
needs: [build, types, changes]
if: ${{ needs.changes.outputs.app == 'true' && github.repository == 'outline/outline' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: 'yarn'
- run: yarn install --frozen-lockfile
- name: Set environment to production
run: echo "NODE_ENV=production" >> $GITHUB_ENV
- run: yarn vite:build
- name: Send bundle stats to RelativeCI
uses: relative-ci/agent-action@v2
with:
key: ${{ secrets.RELATIVE_CI_KEY }}
token: ${{ secrets.GITHUB_TOKEN }}
webpackStatsFile: ./build/app/webpack-stats.json
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "yarn"
- run: yarn install --frozen-lockfile
- name: Set environment to production
run: echo "NODE_ENV=production" >> $GITHUB_ENV
- run: yarn vite:build
- name: Send bundle stats to RelativeCI
uses: relative-ci/agent-action@v2
with:
key: ${{ secrets.RELATIVE_CI_KEY }}
token: ${{ secrets.GITHUB_TOKEN }}
webpackStatsFile: ./build/app/webpack-stats.json
+29 -29
View File
@@ -13,12 +13,12 @@ name: "CodeQL"
on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '28 15 * * 2'
- cron: "28 15 * * 2"
jobs:
analyze:
@@ -32,39 +32,39 @@ 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
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
+1 -1
View File
@@ -209,4 +209,4 @@ jobs:
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
+3 -3
View File
@@ -2,7 +2,7 @@ name: Lint
on:
pull_request:
branches: [ main ]
branches: [main]
jobs:
run-linters:
@@ -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 "";
+5 -5
View File
@@ -1,19 +1,19 @@
const storage = {};
export default {
setItem: function(key, value) {
storage[key] = value || '';
setItem: function (key, value) {
storage[key] = value || "";
},
getItem: function(key) {
getItem: function (key) {
return key in storage ? storage[key] : null;
},
removeItem: function(key) {
removeItem: function (key) {
delete storage[key];
},
get length() {
return Object.keys(storage).length;
},
key: function(i) {
key: function (i) {
var keys = Object.keys(storage);
return keys[i] || null;
},
+2 -8
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": {
@@ -222,4 +216,4 @@
"required": false
}
}
}
}
+5 -5
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");
});
});
});
+11 -9
View File
@@ -1,11 +1,13 @@
/* eslint-disable */
export const client = {
post: jest.fn(() => Promise.resolve({
data: {
user: {},
team: {},
groups: [],
groupUsers: [],
}
}))
export const client = {
post: jest.fn(() =>
Promise.resolve({
data: {
user: {},
team: {},
groups: [],
groupUsers: [],
},
})
),
};
+2 -2
View File
@@ -1,5 +1,5 @@
commit_message: 'fix: New %language% translations from Crowdin [ci skip]'
append_commit_message:
commit_message: "fix: New %language% translations from Crowdin [ci skip]"
append_commit_message:
files:
- source: /shared/i18n/locales/en_US/translation.json
translation: /shared/i18n/locales/%locale_with_underscore%/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
+3 -3
View File
@@ -32,14 +32,14 @@ At least one worker process is required to process the [queues](../server/queues
## Collaboration
The collaboration server coordinates all realtime editing and updating of documents,
The collaboration server coordinates all realtime editing and updating of documents,
it can be ran on the same box as the web server or separately.
```bash
yarn start --services=collaboration
```
If the collaboration service is hosted on a separate domain then the `COLLABORATION_URL`
env must be set to the publicly accessible URL. For example, if the app is hosted at
If the collaboration service is hosted on a separate domain then the `COLLABORATION_URL`
env must be set to the publicly accessible URL. For example, if the app is hosted at
`https://docs.example.com` you may use something like:
`COLLABORATION_URL=wss://docs-collaboration.example.com`.
+3 -3
View File
@@ -1,6 +1,6 @@
# Translation
Outline is localized through community contributions. The text in Outline's user interface is in American English by default, we're very thankful for all help that the community provides bringing the app to different languages.
Outline is localized through community contributions. The text in Outline's user interface is in American English by default, we're very thankful for all help that the community provides bringing the app to different languages.
## Externalizing strings
@@ -17,7 +17,7 @@ To manage the translation process we use [CrowdIn](https://translate.getoutline.
You'll need to create a free account to use CrowdIn. Once you have joined, you can provide translations by following these steps:
1. Select the language for which you want to contribute (or vote for) a translation (below the language you can see the progress of the translation)
![CrowdIn UI](https://i.imgur.com/AkbDY60.png)
![CrowdIn UI](https://i.imgur.com/AkbDY60.png)
2. Please choose the translation.json file from your desired language
@@ -31,4 +31,4 @@ If you are interested in becoming a proof reader, please contact one of the proj
## Release
Updated translations are automatically PR'd against the codebase by a bot and will be merged regularly so that new translations appear in the next release of Outline.
Updated translations are automatically PR'd against the codebase by a bot and will be merged regularly so that new translations appear in the next release of Outline.
+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",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"id": "discord",
"name": "Discord",
"priority": 10,
"description": "Adds a Discord authentication provider."
}
"id": "discord",
"name": "Discord",
"priority": 10,
"description": "Adds a Discord authentication provider."
}
+1 -1
View File
@@ -2,4 +2,4 @@
"id": "notion",
"name": "Notion",
"description": "Adds a Notion integration for importing data."
}
}
+2 -5
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
}
};
},
};
+18 -13
View File
@@ -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,17 +82,19 @@ module.exports = {
:createdAt,
:updatedAt
)
`, {
replacements: {
id: v4(),
documentId: document.id,
collectionId: document.collectionId,
teamId: document.teamId,
createdById: document.pinnedById,
updatedAt: createdAt,
createdAt,
},
});
`,
{
replacements: {
id: v4(),
documentId: document.id,
collectionId: document.collectionId,
teamId: document.teamId,
createdById: document.pinnedById,
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,65 +5,80 @@ const { v4 } = require("uuid");
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable("team_domains", {
id: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true,
},
teamId: {
type: Sequelize.UUID,
allowNull: false,
onDelete: "cascade",
references: {
model: "teams",
await queryInterface.createTable(
"team_domains",
{
id: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true,
},
teamId: {
type: Sequelize.UUID,
allowNull: false,
onDelete: "cascade",
references: {
model: "teams",
},
},
createdById: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users",
},
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
},
createdById: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users",
},
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
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,23 +1,26 @@
'use strict';
"use strict";
module.exports = {
up: async (queryInterface) => {
let again = 1;
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" }),
`,
{
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
});
await queryInterface.addColumn("user_authentications", "lastValidatedAt", {
type: Sequelize.DATE,
allowNull: true,
transaction
transaction,
});
await queryInterface.addColumn(
"user_authentications",
"lastValidatedAt",
{
type: Sequelize.DATE,
allowNull: true,
transaction,
}
);
});
},
down: async (queryInterface) => {
@@ -21,12 +25,12 @@ 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,14 +1,14 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.removeColumn("events", "updatedAt");
},
async down (queryInterface, Sequelize) {
async down(queryInterface, Sequelize) {
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");
async up(queryInterface, Sequelize) {
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");
async down(queryInterface, Sequelize) {
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");
async up(queryInterface, Sequelize) {
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");
async down(queryInterface, Sequelize) {
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,11 +1,11 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface) {
async up(queryInterface) {
await queryInterface.addIndex("users", ["email"]);
},
async down (queryInterface) {
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,14 +1,14 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
return queryInterface.addColumn("users", "preferences", {
type: Sequelize.JSONB,
allowNull: true,
});
},
async down (queryInterface, Sequelize) {
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,
});
});
}
},
};
@@ -1,14 +1,14 @@
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
return queryInterface.addColumn("webhook_subscriptions", "secret", {
type: Sequelize.BLOB,
allowNull: true,
});
},
async down (queryInterface, Sequelize) {
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",
{
type: Sequelize.STRING,
allowNull: true,
transaction,
},
);
await queryInterface.addColumn("shares", "urlId", {
type: Sequelize.STRING,
allowNull: true,
transaction,
});
await queryInterface.addConstraint("shares", {
fields: ["urlId", "teamId"],
@@ -20,7 +16,7 @@ module.exports = {
transaction,
});
});
} catch(err) {
} catch (err) {
throw err;
}
},
@@ -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"]);
async up(queryInterface, Sequelize) {
await queryInterface.addIndex("integrations", [
"teamId",
"type",
"service",
]);
},
async down (queryInterface, Sequelize) {
await queryInterface.removeIndex("integrations", ["teamId", "type", "service"]);
}
async down(queryInterface, Sequelize) {
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,12 +30,11 @@ 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,
}
);
}
@@ -60,7 +59,7 @@ module.exports = {
});
},
async down (queryInterface) {
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) {
@@ -7,7 +7,7 @@ module.exports = {
}
await queryInterface.sequelize.transaction(async (transaction) => {
// Convert collection members to admins where the user is the only
// Convert collection members to admins where the user is the only
// membership in the collection.
await queryInterface.sequelize.query(
`UPDATE collection_users cu
@@ -52,5 +52,5 @@ module.exports = {
type: queryInterface.sequelize.QueryTypes.SELECT,
}
);
}
},
};
@@ -1,11 +1,11 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.dropTable("notification_settings");
},
async down (queryInterface, Sequelize) {
throw new Error("Cannot undo this migration.")
}
async down(queryInterface, Sequelize) {
throw new Error("Cannot undo this migration.");
},
};
@@ -1,7 +1,7 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("file_operations", "includeAttachments", {
type: Sequelize.BOOLEAN,
allowNull: false,
@@ -9,7 +9,7 @@ module.exports = {
});
},
async down (queryInterface, Sequelize) {
async down(queryInterface, Sequelize) {
await queryInterface.removeColumn("file_operations", "includeAttachments");
}
},
};
@@ -1,7 +1,7 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("documents", "insightsEnabled", {
type: Sequelize.BOOLEAN,
allowNull: false,
@@ -9,7 +9,7 @@ module.exports = {
});
},
async down (queryInterface, Sequelize) {
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", {
type: Sequelize.UUID,
allowNull: true,
onDelete: "cascade",
references: {
model: "collections",
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,
});
{
transaction,
}
);
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",
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", {
type: Sequelize.UUID,
allowNull: true,
references: {
model: "collections",
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,
});
{
transaction,
}
);
await queryInterface.removeConstraint("file_operations", "file_operations_teamId_fkey", { transaction });
await queryInterface.changeColumn("file_operations", "teamId", {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "teams",
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,
});
{
transaction,
}
);
});
}
},
};
@@ -1,14 +1,14 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("revisions", "emoji", {
type: Sequelize.STRING,
allowNull: true,
});
},
async down (queryInterface) {
async down(queryInterface) {
await queryInterface.removeColumn("revisions", "emoji");
}
},
};
@@ -1,14 +1,14 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("file_operations", "deletedAt", {
type: Sequelize.DATE,
allowNull: true,
});
},
async down (queryInterface) {
async down(queryInterface) {
await queryInterface.removeColumn("file_operations", "deletedAt");
}
},
};
@@ -1,7 +1,7 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("shares", "domain", {
type: Sequelize.STRING,
allowNull: true,
@@ -9,7 +9,7 @@ module.exports = {
});
},
async down (queryInterface) {
async down(queryInterface) {
await queryInterface.removeColumn("shares", "domain");
}
},
};
@@ -1,14 +1,14 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("documents", "sourceMetadata", {
type: Sequelize.JSONB,
allowNull: true,
});
},
async down (queryInterface) {
async down(queryInterface) {
await queryInterface.removeColumn("documents", "sourceMetadata");
}
},
};
@@ -1,7 +1,7 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("documents", "content", {
type: Sequelize.JSONB,
allowNull: true,
@@ -12,8 +12,8 @@ module.exports = {
});
},
async down (queryInterface) {
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,14 +1,14 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("authentications", "refreshToken", {
type: Sequelize.BLOB,
allowNull: true,
});
},
async down (queryInterface) {
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,7 +1,7 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn("users", "role", {
type: Sequelize.ENUM("admin", "member", "viewer", "guest"),
allowNull: true,
@@ -35,7 +35,7 @@ module.exports = {
});
},
async down (queryInterface) {
async down(queryInterface) {
await queryInterface.removeColumn("users", "role");
}
};
},
};
@@ -1,15 +1,15 @@
'use strict';
"use strict";
module.exports = {
async up (queryInterface, Sequelize) {
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) {
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,14 +1,14 @@
'use strict';
"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up (queryInterface) {
async up(queryInterface) {
await queryInterface.sequelize.query(
`DELETE FROM group_users WHERE "deletedAt" IS NOT NULL`
);
},
async down () {
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');
async up(queryInterface) {
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) {
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']);
async up(queryInterface, Sequelize) {
await queryInterface.addIndex("notifications", ["teamId", "userId"]);
},
async down (queryInterface, Sequelize) {
await queryInterface.removeIndex('notifications', ['teamId', 'userId']);
}
async down(queryInterface, Sequelize) {
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']);
async up(queryInterface, Sequelize) {
await queryInterface.addIndex("user_permissions", ["documentId", "userId"]);
},
async down (queryInterface, Sequelize) {
await queryInterface.removeIndex('user_permissions', ['documentId', 'userId']);
}
async down(queryInterface, Sequelize) {
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']);
async up(queryInterface, Sequelize) {
await queryInterface.addIndex("user_authentications", ["userId"]);
},
async down (queryInterface, Sequelize) {
await queryInterface.removeIndex('user_authentications', ['userId']);
}
async down(queryInterface, Sequelize) {
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", {
type: Sequelize.STRING,
allowNull: true,
unique: true,
}, { transaction });
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"apiKeys",
"hash",
{
type: Sequelize.STRING,
allowNull: true,
unique: true,
},
{ transaction }
);
await queryInterface.addColumn("apiKeys", "last4", {
type: Sequelize.STRING(4),
allowNull: true,
}, { transaction });
await queryInterface.addColumn(
"apiKeys",
"last4",
{
type: Sequelize.STRING(4),
allowNull: true,
},
{ transaction }
);
await queryInterface.changeColumn("apiKeys", "secret", {
type: Sequelize.STRING,
allowNull: true,
}, { transaction });
await queryInterface.changeColumn(
"apiKeys",
"secret",
{
type: Sequelize.STRING,
allowNull: true,
},
{ transaction }
);
});
},
async down (queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.removeColumn("apiKeys", "hash", { transaction });
await queryInterface.removeColumn("apiKeys", "last4", { transaction });
await queryInterface.changeColumn("apiKeys", "secret", {
type: Sequelize.STRING,
allowNull: false,
}, { transaction });
await queryInterface.changeColumn(
"apiKeys",
"secret",
{
type: Sequelize.STRING,
allowNull: false,
},
{ 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", {
type: Sequelize.BIGINT,
defaultValue: 0,
}, { transaction });
await queryInterface.addIndex("attachments", ["createdAt"], { transaction });
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"teams",
"approximateTotalAttachmentsSize",
{
type: Sequelize.BIGINT,
defaultValue: 0,
},
{ 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", {
type: Sequelize.STRING,
}, { transaction });
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"groups",
"externalId",
{
type: Sequelize.STRING,
},
{ 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", {
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
}, { transaction });
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"apiKeys",
"scope",
{
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
},
{ 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) {
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) {
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", {
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
}, { transaction });
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn(
"teams",
"previousSubdomains",
{
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
},
{ 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 = {

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