diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..6e6d07131 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,199 @@ +name: CI + +permissions: + contents: read + +# Controls which events and branches will trigger the workflow +on: + push: + branches: [ main ] + pull_request: + branches: [ main, development ] + +# Cancel older runs of the same PR when a new push arrives +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Install deps once and reuse for other jobs (optional optimization) + install: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + node-version: 24 + cache: 'pnpm' + + - name: Create .env files + run: | + cp ./backend/.env.example ./backend/.env + cp ./frontend/.env.example ./frontend/.env + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + # Save node_modules so other jobs can reuse + - name: Cache node_modules + uses: actions/cache@v3 + with: + path: | + **/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }} + + # Runs linting + lint: + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + cache: 'pnpm' + + - name: Restore node_modules + uses: actions/cache@v3 + with: + path: | + **/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Run Biome + run: pnpm biome check . + + # Runs all tests + test: + runs-on: ubuntu-latest + needs: install + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + cache: 'pnpm' + + - name: Create .env files + run: | + cp ./backend/.env.example ./backend/.env + cp ./frontend/.env.example ./frontend/.env + + - name: Restore node_modules + uses: actions/cache@v3 + with: + path: | + **/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }} + - run: pnpm test + + # Will run a quick startup check to ensure the app starts without issues + quick: + runs-on: ubuntu-latest + needs: [lint, test] + steps: + - name: Checkout repo + uses: actions/checkout@v5 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v5 + + - name: Create .env files + run: | + cp ./backend/.env.example ./backend/.env + cp ./frontend/.env.example ./frontend/.env + + - name: Restore node_modules + uses: actions/cache@v3 + with: + path: | + **/node_modules + key: ${{ runner.os }}-modules-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Start quick and wait for Vite ready + run: | + timeout 120s stdbuf -oL pnpm quick 2>&1 | while IFS= read -r line; do + # Show all output for debugging + echo "$line" + # Remove ANSI escape codes + clean_line=$(echo "$line" | sed -r "s/\x1B\[[0-9;]*[mK]//g") + # Match "VITE ready in " anywhere in the line + if echo "$clean_line" | grep -E ".*VITE [^ ]+ +ready in [0-9]+ ms"; then + echo ">>> Vite server is ready! <<<" + pkill -P $$ pnpm || true + break + fi + done || true + + # Generates draft release notes (for testing only) + draft-release-notes: + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v5 + with: + fetch-depth: 0 # needed so changelog sees full commit history + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v5 + + - name: Install changelog deps + run: pnpm add -Dw conventional-changelog-cli conventional-changelog-conventionalcommits + + - name: Generate draft release notes + run: | + # Check latest and previous tags + LATEST_TAG=$(if [ "$(git tag | wc -l)" -ge 1 ]; then git describe --tags --abbrev=0; fi) + PREV_TAG=$(if [ "$(git tag | wc -l)" -ge 2 ]; then git tag --sort=creatordate | tail -2 | head -1; fi) + + echo "Latest tag: $LATEST_TAG" + echo "Previous tag: $PREV_TAG" + + if [ -z "$PREV_TAG" ]; then + echo "First release — include all commits" + npx conventional-changelog -p conventionalcommits -r 0 -o RELEASE_NOTES.md + else + echo "Generating changelog since previous tag $PREV_TAG" + # Use -r 2 and output commits since PREV_TAG + npx conventional-changelog -p conventionalcommits -r 2 -o RELEASE_NOTES.md + fi + + - name: Upload draft release notes + uses: actions/upload-artifact@v4 + with: + name: draft-release-notes + path: RELEASE_NOTES.md \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..cf8411a30 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release +permissions: + contents: write + +on: + push: + tags: + - "v*" # Runs only when pushing version tags like v1.0.0, v2.3.4 + +jobs: + release-notes: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v5 + with: + fetch-depth: 0 # so changelog sees all commit history + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v5 + with: + cache: "pnpm" + + - name: Install changelog deps + run: pnpm add -Dw conventional-changelog-cli conventional-changelog-conventionalcommits + + - name: Generate release notes + run: | + # Check latest and previous tags + LATEST_TAG=$(if [ "$(git tag | wc -l)" -ge 1 ]; then git describe --tags --abbrev=0; fi) + PREV_TAG=$(if [ "$(git tag | wc -l)" -ge 2 ]; then git tag --sort=creatordate | tail -2 | head -1; fi) + + echo "Latest tag: $LATEST_TAG" + echo "Previous tag: $PREV_TAG" + + if [ -z "$PREV_TAG" ]; then + echo "First release — include all commits" + npx conventional-changelog -p conventionalcommits -r 0 -o RELEASE_NOTES.md + else + echo "Generating changelog since previous tag $PREV_TAG" + # Use -r 2 and output commits since PREV_TAG + npx conventional-changelog -p conventionalcommits -r 2 -o RELEASE_NOTES.md + fi + + - name: Publish GitHub Release + uses: softprops/action-gh-release@v2 + with: + body_path: RELEASE_NOTES.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index fe2b10c7f..b3898a9f1 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ > [!CAUTION] -> This is a prerelease. It does NOT meet production requirements yet and large breaking changes occur regularly. Versioned releases will begin once we have solid tests for authentication, authorization and data access. Want to contribute or discuss cella with us? Let's connect! ✉️ +> This is a prerelease. Versioned releases will start once we have enough tests for authentication, authorization and data access. Want to contribute or discuss cella with us? Let's connect! ✉️ #### Contents -- [Installation](#installation) +- [Create app](#create-app) - [Architecture](/info/ARCHITECTURE.md) - [Roadmap](/info/ROADMAP.md) - [Deployment](/info/DEPLOYMENT.md) @@ -47,18 +47,18 @@
-## Create your own app -Want to try cella to build a new web app with sync engine? We recommend NOT TO FORK this repo directly. Instead, use the create CLI to get started: +## Create app +Do **not fork** this repo directly. Use the create CLI to get started: ```bash -pnpm create @cellajs/cella@latest +pnpm create @cellajs/cella ``` You now have an implementation-ready web app 🤯. But ... without any unique functionality 🤓. Read the [Quickstart](/info/QUICKSTART.md) so you can build something unique quickly.

 

-## Installation +## Contribute For those that (also) want to participate in development: ```bash @@ -89,8 +89,6 @@ pnpm dev Check it out at [localhost:3000](http://localhost:3000)! Generated API docs can be found at [localhost:4000/docs](http://localhost:4000/docs). Manage your local db with [local.drizzle.studio](http:local.drizzle.studio). - -
-
+

 

💙💛 Big thank you to [drizzle](https://github.com/drizzle-team/drizzle-orm), [hono](https://github.com/honojs/hono), [tanstack-router](https://github.com/tanstack/router) & [electric](https://github.com/electric-sql/electric). diff --git a/backend/drizzle/0000_sad_paladin.sql b/backend/drizzle/0000_modern_black_queen.sql similarity index 80% rename from backend/drizzle/0000_sad_paladin.sql rename to backend/drizzle/0000_modern_black_queen.sql index da25da186..b28638873 100644 --- a/backend/drizzle/0000_sad_paladin.sql +++ b/backend/drizzle/0000_modern_black_queen.sql @@ -3,6 +3,8 @@ CREATE TABLE "attachments" ( "id" varchar PRIMARY KEY NOT NULL, "name" varchar DEFAULT 'attachment' NOT NULL, "entity_type" varchar DEFAULT 'attachment' NOT NULL, + "public" boolean DEFAULT false NOT NULL, + "bucket_name" varchar NOT NULL, "group_id" varchar, "filename" varchar NOT NULL, "content_type" varchar NOT NULL, @@ -48,14 +50,13 @@ CREATE TABLE "memberships" ( CREATE TABLE "oauth_accounts" ( "created_at" timestamp DEFAULT now() NOT NULL, "id" varchar PRIMARY KEY NOT NULL, - "provider_id" varchar NOT NULL, + "provider" varchar NOT NULL, "provider_user_id" varchar NOT NULL, "email" varchar NOT NULL, "verified" boolean DEFAULT false NOT NULL, "verified_at" timestamp, - "tenant_id" varchar, "user_id" varchar NOT NULL, - CONSTRAINT "oauth_accounts_providerId_providerUserId_email_unique" UNIQUE("provider_id","provider_user_id","email") + CONSTRAINT "oauth_accounts_provider_providerUserId_email_unique" UNIQUE("provider","provider_user_id","email") ); --> statement-breakpoint CREATE TABLE "organizations" ( @@ -89,12 +90,26 @@ CREATE TABLE "organizations" ( --> statement-breakpoint CREATE TABLE "passkeys" ( "id" varchar PRIMARY KEY NOT NULL, - "user_email" varchar NOT NULL, + "user_id" varchar NOT NULL, "credential_id" varchar NOT NULL, "public_key" varchar NOT NULL, + "device_name" varchar, + "device_type" varchar DEFAULT 'desktop' NOT NULL, + "device_os" varchar, + "browser" varchar, + "name_on_device" varchar NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL ); --> statement-breakpoint +CREATE TABLE "passwords" ( + "id" varchar PRIMARY KEY NOT NULL, + "hashed_password" varchar NOT NULL, + "user_id" varchar NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "modified_at" timestamp, + CONSTRAINT "passwords_userId_unique" UNIQUE("user_id") +); +--> statement-breakpoint CREATE TABLE "requests" ( "created_at" timestamp DEFAULT now() NOT NULL, "id" varchar PRIMARY KEY NOT NULL, @@ -122,6 +137,7 @@ CREATE TABLE "tokens" ( "created_at" timestamp DEFAULT now() NOT NULL, "id" varchar PRIMARY KEY NOT NULL, "token" varchar NOT NULL, + "single_use_token" varchar, "type" varchar NOT NULL, "email" varchar NOT NULL, "entity_type" varchar, @@ -130,9 +146,26 @@ CREATE TABLE "tokens" ( "oauth_account_id" varchar, "created_by" varchar, "expires_at" timestamp with time zone NOT NULL, + "invoked_at" timestamp with time zone, "organization_id" varchar ); --> statement-breakpoint +CREATE TABLE "totps" ( + "id" varchar PRIMARY KEY NOT NULL, + "user_id" varchar NOT NULL, + "secret" varchar NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "unsubscribe_tokens" ( + "id" varchar PRIMARY KEY NOT NULL, + "user_id" varchar NOT NULL, + "token" varchar NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "unsubscribe_tokens_userId_unique" UNIQUE("user_id"), + CONSTRAINT "unsubscribe_tokens_token_unique" UNIQUE("token") +); +--> statement-breakpoint CREATE TABLE "users" ( "created_at" timestamp DEFAULT now() NOT NULL, "id" varchar PRIMARY KEY NOT NULL, @@ -143,21 +176,20 @@ CREATE TABLE "users" ( "thumbnail_url" varchar, "banner_url" varchar, "email" varchar NOT NULL, - "hashed_password" varchar, - "unsubscribe_token" varchar NOT NULL, + "mfa_required" boolean DEFAULT false NOT NULL, "first_name" varchar, "last_name" varchar, "language" varchar DEFAULT 'en' NOT NULL, "newsletter" boolean DEFAULT false NOT NULL, "role" varchar DEFAULT 'user' NOT NULL, + "user_flags" jsonb DEFAULT '{}'::jsonb NOT NULL, "modified_at" timestamp, "last_seen_at" timestamp, "last_started_at" timestamp, "last_sign_in_at" timestamp, "modified_by" varchar, CONSTRAINT "users_slug_unique" UNIQUE("slug"), - CONSTRAINT "users_email_unique" UNIQUE("email"), - CONSTRAINT "users_unsubscribeToken_unique" UNIQUE("unsubscribe_token") + CONSTRAINT "users_email_unique" UNIQUE("email") ); --> statement-breakpoint ALTER TABLE "attachments" ADD CONSTRAINT "attachments_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint @@ -173,20 +205,23 @@ ALTER TABLE "memberships" ADD CONSTRAINT "memberships_organization_id_organizati ALTER TABLE "oauth_accounts" ADD CONSTRAINT "oauth_accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "organizations" ADD CONSTRAINT "organizations_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint ALTER TABLE "organizations" ADD CONSTRAINT "organizations_modified_by_users_id_fk" FOREIGN KEY ("modified_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "passkeys" ADD CONSTRAINT "passkeys_user_email_users_email_fk" FOREIGN KEY ("user_email") REFERENCES "public"."users"("email") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "passkeys" ADD CONSTRAINT "passkeys_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "passwords" ADD CONSTRAINT "passwords_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "requests" ADD CONSTRAINT "requests_token_id_tokens_id_fk" FOREIGN KEY ("token_id") REFERENCES "public"."tokens"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "tokens" ADD CONSTRAINT "tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "tokens" ADD CONSTRAINT "tokens_oauth_account_id_oauth_accounts_id_fk" FOREIGN KEY ("oauth_account_id") REFERENCES "public"."oauth_accounts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint ALTER TABLE "tokens" ADD CONSTRAINT "tokens_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint ALTER TABLE "tokens" ADD CONSTRAINT "tokens_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "totps" ADD CONSTRAINT "totps_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "unsubscribe_tokens" ADD CONSTRAINT "unsubscribe_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint ALTER TABLE "users" ADD CONSTRAINT "users_modified_by_users_id_fk" FOREIGN KEY ("modified_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint CREATE INDEX "attachments_organization_id_index" ON "attachments" USING btree ("organization_id");--> statement-breakpoint CREATE INDEX "organizations_name_index" ON "organizations" USING btree ("name" DESC NULLS LAST);--> statement-breakpoint CREATE INDEX "organizations_created_at_index" ON "organizations" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint CREATE INDEX "requests_emails" ON "requests" USING btree ("email" DESC NULLS LAST);--> statement-breakpoint CREATE INDEX "requests_created_at" ON "requests" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint +CREATE INDEX "users_token_index" ON "unsubscribe_tokens" USING btree ("token");--> statement-breakpoint CREATE INDEX "users_name_index" ON "users" USING btree ("name" DESC NULLS LAST);--> statement-breakpoint -CREATE INDEX "users_token_index" ON "users" USING btree ("unsubscribe_token");--> statement-breakpoint CREATE INDEX "users_email_index" ON "users" USING btree ("email" DESC NULLS LAST);--> statement-breakpoint CREATE INDEX "users_created_at_index" ON "users" USING btree ("created_at" DESC NULLS LAST); \ No newline at end of file diff --git a/backend/drizzle/0001_illegal_odin.sql b/backend/drizzle/0001_illegal_odin.sql deleted file mode 100644 index 0a027754e..000000000 --- a/backend/drizzle/0001_illegal_odin.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "users" ADD COLUMN "user_flags" jsonb DEFAULT '{}'::jsonb NOT NULL \ No newline at end of file diff --git a/backend/drizzle/0002_nosy_white_tiger.sql b/backend/drizzle/0002_nosy_white_tiger.sql deleted file mode 100644 index c77c3c32c..000000000 --- a/backend/drizzle/0002_nosy_white_tiger.sql +++ /dev/null @@ -1,45 +0,0 @@ -CREATE TABLE "passwords" ( - "id" varchar PRIMARY KEY NOT NULL, - "hashed_password" varchar NOT NULL, - "user_id" varchar NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "modified_at" timestamp, - CONSTRAINT "passwords_userId_unique" UNIQUE("user_id") -); ---> statement-breakpoint -CREATE TABLE "totps" ( - "id" varchar PRIMARY KEY NOT NULL, - "user_id" varchar NOT NULL, - "encoder_secret_key" varchar NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "unsubscribe_tokens" ( - "id" varchar PRIMARY KEY NOT NULL, - "user_id" varchar NOT NULL, - "token" varchar NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "unsubscribe_tokens_userId_unique" UNIQUE("user_id"), - CONSTRAINT "unsubscribe_tokens_token_unique" UNIQUE("token") -); ---> statement-breakpoint -ALTER TABLE "users" DROP CONSTRAINT "users_unsubscribeToken_unique";--> statement-breakpoint -ALTER TABLE "passkeys" DROP CONSTRAINT "passkeys_user_email_users_email_fk"; ---> statement-breakpoint -DROP INDEX "users_token_index";--> statement-breakpoint -ALTER TABLE "passkeys" ADD COLUMN "user_id" varchar NOT NULL;--> statement-breakpoint -ALTER TABLE "passkeys" ADD COLUMN "device_name" varchar;--> statement-breakpoint -ALTER TABLE "passkeys" ADD COLUMN "device_type" varchar DEFAULT 'desktop' NOT NULL;--> statement-breakpoint -ALTER TABLE "passkeys" ADD COLUMN "device_os" varchar;--> statement-breakpoint -ALTER TABLE "passkeys" ADD COLUMN "browser" varchar;--> statement-breakpoint -ALTER TABLE "passkeys" ADD COLUMN "name_on_device" varchar NOT NULL;--> statement-breakpoint -ALTER TABLE "tokens" ADD COLUMN "consumed_at" timestamp with time zone;--> statement-breakpoint -ALTER TABLE "users" ADD COLUMN "mfa_required" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "passwords" ADD CONSTRAINT "passwords_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "totps" ADD CONSTRAINT "totps_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "unsubscribe_tokens" ADD CONSTRAINT "unsubscribe_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -CREATE INDEX "users_token_index" ON "unsubscribe_tokens" USING btree ("token");--> statement-breakpoint -ALTER TABLE "passkeys" ADD CONSTRAINT "passkeys_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "passkeys" DROP COLUMN "user_email";--> statement-breakpoint -ALTER TABLE "users" DROP COLUMN "hashed_password";--> statement-breakpoint -ALTER TABLE "users" DROP COLUMN "unsubscribe_token"; \ No newline at end of file diff --git a/backend/drizzle/0003_salty_raider.sql b/backend/drizzle/0003_salty_raider.sql deleted file mode 100644 index c072bee7d..000000000 --- a/backend/drizzle/0003_salty_raider.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "totps" RENAME COLUMN "encoder_secret_key" TO "secret"; \ No newline at end of file diff --git a/backend/drizzle/0004_flaky_charles_xavier.sql b/backend/drizzle/0004_flaky_charles_xavier.sql deleted file mode 100644 index 69af7796d..000000000 --- a/backend/drizzle/0004_flaky_charles_xavier.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "attachments" ADD COLUMN "public" boolean DEFAULT false NOT NULL;--> statement-breakpoint -ALTER TABLE "attachments" ADD COLUMN "bucket_name" varchar NOT NULL; \ No newline at end of file diff --git a/backend/drizzle/meta/0000_snapshot.json b/backend/drizzle/meta/0000_snapshot.json index 1cc88732e..e863c8aae 100644 --- a/backend/drizzle/meta/0000_snapshot.json +++ b/backend/drizzle/meta/0000_snapshot.json @@ -1,5 +1,5 @@ { - "id": "727b17a3-f074-4db2-92c1-bb650749e21c", + "id": "eb63c351-3bd9-470d-a7ae-afb456ca323a", "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", @@ -35,6 +35,19 @@ "notNull": true, "default": "'attachment'" }, + "public": { + "name": "public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "bucket_name": { + "name": "bucket_name", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, "group_id": { "name": "group_id", "type": "varchar", @@ -448,8 +461,8 @@ "primaryKey": true, "notNull": true }, - "provider_id": { - "name": "provider_id", + "provider": { + "name": "provider", "type": "varchar", "primaryKey": false, "notNull": true @@ -479,12 +492,6 @@ "primaryKey": false, "notNull": false }, - "tenant_id": { - "name": "tenant_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, "user_id": { "name": "user_id", "type": "varchar", @@ -510,11 +517,11 @@ }, "compositePrimaryKeys": {}, "uniqueConstraints": { - "oauth_accounts_providerId_providerUserId_email_unique": { - "name": "oauth_accounts_providerId_providerUserId_email_unique", + "oauth_accounts_provider_providerUserId_email_unique": { + "name": "oauth_accounts_provider_providerUserId_email_unique", "nullsNotDistinct": false, "columns": [ - "provider_id", + "provider", "provider_user_id", "email" ] @@ -771,8 +778,8 @@ "primaryKey": true, "notNull": true }, - "user_email": { - "name": "user_email", + "user_id": { + "name": "user_id", "type": "varchar", "primaryKey": false, "notNull": true @@ -789,6 +796,37 @@ "primaryKey": false, "notNull": true }, + "device_name": { + "name": "device_name", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "device_type": { + "name": "device_type", + "type": "varchar", + "primaryKey": false, + "notNull": true, + "default": "'desktop'" + }, + "device_os": { + "name": "device_os", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "browser": { + "name": "browser", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, + "name_on_device": { + "name": "name_on_device", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, "created_at": { "name": "created_at", "type": "timestamp", @@ -799,15 +837,15 @@ }, "indexes": {}, "foreignKeys": { - "passkeys_user_email_users_email_fk": { - "name": "passkeys_user_email_users_email_fk", + "passkeys_user_id_users_id_fk": { + "name": "passkeys_user_id_users_id_fk", "tableFrom": "passkeys", "tableTo": "users", "columnsFrom": [ - "user_email" + "user_id" ], "columnsTo": [ - "email" + "id" ], "onDelete": "cascade", "onUpdate": "no action" @@ -819,6 +857,72 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.passwords": { + "name": "passwords", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "hashed_password": { + "name": "hashed_password", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "modified_at": { + "name": "modified_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "passwords_user_id_users_id_fk": { + "name": "passwords_user_id_users_id_fk", + "tableFrom": "passwords", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "passwords_userId_unique": { + "name": "passwords_userId_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.requests": { "name": "requests", "schema": "", @@ -1033,6 +1137,12 @@ "primaryKey": false, "notNull": true }, + "single_use_token": { + "name": "single_use_token", + "type": "varchar", + "primaryKey": false, + "notNull": false + }, "type": { "name": "type", "type": "varchar", @@ -1081,6 +1191,12 @@ "primaryKey": false, "notNull": true }, + "invoked_at": { + "name": "invoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, "organization_id": { "name": "organization_id", "type": "varchar", @@ -1149,6 +1265,141 @@ "checkConstraints": {}, "isRLSEnabled": false }, + "public.totps": { + "name": "totps", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "totps_user_id_users_id_fk": { + "name": "totps_user_id_users_id_fk", + "tableFrom": "totps", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.unsubscribe_tokens": { + "name": "unsubscribe_tokens", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "varchar", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "users_token_index": { + "name": "users_token_index", + "columns": [ + { + "expression": "token", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "unsubscribe_tokens_user_id_users_id_fk": { + "name": "unsubscribe_tokens_user_id_users_id_fk", + "tableFrom": "unsubscribe_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "unsubscribe_tokens_userId_unique": { + "name": "unsubscribe_tokens_userId_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id" + ] + }, + "unsubscribe_tokens_token_unique": { + "name": "unsubscribe_tokens_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, "public.users": { "name": "users", "schema": "", @@ -1209,17 +1460,12 @@ "primaryKey": false, "notNull": true }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "unsubscribe_token": { - "name": "unsubscribe_token", - "type": "varchar", + "mfa_required": { + "name": "mfa_required", + "type": "boolean", "primaryKey": false, - "notNull": true + "notNull": true, + "default": false }, "first_name": { "name": "first_name", @@ -1254,6 +1500,13 @@ "notNull": true, "default": "'user'" }, + "user_flags": { + "name": "user_flags", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'{}'::jsonb" + }, "modified_at": { "name": "modified_at", "type": "timestamp", @@ -1301,21 +1554,6 @@ "method": "btree", "with": {} }, - "users_token_index": { - "name": "users_token_index", - "columns": [ - { - "expression": "unsubscribe_token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, "users_email_index": { "name": "users_email_index", "columns": [ @@ -1377,13 +1615,6 @@ "columns": [ "email" ] - }, - "users_unsubscribeToken_unique": { - "name": "users_unsubscribeToken_unique", - "nullsNotDistinct": false, - "columns": [ - "unsubscribe_token" - ] } }, "policies": {}, diff --git a/backend/drizzle/meta/0001_snapshot.json b/backend/drizzle/meta/0001_snapshot.json deleted file mode 100644 index 7868f6365..000000000 --- a/backend/drizzle/meta/0001_snapshot.json +++ /dev/null @@ -1,1412 +0,0 @@ -{ - "id": "97546b98-2c9e-4494-bd18-66fc4bb43284", - "prevId": "727b17a3-f074-4db2-92c1-bb650749e21c", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.attachments": { - "name": "attachments", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "group_id": { - "name": "group_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "content_type": { - "name": "content_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_content_type": { - "name": "converted_content_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "size": { - "name": "size", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "original_key": { - "name": "original_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_key": { - "name": "converted_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_key": { - "name": "thumbnail_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "attachments_organization_id_index": { - "name": "attachments_organization_id_index", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "attachments_created_by_users_id_fk": { - "name": "attachments_created_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_modified_by_users_id_fk": { - "name": "attachments_modified_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_organization_id_organizations_id_fk": { - "name": "attachments_organization_id_organizations_id_fk", - "tableFrom": "attachments", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.emails": { - "name": "emails", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "emails_token_id_tokens_id_fk": { - "name": "emails_token_id_tokens_id_fk", - "tableFrom": "emails", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "emails_user_id_users_id_fk": { - "name": "emails_user_id_users_id_fk", - "tableFrom": "emails", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "emails_email_unique": { - "name": "emails_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.memberships": { - "name": "memberships", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "context_type": { - "name": "context_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "activated_at": { - "name": "activated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "archived": { - "name": "archived", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "muted": { - "name": "muted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "order": { - "name": "order", - "type": "double precision", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "memberships_user_id_users_id_fk": { - "name": "memberships_user_id_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_token_id_tokens_id_fk": { - "name": "memberships_token_id_tokens_id_fk", - "tableFrom": "memberships", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_created_by_users_id_fk": { - "name": "memberships_created_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_modified_by_users_id_fk": { - "name": "memberships_modified_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_organization_id_organizations_id_fk": { - "name": "memberships_organization_id_organizations_id_fk", - "tableFrom": "memberships", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.oauth_accounts": { - "name": "oauth_accounts", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "provider_user_id": { - "name": "provider_user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "oauth_accounts_user_id_users_id_fk": { - "name": "oauth_accounts_user_id_users_id_fk", - "tableFrom": "oauth_accounts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "oauth_accounts_providerId_providerUserId_email_unique": { - "name": "oauth_accounts_providerId_providerUserId_email_unique", - "nullsNotDistinct": false, - "columns": [ - "provider_id", - "provider_user_id", - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'organization'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "short_name": { - "name": "short_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "timezone": { - "name": "timezone", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "default_language": { - "name": "default_language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "languages": { - "name": "languages", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[\"en\"]'::json" - }, - "restrictions": { - "name": "restrictions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"user\":1000,\"attachment\":100}'::json" - }, - "notification_email": { - "name": "notification_email", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email_domains": { - "name": "email_domains", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "color": { - "name": "color", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "website_url": { - "name": "website_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "welcome_text": { - "name": "welcome_text", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategies": { - "name": "auth_strategies", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "chat_support": { - "name": "chat_support", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "organizations_name_index": { - "name": "organizations_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_index": { - "name": "organizations_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organizations_created_by_users_id_fk": { - "name": "organizations_created_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "organizations_modified_by_users_id_fk": { - "name": "organizations_modified_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organizations_slug_unique": { - "name": "organizations_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkeys": { - "name": "passkeys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_email": { - "name": "user_email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passkeys_user_email_users_email_fk": { - "name": "passkeys_user_email_users_email_fk", - "tableFrom": "passkeys", - "tableTo": "users", - "columnsFrom": [ - "user_email" - ], - "columnsTo": [ - "email" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.requests": { - "name": "requests", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "message": { - "name": "message", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "requests_emails": { - "name": "requests_emails", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "requests_created_at": { - "name": "requests_created_at", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "requests_token_id_tokens_id_fk": { - "name": "requests_token_id_tokens_id_fk", - "tableFrom": "requests", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'regular'" - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "device_name": { - "name": "device_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "device_type": { - "name": "device_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'desktop'" - }, - "device_os": { - "name": "device_os", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "browser": { - "name": "browser", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategy": { - "name": "auth_strategy", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tokens": { - "name": "tokens", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "oauth_account_id": { - "name": "oauth_account_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "tokens_user_id_users_id_fk": { - "name": "tokens_user_id_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tokens_oauth_account_id_oauth_accounts_id_fk": { - "name": "tokens_oauth_account_id_oauth_accounts_id_fk", - "tableFrom": "tokens", - "tableTo": "oauth_accounts", - "columnsFrom": [ - "oauth_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_created_by_users_id_fk": { - "name": "tokens_created_by_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_organization_id_organizations_id_fk": { - "name": "tokens_organization_id_organizations_id_fk", - "tableFrom": "tokens", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "unsubscribe_token": { - "name": "unsubscribe_token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "first_name": { - "name": "first_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_name": { - "name": "last_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "language": { - "name": "language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "newsletter": { - "name": "newsletter", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "user_flags": { - "name": "user_flags", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_started_at": { - "name": "last_started_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_sign_in_at": { - "name": "last_sign_in_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_name_index": { - "name": "users_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_token_index": { - "name": "users_token_index", - "columns": [ - { - "expression": "unsubscribe_token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_index": { - "name": "users_email_index", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_index": { - "name": "users_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_modified_by_users_id_fk": { - "name": "users_modified_by_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_slug_unique": { - "name": "users_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - }, - "users_unsubscribeToken_unique": { - "name": "users_unsubscribeToken_unique", - "nullsNotDistinct": false, - "columns": [ - "unsubscribe_token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/backend/drizzle/meta/0002_snapshot.json b/backend/drizzle/meta/0002_snapshot.json deleted file mode 100644 index 87e67d41b..000000000 --- a/backend/drizzle/meta/0002_snapshot.json +++ /dev/null @@ -1,1623 +0,0 @@ -{ - "id": "8d539283-e38e-4a7f-bea3-4841aa6d3584", - "prevId": "97546b98-2c9e-4494-bd18-66fc4bb43284", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.attachments": { - "name": "attachments", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "group_id": { - "name": "group_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "content_type": { - "name": "content_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_content_type": { - "name": "converted_content_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "size": { - "name": "size", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "original_key": { - "name": "original_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_key": { - "name": "converted_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_key": { - "name": "thumbnail_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "attachments_organization_id_index": { - "name": "attachments_organization_id_index", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "attachments_created_by_users_id_fk": { - "name": "attachments_created_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_modified_by_users_id_fk": { - "name": "attachments_modified_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_organization_id_organizations_id_fk": { - "name": "attachments_organization_id_organizations_id_fk", - "tableFrom": "attachments", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.emails": { - "name": "emails", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "emails_token_id_tokens_id_fk": { - "name": "emails_token_id_tokens_id_fk", - "tableFrom": "emails", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "emails_user_id_users_id_fk": { - "name": "emails_user_id_users_id_fk", - "tableFrom": "emails", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "emails_email_unique": { - "name": "emails_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.memberships": { - "name": "memberships", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "context_type": { - "name": "context_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "activated_at": { - "name": "activated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "archived": { - "name": "archived", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "muted": { - "name": "muted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "order": { - "name": "order", - "type": "double precision", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "memberships_user_id_users_id_fk": { - "name": "memberships_user_id_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_token_id_tokens_id_fk": { - "name": "memberships_token_id_tokens_id_fk", - "tableFrom": "memberships", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_created_by_users_id_fk": { - "name": "memberships_created_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_modified_by_users_id_fk": { - "name": "memberships_modified_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_organization_id_organizations_id_fk": { - "name": "memberships_organization_id_organizations_id_fk", - "tableFrom": "memberships", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.oauth_accounts": { - "name": "oauth_accounts", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "provider_user_id": { - "name": "provider_user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "oauth_accounts_user_id_users_id_fk": { - "name": "oauth_accounts_user_id_users_id_fk", - "tableFrom": "oauth_accounts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "oauth_accounts_providerId_providerUserId_email_unique": { - "name": "oauth_accounts_providerId_providerUserId_email_unique", - "nullsNotDistinct": false, - "columns": [ - "provider_id", - "provider_user_id", - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'organization'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "short_name": { - "name": "short_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "timezone": { - "name": "timezone", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "default_language": { - "name": "default_language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "languages": { - "name": "languages", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[\"en\"]'::json" - }, - "restrictions": { - "name": "restrictions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"user\":1000,\"attachment\":100}'::json" - }, - "notification_email": { - "name": "notification_email", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email_domains": { - "name": "email_domains", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "color": { - "name": "color", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "website_url": { - "name": "website_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "welcome_text": { - "name": "welcome_text", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategies": { - "name": "auth_strategies", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "chat_support": { - "name": "chat_support", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "organizations_name_index": { - "name": "organizations_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_index": { - "name": "organizations_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organizations_created_by_users_id_fk": { - "name": "organizations_created_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "organizations_modified_by_users_id_fk": { - "name": "organizations_modified_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organizations_slug_unique": { - "name": "organizations_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkeys": { - "name": "passkeys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "device_name": { - "name": "device_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "device_type": { - "name": "device_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'desktop'" - }, - "device_os": { - "name": "device_os", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "browser": { - "name": "browser", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "name_on_device": { - "name": "name_on_device", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passkeys_user_id_users_id_fk": { - "name": "passkeys_user_id_users_id_fk", - "tableFrom": "passkeys", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passwords": { - "name": "passwords", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "passwords_user_id_users_id_fk": { - "name": "passwords_user_id_users_id_fk", - "tableFrom": "passwords", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "passwords_userId_unique": { - "name": "passwords_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.requests": { - "name": "requests", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "message": { - "name": "message", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "requests_emails": { - "name": "requests_emails", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "requests_created_at": { - "name": "requests_created_at", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "requests_token_id_tokens_id_fk": { - "name": "requests_token_id_tokens_id_fk", - "tableFrom": "requests", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'regular'" - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "device_name": { - "name": "device_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "device_type": { - "name": "device_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'desktop'" - }, - "device_os": { - "name": "device_os", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "browser": { - "name": "browser", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategy": { - "name": "auth_strategy", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tokens": { - "name": "tokens", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "oauth_account_id": { - "name": "oauth_account_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "consumed_at": { - "name": "consumed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "tokens_user_id_users_id_fk": { - "name": "tokens_user_id_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tokens_oauth_account_id_oauth_accounts_id_fk": { - "name": "tokens_oauth_account_id_oauth_accounts_id_fk", - "tableFrom": "tokens", - "tableTo": "oauth_accounts", - "columnsFrom": [ - "oauth_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_created_by_users_id_fk": { - "name": "tokens_created_by_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_organization_id_organizations_id_fk": { - "name": "tokens_organization_id_organizations_id_fk", - "tableFrom": "tokens", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.totps": { - "name": "totps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "encoder_secret_key": { - "name": "encoder_secret_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "totps_user_id_users_id_fk": { - "name": "totps_user_id_users_id_fk", - "tableFrom": "totps", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.unsubscribe_tokens": { - "name": "unsubscribe_tokens", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_token_index": { - "name": "users_token_index", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "unsubscribe_tokens_user_id_users_id_fk": { - "name": "unsubscribe_tokens_user_id_users_id_fk", - "tableFrom": "unsubscribe_tokens", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "unsubscribe_tokens_userId_unique": { - "name": "unsubscribe_tokens_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "unsubscribe_tokens_token_unique": { - "name": "unsubscribe_tokens_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "mfa_required": { - "name": "mfa_required", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "first_name": { - "name": "first_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_name": { - "name": "last_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "language": { - "name": "language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "newsletter": { - "name": "newsletter", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "user_flags": { - "name": "user_flags", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_started_at": { - "name": "last_started_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_sign_in_at": { - "name": "last_sign_in_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_name_index": { - "name": "users_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_index": { - "name": "users_email_index", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_index": { - "name": "users_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_modified_by_users_id_fk": { - "name": "users_modified_by_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_slug_unique": { - "name": "users_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/backend/drizzle/meta/0003_snapshot.json b/backend/drizzle/meta/0003_snapshot.json deleted file mode 100644 index 045478c65..000000000 --- a/backend/drizzle/meta/0003_snapshot.json +++ /dev/null @@ -1,1623 +0,0 @@ -{ - "id": "33efb0b2-266f-4d73-b64c-b01c6d5ab71b", - "prevId": "8d539283-e38e-4a7f-bea3-4841aa6d3584", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.attachments": { - "name": "attachments", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "group_id": { - "name": "group_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "content_type": { - "name": "content_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_content_type": { - "name": "converted_content_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "size": { - "name": "size", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "original_key": { - "name": "original_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_key": { - "name": "converted_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_key": { - "name": "thumbnail_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "attachments_organization_id_index": { - "name": "attachments_organization_id_index", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "attachments_created_by_users_id_fk": { - "name": "attachments_created_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_modified_by_users_id_fk": { - "name": "attachments_modified_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_organization_id_organizations_id_fk": { - "name": "attachments_organization_id_organizations_id_fk", - "tableFrom": "attachments", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.emails": { - "name": "emails", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "emails_token_id_tokens_id_fk": { - "name": "emails_token_id_tokens_id_fk", - "tableFrom": "emails", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "emails_user_id_users_id_fk": { - "name": "emails_user_id_users_id_fk", - "tableFrom": "emails", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "emails_email_unique": { - "name": "emails_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.memberships": { - "name": "memberships", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "context_type": { - "name": "context_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "activated_at": { - "name": "activated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "archived": { - "name": "archived", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "muted": { - "name": "muted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "order": { - "name": "order", - "type": "double precision", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "memberships_user_id_users_id_fk": { - "name": "memberships_user_id_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_token_id_tokens_id_fk": { - "name": "memberships_token_id_tokens_id_fk", - "tableFrom": "memberships", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_created_by_users_id_fk": { - "name": "memberships_created_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_modified_by_users_id_fk": { - "name": "memberships_modified_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_organization_id_organizations_id_fk": { - "name": "memberships_organization_id_organizations_id_fk", - "tableFrom": "memberships", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.oauth_accounts": { - "name": "oauth_accounts", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "provider_user_id": { - "name": "provider_user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "oauth_accounts_user_id_users_id_fk": { - "name": "oauth_accounts_user_id_users_id_fk", - "tableFrom": "oauth_accounts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "oauth_accounts_providerId_providerUserId_email_unique": { - "name": "oauth_accounts_providerId_providerUserId_email_unique", - "nullsNotDistinct": false, - "columns": [ - "provider_id", - "provider_user_id", - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'organization'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "short_name": { - "name": "short_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "timezone": { - "name": "timezone", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "default_language": { - "name": "default_language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "languages": { - "name": "languages", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[\"en\"]'::json" - }, - "restrictions": { - "name": "restrictions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"user\":1000,\"attachment\":100}'::json" - }, - "notification_email": { - "name": "notification_email", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email_domains": { - "name": "email_domains", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "color": { - "name": "color", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "website_url": { - "name": "website_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "welcome_text": { - "name": "welcome_text", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategies": { - "name": "auth_strategies", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "chat_support": { - "name": "chat_support", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "organizations_name_index": { - "name": "organizations_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_index": { - "name": "organizations_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organizations_created_by_users_id_fk": { - "name": "organizations_created_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "organizations_modified_by_users_id_fk": { - "name": "organizations_modified_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organizations_slug_unique": { - "name": "organizations_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkeys": { - "name": "passkeys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "device_name": { - "name": "device_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "device_type": { - "name": "device_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'desktop'" - }, - "device_os": { - "name": "device_os", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "browser": { - "name": "browser", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "name_on_device": { - "name": "name_on_device", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passkeys_user_id_users_id_fk": { - "name": "passkeys_user_id_users_id_fk", - "tableFrom": "passkeys", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passwords": { - "name": "passwords", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "passwords_user_id_users_id_fk": { - "name": "passwords_user_id_users_id_fk", - "tableFrom": "passwords", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "passwords_userId_unique": { - "name": "passwords_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.requests": { - "name": "requests", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "message": { - "name": "message", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "requests_emails": { - "name": "requests_emails", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "requests_created_at": { - "name": "requests_created_at", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "requests_token_id_tokens_id_fk": { - "name": "requests_token_id_tokens_id_fk", - "tableFrom": "requests", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'regular'" - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "device_name": { - "name": "device_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "device_type": { - "name": "device_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'desktop'" - }, - "device_os": { - "name": "device_os", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "browser": { - "name": "browser", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategy": { - "name": "auth_strategy", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tokens": { - "name": "tokens", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "oauth_account_id": { - "name": "oauth_account_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "consumed_at": { - "name": "consumed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "tokens_user_id_users_id_fk": { - "name": "tokens_user_id_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tokens_oauth_account_id_oauth_accounts_id_fk": { - "name": "tokens_oauth_account_id_oauth_accounts_id_fk", - "tableFrom": "tokens", - "tableTo": "oauth_accounts", - "columnsFrom": [ - "oauth_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_created_by_users_id_fk": { - "name": "tokens_created_by_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_organization_id_organizations_id_fk": { - "name": "tokens_organization_id_organizations_id_fk", - "tableFrom": "tokens", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.totps": { - "name": "totps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "totps_user_id_users_id_fk": { - "name": "totps_user_id_users_id_fk", - "tableFrom": "totps", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.unsubscribe_tokens": { - "name": "unsubscribe_tokens", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_token_index": { - "name": "users_token_index", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "unsubscribe_tokens_user_id_users_id_fk": { - "name": "unsubscribe_tokens_user_id_users_id_fk", - "tableFrom": "unsubscribe_tokens", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "unsubscribe_tokens_userId_unique": { - "name": "unsubscribe_tokens_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "unsubscribe_tokens_token_unique": { - "name": "unsubscribe_tokens_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "mfa_required": { - "name": "mfa_required", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "first_name": { - "name": "first_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_name": { - "name": "last_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "language": { - "name": "language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "newsletter": { - "name": "newsletter", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "user_flags": { - "name": "user_flags", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_started_at": { - "name": "last_started_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_sign_in_at": { - "name": "last_sign_in_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_name_index": { - "name": "users_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_index": { - "name": "users_email_index", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_index": { - "name": "users_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_modified_by_users_id_fk": { - "name": "users_modified_by_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_slug_unique": { - "name": "users_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/backend/drizzle/meta/0004_snapshot.json b/backend/drizzle/meta/0004_snapshot.json deleted file mode 100644 index 62282a2df..000000000 --- a/backend/drizzle/meta/0004_snapshot.json +++ /dev/null @@ -1,1636 +0,0 @@ -{ - "id": "30390beb-040f-4aa6-94d4-9bc369a9ad6f", - "prevId": "33efb0b2-266f-4d73-b64c-b01c6d5ab71b", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.attachments": { - "name": "attachments", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'attachment'" - }, - "public": { - "name": "public", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "bucket_name": { - "name": "bucket_name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "group_id": { - "name": "group_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "content_type": { - "name": "content_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_content_type": { - "name": "converted_content_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "size": { - "name": "size", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "original_key": { - "name": "original_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "converted_key": { - "name": "converted_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_key": { - "name": "thumbnail_key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "attachments_organization_id_index": { - "name": "attachments_organization_id_index", - "columns": [ - { - "expression": "organization_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "attachments_created_by_users_id_fk": { - "name": "attachments_created_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_modified_by_users_id_fk": { - "name": "attachments_modified_by_users_id_fk", - "tableFrom": "attachments", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "attachments_organization_id_organizations_id_fk": { - "name": "attachments_organization_id_organizations_id_fk", - "tableFrom": "attachments", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.emails": { - "name": "emails", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "emails_token_id_tokens_id_fk": { - "name": "emails_token_id_tokens_id_fk", - "tableFrom": "emails", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "emails_user_id_users_id_fk": { - "name": "emails_user_id_users_id_fk", - "tableFrom": "emails", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "emails_email_unique": { - "name": "emails_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.memberships": { - "name": "memberships", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "context_type": { - "name": "context_type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'member'" - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "activated_at": { - "name": "activated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "archived": { - "name": "archived", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "muted": { - "name": "muted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "order": { - "name": "order", - "type": "double precision", - "primaryKey": false, - "notNull": true - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "memberships_user_id_users_id_fk": { - "name": "memberships_user_id_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_token_id_tokens_id_fk": { - "name": "memberships_token_id_tokens_id_fk", - "tableFrom": "memberships", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "memberships_created_by_users_id_fk": { - "name": "memberships_created_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_modified_by_users_id_fk": { - "name": "memberships_modified_by_users_id_fk", - "tableFrom": "memberships", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "memberships_organization_id_organizations_id_fk": { - "name": "memberships_organization_id_organizations_id_fk", - "tableFrom": "memberships", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.oauth_accounts": { - "name": "oauth_accounts", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "provider_id": { - "name": "provider_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "provider_user_id": { - "name": "provider_user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "verified": { - "name": "verified", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "verified_at": { - "name": "verified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "oauth_accounts_user_id_users_id_fk": { - "name": "oauth_accounts_user_id_users_id_fk", - "tableFrom": "oauth_accounts", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "oauth_accounts_providerId_providerUserId_email_unique": { - "name": "oauth_accounts_providerId_providerUserId_email_unique", - "nullsNotDistinct": false, - "columns": [ - "provider_id", - "provider_user_id", - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.organizations": { - "name": "organizations", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'organization'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "short_name": { - "name": "short_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "timezone": { - "name": "timezone", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "default_language": { - "name": "default_language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "languages": { - "name": "languages", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[\"en\"]'::json" - }, - "restrictions": { - "name": "restrictions", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'{\"user\":1000,\"attachment\":100}'::json" - }, - "notification_email": { - "name": "notification_email", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email_domains": { - "name": "email_domains", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "color": { - "name": "color", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "logo_url": { - "name": "logo_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "website_url": { - "name": "website_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "welcome_text": { - "name": "welcome_text", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategies": { - "name": "auth_strategies", - "type": "json", - "primaryKey": false, - "notNull": true, - "default": "'[]'::json" - }, - "chat_support": { - "name": "chat_support", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "organizations_name_index": { - "name": "organizations_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "organizations_created_at_index": { - "name": "organizations_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "organizations_created_by_users_id_fk": { - "name": "organizations_created_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "organizations_modified_by_users_id_fk": { - "name": "organizations_modified_by_users_id_fk", - "tableFrom": "organizations", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "organizations_slug_unique": { - "name": "organizations_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passkeys": { - "name": "passkeys", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "credential_id": { - "name": "credential_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "public_key": { - "name": "public_key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "device_name": { - "name": "device_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "device_type": { - "name": "device_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'desktop'" - }, - "device_os": { - "name": "device_os", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "browser": { - "name": "browser", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "name_on_device": { - "name": "name_on_device", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "passkeys_user_id_users_id_fk": { - "name": "passkeys_user_id_users_id_fk", - "tableFrom": "passkeys", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.passwords": { - "name": "passwords", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "hashed_password": { - "name": "hashed_password", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "passwords_user_id_users_id_fk": { - "name": "passwords_user_id_users_id_fk", - "tableFrom": "passwords", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "passwords_userId_unique": { - "name": "passwords_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.requests": { - "name": "requests", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "message": { - "name": "message", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "token_id": { - "name": "token_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "requests_emails": { - "name": "requests_emails", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "requests_created_at": { - "name": "requests_created_at", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "requests_token_id_tokens_id_fk": { - "name": "requests_token_id_tokens_id_fk", - "tableFrom": "requests", - "tableTo": "tokens", - "columnsFrom": [ - "token_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.sessions": { - "name": "sessions", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'regular'" - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "device_name": { - "name": "device_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "device_type": { - "name": "device_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'desktop'" - }, - "device_os": { - "name": "device_os", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "browser": { - "name": "browser", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "auth_strategy": { - "name": "auth_strategy", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": {}, - "foreignKeys": { - "sessions_user_id_users_id_fk": { - "name": "sessions_user_id_users_id_fk", - "tableFrom": "sessions", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tokens": { - "name": "tokens", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "oauth_account_id": { - "name": "oauth_account_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "created_by": { - "name": "created_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "consumed_at": { - "name": "consumed_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "organization_id": { - "name": "organization_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "tokens_user_id_users_id_fk": { - "name": "tokens_user_id_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tokens_oauth_account_id_oauth_accounts_id_fk": { - "name": "tokens_oauth_account_id_oauth_accounts_id_fk", - "tableFrom": "tokens", - "tableTo": "oauth_accounts", - "columnsFrom": [ - "oauth_account_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_created_by_users_id_fk": { - "name": "tokens_created_by_users_id_fk", - "tableFrom": "tokens", - "tableTo": "users", - "columnsFrom": [ - "created_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "tokens_organization_id_organizations_id_fk": { - "name": "tokens_organization_id_organizations_id_fk", - "tableFrom": "tokens", - "tableTo": "organizations", - "columnsFrom": [ - "organization_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.totps": { - "name": "totps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "secret": { - "name": "secret", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "totps_user_id_users_id_fk": { - "name": "totps_user_id_users_id_fk", - "tableFrom": "totps", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.unsubscribe_tokens": { - "name": "unsubscribe_tokens", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "token": { - "name": "token", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "users_token_index": { - "name": "users_token_index", - "columns": [ - { - "expression": "token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "unsubscribe_tokens_user_id_users_id_fk": { - "name": "unsubscribe_tokens_user_id_users_id_fk", - "tableFrom": "unsubscribe_tokens", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "unsubscribe_tokens_userId_unique": { - "name": "unsubscribe_tokens_userId_unique", - "nullsNotDistinct": false, - "columns": [ - "user_id" - ] - }, - "unsubscribe_tokens_token_unique": { - "name": "unsubscribe_tokens_token_unique", - "nullsNotDistinct": false, - "columns": [ - "token" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "entity_type": { - "name": "entity_type", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail_url": { - "name": "thumbnail_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "banner_url": { - "name": "banner_url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "mfa_required": { - "name": "mfa_required", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "first_name": { - "name": "first_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_name": { - "name": "last_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "language": { - "name": "language", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'en'" - }, - "newsletter": { - "name": "newsletter", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "role": { - "name": "role", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'user'" - }, - "user_flags": { - "name": "user_flags", - "type": "jsonb", - "primaryKey": false, - "notNull": true, - "default": "'{}'::jsonb" - }, - "modified_at": { - "name": "modified_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_seen_at": { - "name": "last_seen_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_started_at": { - "name": "last_started_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "last_sign_in_at": { - "name": "last_sign_in_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "modified_by": { - "name": "modified_by", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_name_index": { - "name": "users_name_index", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_index": { - "name": "users_email_index", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_index": { - "name": "users_created_at_index", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": false, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_modified_by_users_id_fk": { - "name": "users_modified_by_users_id_fk", - "tableFrom": "users", - "tableTo": "users", - "columnsFrom": [ - "modified_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "users_slug_unique": { - "name": "users_slug_unique", - "nullsNotDistinct": false, - "columns": [ - "slug" - ] - }, - "users_email_unique": { - "name": "users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": {}, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/backend/drizzle/meta/_journal.json b/backend/drizzle/meta/_journal.json index 891e07c6b..dc9770bc7 100644 --- a/backend/drizzle/meta/_journal.json +++ b/backend/drizzle/meta/_journal.json @@ -5,36 +5,8 @@ { "idx": 0, "version": "7", - "when": 1754054715288, - "tag": "0000_sad_paladin", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1755512487230, - "tag": "0001_illegal_odin", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1757659972233, - "tag": "0002_nosy_white_tiger", - "breakpoints": true - }, - { - "idx": 3, - "version": "7", - "when": 1757668232647, - "tag": "0003_salty_raider", - "breakpoints": true - }, - { - "idx": 4, - "version": "7", - "when": 1757935286009, - "tag": "0004_flaky_charles_xavier", + "when": 1758835199217, + "tag": "0000_modern_black_queen", "breakpoints": true } ] diff --git a/backend/emails/account-security.tsx b/backend/emails/account-security.tsx new file mode 100644 index 000000000..1dab77e11 --- /dev/null +++ b/backend/emails/account-security.tsx @@ -0,0 +1,51 @@ +import { appConfig } from 'config'; +import i18n from 'i18next'; +import { Text } from 'jsx-email'; +import type { BasicTemplateType } from '../src/lib/mailer'; +import { AppLogo } from './components/app-logo'; +import { EmailContainer } from './components/container'; +import { EmailBody } from './components/email-body'; +import { EmailHeader } from './components/email-header'; +import { Footer } from './components/footer'; + +export type AccountSecurityType = + | 'mfa-enabled' + | 'mfa-disabled' + | 'wrong-password-lockout'; + +export interface AccountSecurityProps extends BasicTemplateType { + name: string; + type: AccountSecurityType; + details?: Record; // Optional extra details for dynamic messages +} + +export const AccountSecurity = ({ + lng, + name, + type, + details, +}: AccountSecurityProps) => { + // Base properties for all i18n calls + const baseProps = { lng, appName: appConfig.name }; + + const previewText = i18n.t(`backend:emails.account_security.preview`, { ...baseProps, name }); + + const headerText = i18n.t(`backend:emails.account_security.${type}.title`, baseProps); + const bodyText = i18n.t(`backend:emails.account_security.${type}.text`, { ...baseProps, ...details }); + + return ( + + + + + + + + +