diff --git a/backend/drizzle.config.ts b/backend/drizzle.config.ts index 97fe8f31c..ef5ed11de 100644 --- a/backend/drizzle.config.ts +++ b/backend/drizzle.config.ts @@ -4,6 +4,9 @@ import { DATABASE_ENVS } from "@/database/client"; export default defineConfig({ dialect: "postgresql", - dbCredentials: DATABASE_ENVS, + dbCredentials: { + ...DATABASE_ENVS, + ssl: false + }, schema: "./src/plugins/**/admin/database/schema/*.ts" }); diff --git a/backend/schema.gql b/backend/schema.gql index 87d22659d..f3596b919 100644 --- a/backend/schema.gql +++ b/backend/schema.gql @@ -124,6 +124,14 @@ type GroupUser { name: [TextLanguage!]! } +input GroupsPermissionsCreatePluginCategories { + can_create: Boolean! + can_download_files: Boolean! + can_read: Boolean! + can_reply: Boolean! + group_id: Int! +} + type HslColor { h: Int! l: Int! @@ -153,7 +161,7 @@ type LayoutAdminInstallObj { } type Mutation { - admin__blog_categories__create(color: String!, description: [TextLanguageInput!]!, name: [TextLanguageInput!]!): ShowBlogCategories! + admin__blog_categories__create(color: String!, description: [TextLanguageInput!]!, name: [TextLanguageInput!]!, permissions: PermissionsCreatePluginCategories!): ShowBlogCategories! admin__core_email_settings__edit(color_primary: String!, color_primary_foreground: String!, smtp_host: String!, smtp_password: String!, smtp_port: Int!, smtp_secure: Boolean!, smtp_user: String!): ShowAdminEmailSettingsServiceObj! admin__core_email_settings__test(from: String!, message: String!, subject: String!, to: String!): String! admin__core_files__delete(id: Int!): String! @@ -218,6 +226,14 @@ type PageInfo { totalCount: Float! } +input PermissionsCreatePluginCategories { + can_all_create: Boolean! + can_all_download_files: Boolean! + can_all_read: Boolean! + can_all_reply: Boolean! + groups: [GroupsPermissionsCreatePluginCategories!]! +} + type Query { admin__core_email_settings__show: ShowAdminEmailSettingsServiceObj! admin__core_files__show(cursor: Int, first: Int, last: Int, search: String, sortBy: ShowCoreFilesSortByArgs): ShowAdminFilesObj! diff --git a/backend/src/plugins/blog/admin/categories/create/create.service.ts b/backend/src/plugins/blog/admin/categories/create/create.service.ts index d56b354ca..7c52ce0b6 100644 --- a/backend/src/plugins/blog/admin/categories/create/create.service.ts +++ b/backend/src/plugins/blog/admin/categories/create/create.service.ts @@ -6,7 +6,8 @@ import { ShowBlogCategories } from "@/plugins/blog/categories/show/dto/show.obj" import { blog_categories, blog_categories_description, - blog_categories_name + blog_categories_name, + blog_categories_permissions } from "../../database/schema/categories"; import { ParserTextLanguageCoreHelpersService } from "@/plugins/core/helpers/text_language/parser/parser.service"; import { DatabaseService } from "@/database/database.service"; @@ -21,11 +22,12 @@ export class CreateBlogCategoriesService { async create({ color, description, - name + name, + permissions }: CreatePluginCategoriesArgs): Promise { const categories = await this.databaseService.db .insert(blog_categories) - .values({ color }) + .values({ color, ...permissions }) .returning(); const categoryId = categories[0].id; @@ -50,6 +52,17 @@ export class CreateBlogCategoriesService { } }); + // Set permissions + if (permissions.groups.length > 0) { + await this.databaseService.db.insert(blog_categories_permissions).values( + permissions.groups.map(item => ({ + blog_id: data[0].id, + group_id: item.group_id, + ...item + })) + ); + } + return data; } } diff --git a/backend/src/plugins/blog/admin/categories/create/dto/create.args.ts b/backend/src/plugins/blog/admin/categories/create/dto/create.args.ts index 58ef5b60d..c02e6bde1 100644 --- a/backend/src/plugins/blog/admin/categories/create/dto/create.args.ts +++ b/backend/src/plugins/blog/admin/categories/create/dto/create.args.ts @@ -1,4 +1,4 @@ -import { ArgsType, Field } from "@nestjs/graphql"; +import { ArgsType, Field, InputType, Int } from "@nestjs/graphql"; import { Transform } from "class-transformer"; import { ArrayMinSize, ValidateNested, IsArray } from "class-validator"; import { @@ -7,6 +7,42 @@ import { TransformTextLanguageInput } from "@vitnode/backend"; +@InputType() +class GroupsPermissionsCreatePluginCategories { + @Field(() => Int) + group_id: number; + + @Field(() => Boolean) + can_read: boolean; + + @Field(() => Boolean) + can_create: boolean; + + @Field(() => Boolean) + can_reply: boolean; + + @Field(() => Boolean) + can_download_files: boolean; +} + +@InputType() +export class PermissionsCreatePluginCategories { + @Field(() => Boolean) + can_all_read: boolean; + + @Field(() => Boolean) + can_all_create: boolean; + + @Field(() => Boolean) + can_all_reply: boolean; + + @Field(() => Boolean) + can_all_download_files: boolean; + + @Field(() => [GroupsPermissionsCreatePluginCategories]) + groups: GroupsPermissionsCreatePluginCategories[]; +} + @ArgsType() export class CreatePluginCategoriesArgs { @IsArray() @@ -25,4 +61,7 @@ export class CreatePluginCategoriesArgs { @Field(() => String) color: string; + + @Field(() => PermissionsCreatePluginCategories) + permissions: PermissionsCreatePluginCategories; } diff --git a/backend/src/plugins/blog/admin/database/migrations/0000_daily_mysterio.sql b/backend/src/plugins/blog/admin/database/migrations/0000_tranquil_cammi.sql similarity index 69% rename from backend/src/plugins/blog/admin/database/migrations/0000_daily_mysterio.sql rename to backend/src/plugins/blog/admin/database/migrations/0000_tranquil_cammi.sql index 5564a614e..6923b65da 100644 --- a/backend/src/plugins/blog/admin/database/migrations/0000_daily_mysterio.sql +++ b/backend/src/plugins/blog/admin/database/migrations/0000_tranquil_cammi.sql @@ -25,7 +25,11 @@ CREATE TABLE IF NOT EXISTS "blog_categories" ( "id" serial PRIMARY KEY NOT NULL, "created" timestamp DEFAULT now() NOT NULL, "position" integer DEFAULT 0 NOT NULL, - "color" varchar(30) DEFAULT '' NOT NULL + "color" varchar(30) DEFAULT '' NOT NULL, + "can_all_read" boolean DEFAULT true NOT NULL, + "can_all_create" boolean DEFAULT true NOT NULL, + "can_all_reply" boolean DEFAULT true NOT NULL, + "can_all_download_files" boolean DEFAULT true NOT NULL ); --> statement-breakpoint CREATE TABLE IF NOT EXISTS "blog_categories_description" ( @@ -42,6 +46,16 @@ CREATE TABLE IF NOT EXISTS "blog_categories_name" ( "value" varchar(100) NOT NULL ); --> statement-breakpoint +CREATE TABLE IF NOT EXISTS "blog_categories_permissions" ( + "id" serial PRIMARY KEY NOT NULL, + "blog_id" integer, + "group_id" integer, + "can_read" boolean DEFAULT false NOT NULL, + "can_create" boolean DEFAULT false NOT NULL, + "can_reply" boolean DEFAULT false NOT NULL, + "can_download_files" boolean DEFAULT false NOT NULL +); +--> statement-breakpoint DO $$ BEGIN ALTER TABLE "blog_articles" ADD CONSTRAINT "blog_articles_author_id_core_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."core_users"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION @@ -102,13 +116,27 @@ EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_author_id_idx" ON "blog_articles" ("author_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_category_id_idx" ON "blog_articles" ("category_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_content_item_id_idx" ON "blog_articles_content" ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_content_language_code_idx" ON "blog_articles_content" ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_title_item_id_idx" ON "blog_articles_title" ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_title_language_code_idx" ON "blog_articles_title" ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_description_item_id_idx" ON "blog_categories_description" ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_description_language_code_idx" ON "blog_categories_description" ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_name_item_id_idx" ON "blog_categories_name" ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_name_language_code_idx" ON "blog_categories_name" ("language_code"); \ No newline at end of file +DO $$ BEGIN + ALTER TABLE "blog_categories_permissions" ADD CONSTRAINT "blog_categories_permissions_blog_id_blog_categories_id_fk" FOREIGN KEY ("blog_id") REFERENCES "public"."blog_categories"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "blog_categories_permissions" ADD CONSTRAINT "blog_categories_permissions_group_id_core_groups_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."core_groups"("id") ON DELETE cascade ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_articles_author_id_idx" ON "blog_articles" USING btree ("author_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_articles_category_id_idx" ON "blog_articles" USING btree ("category_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_articles_content_item_id_idx" ON "blog_articles_content" USING btree ("item_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_articles_content_language_code_idx" ON "blog_articles_content" USING btree ("language_code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_articles_title_item_id_idx" ON "blog_articles_title" USING btree ("item_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_articles_title_language_code_idx" ON "blog_articles_title" USING btree ("language_code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_categories_description_item_id_idx" ON "blog_categories_description" USING btree ("item_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_categories_description_language_code_idx" ON "blog_categories_description" USING btree ("language_code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_categories_name_item_id_idx" ON "blog_categories_name" USING btree ("item_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_categories_name_language_code_idx" ON "blog_categories_name" USING btree ("language_code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_categories_permissions_blog_id_idx" ON "blog_categories_permissions" USING btree ("blog_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "blog_categories_permissions_group_id_idx" ON "blog_categories_permissions" USING btree ("group_id"); \ No newline at end of file diff --git a/backend/src/plugins/blog/admin/database/migrations/0001_material_echo.sql b/backend/src/plugins/blog/admin/database/migrations/0001_material_echo.sql deleted file mode 100644 index 0e429d2cd..000000000 --- a/backend/src/plugins/blog/admin/database/migrations/0001_material_echo.sql +++ /dev/null @@ -1,20 +0,0 @@ -DROP INDEX IF EXISTS "blog_articles_author_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_articles_category_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_articles_content_item_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_articles_content_language_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_articles_title_item_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_articles_title_language_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_categories_description_item_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_categories_description_language_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_categories_name_item_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "blog_categories_name_language_code_idx";--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_author_id_idx" ON "blog_articles" USING btree ("author_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_category_id_idx" ON "blog_articles" USING btree ("category_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_content_item_id_idx" ON "blog_articles_content" USING btree ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_content_language_code_idx" ON "blog_articles_content" USING btree ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_title_item_id_idx" ON "blog_articles_title" USING btree ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_articles_title_language_code_idx" ON "blog_articles_title" USING btree ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_description_item_id_idx" ON "blog_categories_description" USING btree ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_description_language_code_idx" ON "blog_categories_description" USING btree ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_name_item_id_idx" ON "blog_categories_name" USING btree ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "blog_categories_name_language_code_idx" ON "blog_categories_name" USING btree ("language_code"); \ No newline at end of file diff --git a/backend/src/plugins/blog/admin/database/migrations/meta/0000_snapshot.json b/backend/src/plugins/blog/admin/database/migrations/meta/0000_snapshot.json index 8f4c6a14d..1b0e4d734 100644 --- a/backend/src/plugins/blog/admin/database/migrations/meta/0000_snapshot.json +++ b/backend/src/plugins/blog/admin/database/migrations/meta/0000_snapshot.json @@ -1,4 +1,6 @@ { + "id": "d4e6a839-6ecd-4994-b78c-af69b8999303", + "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { @@ -47,6 +49,7 @@ }, "indexes": { "blog_articles_author_id_idx": { + "name": "blog_articles_author_id_idx", "columns": [ { "expression": "author_id", @@ -55,12 +58,13 @@ "nulls": "last" } ], - "name": "blog_articles_author_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "blog_articles_category_id_idx": { + "name": "blog_articles_category_id_idx", "columns": [ { "expression": "category_id", @@ -69,38 +73,38 @@ "nulls": "last" } ], - "name": "blog_articles_category_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "blog_articles_author_id_core_users_id_fk": { "name": "blog_articles_author_id_core_users_id_fk", "tableFrom": "blog_articles", + "tableTo": "core_users", "columnsFrom": [ "author_id" ], - "tableTo": "core_users", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "blog_articles_category_id_blog_categories_id_fk": { "name": "blog_articles_category_id_blog_categories_id_fk", "tableFrom": "blog_articles", + "tableTo": "blog_categories", "columnsFrom": [ "category_id" ], - "tableTo": "blog_categories", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -137,6 +141,7 @@ }, "indexes": { "blog_articles_content_item_id_idx": { + "name": "blog_articles_content_item_id_idx", "columns": [ { "expression": "item_id", @@ -145,12 +150,13 @@ "nulls": "last" } ], - "name": "blog_articles_content_item_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "blog_articles_content_language_code_idx": { + "name": "blog_articles_content_language_code_idx", "columns": [ { "expression": "language_code", @@ -159,38 +165,38 @@ "nulls": "last" } ], - "name": "blog_articles_content_language_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "blog_articles_content_item_id_blog_articles_id_fk": { "name": "blog_articles_content_item_id_blog_articles_id_fk", "tableFrom": "blog_articles_content", + "tableTo": "blog_articles", "columnsFrom": [ "item_id" ], - "tableTo": "blog_articles", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "blog_articles_content_language_code_core_languages_code_fk": { "name": "blog_articles_content_language_code_core_languages_code_fk", "tableFrom": "blog_articles_content", + "tableTo": "core_languages", "columnsFrom": [ "language_code" ], - "tableTo": "core_languages", "columnsTo": [ "code" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -227,6 +233,7 @@ }, "indexes": { "blog_articles_title_item_id_idx": { + "name": "blog_articles_title_item_id_idx", "columns": [ { "expression": "item_id", @@ -235,12 +242,13 @@ "nulls": "last" } ], - "name": "blog_articles_title_item_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "blog_articles_title_language_code_idx": { + "name": "blog_articles_title_language_code_idx", "columns": [ { "expression": "language_code", @@ -249,38 +257,38 @@ "nulls": "last" } ], - "name": "blog_articles_title_language_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "blog_articles_title_item_id_blog_articles_id_fk": { "name": "blog_articles_title_item_id_blog_articles_id_fk", "tableFrom": "blog_articles_title", + "tableTo": "blog_articles", "columnsFrom": [ "item_id" ], - "tableTo": "blog_articles", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "blog_articles_title_language_code_core_languages_code_fk": { "name": "blog_articles_title_language_code_core_languages_code_fk", "tableFrom": "blog_articles_title", + "tableTo": "core_languages", "columnsFrom": [ "language_code" ], - "tableTo": "core_languages", "columnsTo": [ "code" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -316,6 +324,34 @@ "primaryKey": false, "notNull": true, "default": "''" + }, + "can_all_read": { + "name": "can_all_read", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "can_all_create": { + "name": "can_all_create", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "can_all_reply": { + "name": "can_all_reply", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "can_all_download_files": { + "name": "can_all_download_files", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true } }, "indexes": {}, @@ -354,6 +390,7 @@ }, "indexes": { "blog_categories_description_item_id_idx": { + "name": "blog_categories_description_item_id_idx", "columns": [ { "expression": "item_id", @@ -362,12 +399,13 @@ "nulls": "last" } ], - "name": "blog_categories_description_item_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "blog_categories_description_language_code_idx": { + "name": "blog_categories_description_language_code_idx", "columns": [ { "expression": "language_code", @@ -376,38 +414,38 @@ "nulls": "last" } ], - "name": "blog_categories_description_language_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "blog_categories_description_item_id_blog_categories_id_fk": { "name": "blog_categories_description_item_id_blog_categories_id_fk", "tableFrom": "blog_categories_description", + "tableTo": "blog_categories", "columnsFrom": [ "item_id" ], - "tableTo": "blog_categories", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "blog_categories_description_language_code_core_languages_code_fk": { "name": "blog_categories_description_language_code_core_languages_code_fk", "tableFrom": "blog_categories_description", + "tableTo": "core_languages", "columnsFrom": [ "language_code" ], - "tableTo": "core_languages", "columnsTo": [ "code" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -444,6 +482,7 @@ }, "indexes": { "blog_categories_name_item_id_idx": { + "name": "blog_categories_name_item_id_idx", "columns": [ { "expression": "item_id", @@ -452,12 +491,13 @@ "nulls": "last" } ], - "name": "blog_categories_name_item_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "blog_categories_name_language_code_idx": { + "name": "blog_categories_name_language_code_idx", "columns": [ { "expression": "language_code", @@ -466,38 +506,152 @@ "nulls": "last" } ], - "name": "blog_categories_name_language_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "blog_categories_name_item_id_blog_categories_id_fk": { "name": "blog_categories_name_item_id_blog_categories_id_fk", "tableFrom": "blog_categories_name", + "tableTo": "blog_categories", "columnsFrom": [ "item_id" ], - "tableTo": "blog_categories", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "blog_categories_name_language_code_core_languages_code_fk": { "name": "blog_categories_name_language_code_core_languages_code_fk", "tableFrom": "blog_categories_name", + "tableTo": "core_languages", "columnsFrom": [ "language_code" ], - "tableTo": "core_languages", "columnsTo": [ "code" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.blog_categories_permissions": { + "name": "blog_categories_permissions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "serial", + "primaryKey": true, + "notNull": true + }, + "blog_id": { + "name": "blog_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "group_id": { + "name": "group_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "can_read": { + "name": "can_read", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "can_create": { + "name": "can_create", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "can_reply": { + "name": "can_reply", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "can_download_files": { + "name": "can_download_files", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "blog_categories_permissions_blog_id_idx": { + "name": "blog_categories_permissions_blog_id_idx", + "columns": [ + { + "expression": "blog_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "blog_categories_permissions_group_id_idx": { + "name": "blog_categories_permissions_group_id_idx", + "columns": [ + { + "expression": "group_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "blog_categories_permissions_blog_id_blog_categories_id_fk": { + "name": "blog_categories_permissions_blog_id_blog_categories_id_fk", + "tableFrom": "blog_categories_permissions", + "tableTo": "blog_categories", + "columnsFrom": [ + "blog_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "blog_categories_permissions_group_id_core_groups_id_fk": { + "name": "blog_categories_permissions_group_id_core_groups_id_fk", + "tableFrom": "blog_categories_permissions", + "tableTo": "core_groups", + "columnsFrom": [ + "group_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -507,10 +661,8 @@ "enums": {}, "schemas": {}, "_meta": { + "columns": {}, "schemas": {}, - "tables": {}, - "columns": {} - }, - "id": "b9352647-e626-42c0-b2f8-e3fb7446391f", - "prevId": "00000000-0000-0000-0000-000000000000" + "tables": {} + } } \ No newline at end of file diff --git a/backend/src/plugins/blog/admin/database/migrations/meta/0001_snapshot.json b/backend/src/plugins/blog/admin/database/migrations/meta/0001_snapshot.json deleted file mode 100644 index c63cd5327..000000000 --- a/backend/src/plugins/blog/admin/database/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,526 +0,0 @@ -{ - "id": "a459b50f-2acf-4366-8848-e44264fbe117", - "prevId": "b9352647-e626-42c0-b2f8-e3fb7446391f", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.blog_articles": { - "name": "blog_articles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "author_id": { - "name": "author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "category_id": { - "name": "category_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "update": { - "name": "update", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(45)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "blog_articles_author_id_idx": { - "name": "blog_articles_author_id_idx", - "columns": [ - { - "expression": "author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blog_articles_category_id_idx": { - "name": "blog_articles_category_id_idx", - "columns": [ - { - "expression": "category_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blog_articles_author_id_core_users_id_fk": { - "name": "blog_articles_author_id_core_users_id_fk", - "tableFrom": "blog_articles", - "tableTo": "core_users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blog_articles_category_id_blog_categories_id_fk": { - "name": "blog_articles_category_id_blog_categories_id_fk", - "tableFrom": "blog_articles", - "tableTo": "blog_categories", - "columnsFrom": [ - "category_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.blog_articles_content": { - "name": "blog_articles_content", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "language_code": { - "name": "language_code", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "blog_articles_content_item_id_idx": { - "name": "blog_articles_content_item_id_idx", - "columns": [ - { - "expression": "item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blog_articles_content_language_code_idx": { - "name": "blog_articles_content_language_code_idx", - "columns": [ - { - "expression": "language_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blog_articles_content_item_id_blog_articles_id_fk": { - "name": "blog_articles_content_item_id_blog_articles_id_fk", - "tableFrom": "blog_articles_content", - "tableTo": "blog_articles", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blog_articles_content_language_code_core_languages_code_fk": { - "name": "blog_articles_content_language_code_core_languages_code_fk", - "tableFrom": "blog_articles_content", - "tableTo": "core_languages", - "columnsFrom": [ - "language_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.blog_articles_title": { - "name": "blog_articles_title", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "language_code": { - "name": "language_code", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "blog_articles_title_item_id_idx": { - "name": "blog_articles_title_item_id_idx", - "columns": [ - { - "expression": "item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blog_articles_title_language_code_idx": { - "name": "blog_articles_title_language_code_idx", - "columns": [ - { - "expression": "language_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blog_articles_title_item_id_blog_articles_id_fk": { - "name": "blog_articles_title_item_id_blog_articles_id_fk", - "tableFrom": "blog_articles_title", - "tableTo": "blog_articles", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blog_articles_title_language_code_core_languages_code_fk": { - "name": "blog_articles_title_language_code_core_languages_code_fk", - "tableFrom": "blog_articles_title", - "tableTo": "core_languages", - "columnsFrom": [ - "language_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.blog_categories": { - "name": "blog_categories", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "position": { - "name": "position", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "color": { - "name": "color", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "''" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.blog_categories_description": { - "name": "blog_categories_description", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "language_code": { - "name": "language_code", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "blog_categories_description_item_id_idx": { - "name": "blog_categories_description_item_id_idx", - "columns": [ - { - "expression": "item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blog_categories_description_language_code_idx": { - "name": "blog_categories_description_language_code_idx", - "columns": [ - { - "expression": "language_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blog_categories_description_item_id_blog_categories_id_fk": { - "name": "blog_categories_description_item_id_blog_categories_id_fk", - "tableFrom": "blog_categories_description", - "tableTo": "blog_categories", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blog_categories_description_language_code_core_languages_code_fk": { - "name": "blog_categories_description_language_code_core_languages_code_fk", - "tableFrom": "blog_categories_description", - "tableTo": "core_languages", - "columnsFrom": [ - "language_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.blog_categories_name": { - "name": "blog_categories_name", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "language_code": { - "name": "language_code", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "blog_categories_name_item_id_idx": { - "name": "blog_categories_name_item_id_idx", - "columns": [ - { - "expression": "item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "blog_categories_name_language_code_idx": { - "name": "blog_categories_name_language_code_idx", - "columns": [ - { - "expression": "language_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "blog_categories_name_item_id_blog_categories_id_fk": { - "name": "blog_categories_name_item_id_blog_categories_id_fk", - "tableFrom": "blog_categories_name", - "tableTo": "blog_categories", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "blog_categories_name_language_code_core_languages_code_fk": { - "name": "blog_categories_name_language_code_core_languages_code_fk", - "tableFrom": "blog_categories_name", - "tableTo": "core_languages", - "columnsFrom": [ - "language_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/backend/src/plugins/blog/admin/database/migrations/meta/_journal.json b/backend/src/plugins/blog/admin/database/migrations/meta/_journal.json index 9942ce876..4555715aa 100644 --- a/backend/src/plugins/blog/admin/database/migrations/meta/_journal.json +++ b/backend/src/plugins/blog/admin/database/migrations/meta/_journal.json @@ -1,19 +1,12 @@ { - "version": "6", + "version": "7", "dialect": "postgresql", "entries": [ { "idx": 0, - "version": "6", - "when": 1716390721901, - "tag": "0000_daily_mysterio", - "breakpoints": true - }, - { - "idx": 1, "version": "7", - "when": 1717837267320, - "tag": "0001_material_echo", + "when": 1718618177227, + "tag": "0000_tranquil_cammi", "breakpoints": true } ] diff --git a/backend/src/plugins/blog/admin/database/schema/categories.ts b/backend/src/plugins/blog/admin/database/schema/categories.ts index dc05023f1..e66ea98b0 100644 --- a/backend/src/plugins/blog/admin/database/schema/categories.ts +++ b/backend/src/plugins/blog/admin/database/schema/categories.ts @@ -1,4 +1,5 @@ import { + boolean, index, integer, pgTable, @@ -11,12 +12,19 @@ import { relations } from "drizzle-orm"; import { blog_articles } from "./articles"; import { core_languages } from "@/plugins/core/admin/database/schema/languages"; +import { core_groups } from "@/plugins/core/admin/database/schema/groups"; export const blog_categories = pgTable("blog_categories", { id: serial("id").primaryKey(), created: timestamp("created").notNull().defaultNow(), position: integer("position").notNull().default(0), - color: varchar("color", { length: 30 }).notNull().default("") + color: varchar("color", { length: 30 }).notNull().default(""), + can_all_read: boolean("can_all_read").notNull().default(true), + can_all_create: boolean("can_all_create").notNull().default(true), + can_all_reply: boolean("can_all_reply").notNull().default(true), + can_all_download_files: boolean("can_all_download_files") + .notNull() + .default(true) }); export const blog_categories_relations = relations( @@ -24,7 +32,8 @@ export const blog_categories_relations = relations( ({ many }) => ({ articles: many(blog_articles), name: many(blog_categories_name), - description: many(blog_categories_description) + description: many(blog_categories_description), + permissions: many(blog_categories_permissions) }) ); @@ -93,3 +102,28 @@ export const blog_categories_description_relations = relations( }) }) ); + +export const blog_categories_permissions = pgTable( + "blog_categories_permissions", + { + id: serial("id").primaryKey(), + blog_id: integer("blog_id").references(() => blog_categories.id, { + onDelete: "cascade" + }), + group_id: integer("group_id").references(() => core_groups.id, { + onDelete: "cascade" + }), + can_read: boolean("can_read").notNull().default(false), + can_create: boolean("can_create").notNull().default(false), + can_reply: boolean("can_reply").notNull().default(false), + can_download_files: boolean("can_download_files").notNull().default(false) + }, + table => ({ + blog_id_idx: index("blog_categories_permissions_blog_id_idx").on( + table.blog_id + ), + group_id_idx: index("blog_categories_permissions_group_id_idx").on( + table.group_id + ) + }) +); diff --git a/backend/src/plugins/core/admin/database/migrations/0000_fine_supernaut.sql b/backend/src/plugins/core/admin/database/migrations/0000_yielding_bloodstrike.sql similarity index 89% rename from backend/src/plugins/core/admin/database/migrations/0000_fine_supernaut.sql rename to backend/src/plugins/core/admin/database/migrations/0000_yielding_bloodstrike.sql index 5f187f96c..a248274fe 100644 --- a/backend/src/plugins/core/admin/database/migrations/0000_fine_supernaut.sql +++ b/backend/src/plugins/core/admin/database/migrations/0000_yielding_bloodstrike.sql @@ -171,7 +171,7 @@ CREATE TABLE IF NOT EXISTS "core_files_avatars" ( "id" serial PRIMARY KEY NOT NULL, "dir_folder" varchar(255) NOT NULL, "file_name" varchar(255) NOT NULL, - "created" integer NOT NULL, + "created" timestamp DEFAULT now() NOT NULL, "file_size" integer NOT NULL, "mimetype" varchar(255) NOT NULL, "extension" varchar(32) NOT NULL, @@ -193,6 +193,7 @@ CREATE TABLE IF NOT EXISTS "core_users" ( "last_name" varchar(255), "birthday" timestamp, "ip_address" varchar(255) NOT NULL, + "language" varchar(5) DEFAULT 'en' NOT NULL, CONSTRAINT "core_users_name_seo_unique" UNIQUE("name_seo"), CONSTRAINT "core_users_name_unique" UNIQUE("name"), CONSTRAINT "core_users_email_unique" UNIQUE("email") @@ -306,27 +307,27 @@ EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_permissions_group_id_idx" ON "core_admin_permissions" ("group_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_permissions_user_id_idx" ON "core_admin_permissions" ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_sessions_login_token_idx" ON "core_admin_sessions" ("login_token");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_sessions_user_id_idx" ON "core_admin_sessions" ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_files_user_id_idx" ON "core_files" ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_files_using_file_id_idx" ON "core_files_using" ("file_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_groups_names_item_id_idx" ON "core_groups_names" ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_groups_names_language_code_idx" ON "core_groups_names" ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_languages_code_idx" ON "core_languages" ("code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_languages_name_idx" ON "core_languages" ("name");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_moderators_permissions_group_id_idx" ON "core_moderators_permissions" ("group_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_moderators_permissions_user_id_idx" ON "core_moderators_permissions" ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_parent_id_idx" ON "core_nav" ("parent_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_description_item_id_idx" ON "core_nav_description" ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_description_language_code_idx" ON "core_nav_description" ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_name_item_id_idx" ON "core_nav_name" ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_name_language_code_idx" ON "core_nav_name" ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_plugins_code_idx" ON "core_plugins" ("code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_plugins_name_idx" ON "core_plugins" ("name");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_sessions_user_id_idx" ON "core_sessions" ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_sessions_known_devices_ip_address_idx" ON "core_sessions_known_devices" ("ip_address");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_users_name_seo_idx" ON "core_users" ("name_seo");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_users_name_idx" ON "core_users" ("name");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_users_email_idx" ON "core_users" ("email"); \ No newline at end of file +CREATE INDEX IF NOT EXISTS "core_admin_permissions_group_id_idx" ON "core_admin_permissions" USING btree ("group_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_admin_permissions_user_id_idx" ON "core_admin_permissions" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_admin_sessions_login_token_idx" ON "core_admin_sessions" USING btree ("login_token");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_admin_sessions_user_id_idx" ON "core_admin_sessions" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_files_user_id_idx" ON "core_files" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_files_using_file_id_idx" ON "core_files_using" USING btree ("file_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_groups_names_item_id_idx" ON "core_groups_names" USING btree ("item_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_groups_names_language_code_idx" ON "core_groups_names" USING btree ("language_code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_languages_code_idx" ON "core_languages" USING btree ("code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_languages_name_idx" ON "core_languages" USING btree ("name");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_moderators_permissions_group_id_idx" ON "core_moderators_permissions" USING btree ("group_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_moderators_permissions_user_id_idx" ON "core_moderators_permissions" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_nav_parent_id_idx" ON "core_nav" USING btree ("parent_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_nav_description_item_id_idx" ON "core_nav_description" USING btree ("item_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_nav_description_language_code_idx" ON "core_nav_description" USING btree ("language_code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_nav_name_item_id_idx" ON "core_nav_name" USING btree ("item_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_nav_name_language_code_idx" ON "core_nav_name" USING btree ("language_code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_plugins_code_idx" ON "core_plugins" USING btree ("code");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_plugins_name_idx" ON "core_plugins" USING btree ("name");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_sessions_user_id_idx" ON "core_sessions" USING btree ("user_id");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_sessions_known_devices_ip_address_idx" ON "core_sessions_known_devices" USING btree ("ip_address");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_users_name_seo_idx" ON "core_users" USING btree ("name_seo");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_users_name_idx" ON "core_users" USING btree ("name");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "core_users_email_idx" ON "core_users" USING btree ("email"); \ No newline at end of file diff --git a/backend/src/plugins/core/admin/database/migrations/0001_married_big_bertha.sql b/backend/src/plugins/core/admin/database/migrations/0001_married_big_bertha.sql deleted file mode 100644 index 9a9339261..000000000 --- a/backend/src/plugins/core/admin/database/migrations/0001_married_big_bertha.sql +++ /dev/null @@ -1,49 +0,0 @@ -DROP INDEX IF EXISTS "core_admin_permissions_group_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_admin_permissions_user_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_admin_sessions_login_token_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_admin_sessions_user_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_files_user_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_files_using_file_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_groups_names_item_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_groups_names_language_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_languages_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_languages_name_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_moderators_permissions_group_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_moderators_permissions_user_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_nav_parent_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_nav_description_item_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_nav_description_language_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_nav_name_item_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_nav_name_language_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_plugins_code_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_plugins_name_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_sessions_user_id_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_sessions_known_devices_ip_address_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_users_name_seo_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_users_name_idx";--> statement-breakpoint -DROP INDEX IF EXISTS "core_users_email_idx";--> statement-breakpoint -ALTER TABLE "core_users" ADD COLUMN "language" varchar(5) DEFAULT 'en' NOT NULL;--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_permissions_group_id_idx" ON "core_admin_permissions" USING btree ("group_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_permissions_user_id_idx" ON "core_admin_permissions" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_sessions_login_token_idx" ON "core_admin_sessions" USING btree ("login_token");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_admin_sessions_user_id_idx" ON "core_admin_sessions" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_files_user_id_idx" ON "core_files" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_files_using_file_id_idx" ON "core_files_using" USING btree ("file_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_groups_names_item_id_idx" ON "core_groups_names" USING btree ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_groups_names_language_code_idx" ON "core_groups_names" USING btree ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_languages_code_idx" ON "core_languages" USING btree ("code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_languages_name_idx" ON "core_languages" USING btree ("name");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_moderators_permissions_group_id_idx" ON "core_moderators_permissions" USING btree ("group_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_moderators_permissions_user_id_idx" ON "core_moderators_permissions" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_parent_id_idx" ON "core_nav" USING btree ("parent_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_description_item_id_idx" ON "core_nav_description" USING btree ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_description_language_code_idx" ON "core_nav_description" USING btree ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_name_item_id_idx" ON "core_nav_name" USING btree ("item_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_nav_name_language_code_idx" ON "core_nav_name" USING btree ("language_code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_plugins_code_idx" ON "core_plugins" USING btree ("code");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_plugins_name_idx" ON "core_plugins" USING btree ("name");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_sessions_user_id_idx" ON "core_sessions" USING btree ("user_id");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_sessions_known_devices_ip_address_idx" ON "core_sessions_known_devices" USING btree ("ip_address");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_users_name_seo_idx" ON "core_users" USING btree ("name_seo");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_users_name_idx" ON "core_users" USING btree ("name");--> statement-breakpoint -CREATE INDEX IF NOT EXISTS "core_users_email_idx" ON "core_users" USING btree ("email"); \ No newline at end of file diff --git a/backend/src/plugins/core/admin/database/migrations/meta/0000_snapshot.json b/backend/src/plugins/core/admin/database/migrations/meta/0000_snapshot.json index d24188567..161804cd7 100644 --- a/backend/src/plugins/core/admin/database/migrations/meta/0000_snapshot.json +++ b/backend/src/plugins/core/admin/database/migrations/meta/0000_snapshot.json @@ -1,4 +1,6 @@ { + "id": "db8ccc11-014d-4276-9890-45e93955d2c4", + "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { @@ -55,6 +57,7 @@ }, "indexes": { "core_admin_permissions_group_id_idx": { + "name": "core_admin_permissions_group_id_idx", "columns": [ { "expression": "group_id", @@ -63,12 +66,13 @@ "nulls": "last" } ], - "name": "core_admin_permissions_group_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_admin_permissions_user_id_idx": { + "name": "core_admin_permissions_user_id_idx", "columns": [ { "expression": "user_id", @@ -77,38 +81,38 @@ "nulls": "last" } ], - "name": "core_admin_permissions_user_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_admin_permissions_group_id_core_groups_id_fk": { "name": "core_admin_permissions_group_id_core_groups_id_fk", "tableFrom": "core_admin_permissions", + "tableTo": "core_groups", "columnsFrom": [ "group_id" ], - "tableTo": "core_groups", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "core_admin_permissions_user_id_core_users_id_fk": { "name": "core_admin_permissions_user_id_core_users_id_fk", "tableFrom": "core_admin_permissions", + "tableTo": "core_users", "columnsFrom": [ "user_id" ], - "tableTo": "core_users", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -159,6 +163,7 @@ }, "indexes": { "core_admin_sessions_login_token_idx": { + "name": "core_admin_sessions_login_token_idx", "columns": [ { "expression": "login_token", @@ -167,12 +172,13 @@ "nulls": "last" } ], - "name": "core_admin_sessions_login_token_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_admin_sessions_user_id_idx": { + "name": "core_admin_sessions_user_id_idx", "columns": [ { "expression": "user_id", @@ -181,38 +187,38 @@ "nulls": "last" } ], - "name": "core_admin_sessions_user_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_admin_sessions_user_id_core_users_id_fk": { "name": "core_admin_sessions_user_id_core_users_id_fk", "tableFrom": "core_admin_sessions", + "tableTo": "core_users", "columnsFrom": [ "user_id" ], - "tableTo": "core_users", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "core_admin_sessions_device_id_core_sessions_known_devices_id_fk": { "name": "core_admin_sessions_device_id_core_sessions_known_devices_id_fk", "tableFrom": "core_admin_sessions", + "tableTo": "core_sessions_known_devices", "columnsFrom": [ "device_id" ], - "tableTo": "core_sessions_known_devices", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -304,6 +310,7 @@ }, "indexes": { "core_files_user_id_idx": { + "name": "core_files_user_id_idx", "columns": [ { "expression": "user_id", @@ -312,25 +319,25 @@ "nulls": "last" } ], - "name": "core_files_user_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_files_user_id_core_users_id_fk": { "name": "core_files_user_id_core_users_id_fk", "tableFrom": "core_files", + "tableTo": "core_users", "columnsFrom": [ "user_id" ], - "tableTo": "core_users", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -367,6 +374,7 @@ }, "indexes": { "core_files_using_file_id_idx": { + "name": "core_files_using_file_id_idx", "columns": [ { "expression": "file_id", @@ -375,25 +383,25 @@ "nulls": "last" } ], - "name": "core_files_using_file_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_files_using_file_id_core_files_id_fk": { "name": "core_files_using_file_id_core_files_id_fk", "tableFrom": "core_files_using", + "tableTo": "core_files", "columnsFrom": [ "file_id" ], - "tableTo": "core_files", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "no action" + "onDelete": "no action", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -550,6 +558,7 @@ }, "indexes": { "core_groups_names_item_id_idx": { + "name": "core_groups_names_item_id_idx", "columns": [ { "expression": "item_id", @@ -558,12 +567,13 @@ "nulls": "last" } ], - "name": "core_groups_names_item_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_groups_names_language_code_idx": { + "name": "core_groups_names_language_code_idx", "columns": [ { "expression": "language_code", @@ -572,38 +582,38 @@ "nulls": "last" } ], - "name": "core_groups_names_language_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_groups_names_item_id_core_groups_id_fk": { "name": "core_groups_names_item_id_core_groups_id_fk", "tableFrom": "core_groups_names", + "tableTo": "core_groups", "columnsFrom": [ "item_id" ], - "tableTo": "core_groups", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "core_groups_names_language_code_core_languages_code_fk": { "name": "core_groups_names_language_code_core_languages_code_fk", "tableFrom": "core_groups_names", + "tableTo": "core_languages", "columnsFrom": [ "language_code" ], - "tableTo": "core_languages", "columnsTo": [ "code" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -704,6 +714,7 @@ }, "indexes": { "core_languages_code_idx": { + "name": "core_languages_code_idx", "columns": [ { "expression": "code", @@ -712,12 +723,13 @@ "nulls": "last" } ], - "name": "core_languages_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_languages_name_idx": { + "name": "core_languages_name_idx", "columns": [ { "expression": "name", @@ -726,10 +738,10 @@ "nulls": "last" } ], - "name": "core_languages_name_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": {}, @@ -737,10 +749,10 @@ "uniqueConstraints": { "core_languages_code_unique": { "name": "core_languages_code_unique", + "nullsNotDistinct": false, "columns": [ "code" - ], - "nullsNotDistinct": false + ] } } }, @@ -797,6 +809,7 @@ }, "indexes": { "core_moderators_permissions_group_id_idx": { + "name": "core_moderators_permissions_group_id_idx", "columns": [ { "expression": "group_id", @@ -805,12 +818,13 @@ "nulls": "last" } ], - "name": "core_moderators_permissions_group_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_moderators_permissions_user_id_idx": { + "name": "core_moderators_permissions_user_id_idx", "columns": [ { "expression": "user_id", @@ -819,38 +833,38 @@ "nulls": "last" } ], - "name": "core_moderators_permissions_user_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_moderators_permissions_group_id_core_groups_id_fk": { "name": "core_moderators_permissions_group_id_core_groups_id_fk", "tableFrom": "core_moderators_permissions", + "tableTo": "core_groups", "columnsFrom": [ "group_id" ], - "tableTo": "core_groups", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "core_moderators_permissions_user_id_core_users_id_fk": { "name": "core_moderators_permissions_user_id_core_users_id_fk", "tableFrom": "core_moderators_permissions", + "tableTo": "core_users", "columnsFrom": [ "user_id" ], - "tableTo": "core_users", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -902,6 +916,7 @@ }, "indexes": { "core_nav_parent_id_idx": { + "name": "core_nav_parent_id_idx", "columns": [ { "expression": "parent_id", @@ -910,10 +925,10 @@ "nulls": "last" } ], - "name": "core_nav_parent_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": {}, @@ -951,6 +966,7 @@ }, "indexes": { "core_nav_description_item_id_idx": { + "name": "core_nav_description_item_id_idx", "columns": [ { "expression": "item_id", @@ -959,12 +975,13 @@ "nulls": "last" } ], - "name": "core_nav_description_item_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_nav_description_language_code_idx": { + "name": "core_nav_description_language_code_idx", "columns": [ { "expression": "language_code", @@ -973,38 +990,38 @@ "nulls": "last" } ], - "name": "core_nav_description_language_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_nav_description_item_id_core_nav_id_fk": { "name": "core_nav_description_item_id_core_nav_id_fk", "tableFrom": "core_nav_description", + "tableTo": "core_nav", "columnsFrom": [ "item_id" ], - "tableTo": "core_nav", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "core_nav_description_language_code_core_languages_code_fk": { "name": "core_nav_description_language_code_core_languages_code_fk", "tableFrom": "core_nav_description", + "tableTo": "core_languages", "columnsFrom": [ "language_code" ], - "tableTo": "core_languages", "columnsTo": [ "code" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -1041,6 +1058,7 @@ }, "indexes": { "core_nav_name_item_id_idx": { + "name": "core_nav_name_item_id_idx", "columns": [ { "expression": "item_id", @@ -1049,12 +1067,13 @@ "nulls": "last" } ], - "name": "core_nav_name_item_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_nav_name_language_code_idx": { + "name": "core_nav_name_language_code_idx", "columns": [ { "expression": "language_code", @@ -1063,38 +1082,38 @@ "nulls": "last" } ], - "name": "core_nav_name_language_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_nav_name_item_id_core_nav_id_fk": { "name": "core_nav_name_item_id_core_nav_id_fk", "tableFrom": "core_nav_name", + "tableTo": "core_nav", "columnsFrom": [ "item_id" ], - "tableTo": "core_nav", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "core_nav_name_language_code_core_languages_code_fk": { "name": "core_nav_name_language_code_core_languages_code_fk", "tableFrom": "core_nav_name", + "tableTo": "core_languages", "columnsFrom": [ "language_code" ], - "tableTo": "core_languages", "columnsTo": [ "code" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -1196,6 +1215,7 @@ }, "indexes": { "core_plugins_code_idx": { + "name": "core_plugins_code_idx", "columns": [ { "expression": "code", @@ -1204,12 +1224,13 @@ "nulls": "last" } ], - "name": "core_plugins_code_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_plugins_name_idx": { + "name": "core_plugins_name_idx", "columns": [ { "expression": "name", @@ -1218,10 +1239,10 @@ "nulls": "last" } ], - "name": "core_plugins_name_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": {}, @@ -1266,6 +1287,7 @@ }, "indexes": { "core_sessions_user_id_idx": { + "name": "core_sessions_user_id_idx", "columns": [ { "expression": "user_id", @@ -1274,38 +1296,38 @@ "nulls": "last" } ], - "name": "core_sessions_user_id_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_sessions_user_id_core_users_id_fk": { "name": "core_sessions_user_id_core_users_id_fk", "tableFrom": "core_sessions", + "tableTo": "core_users", "columnsFrom": [ "user_id" ], - "tableTo": "core_users", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "core_sessions_device_id_core_sessions_known_devices_id_fk": { "name": "core_sessions_device_id_core_sessions_known_devices_id_fk", "tableFrom": "core_sessions", + "tableTo": "core_sessions_known_devices", "columnsFrom": [ "device_id" ], - "tableTo": "core_sessions_known_devices", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -1361,6 +1383,7 @@ }, "indexes": { "core_sessions_known_devices_ip_address_idx": { + "name": "core_sessions_known_devices_ip_address_idx", "columns": [ { "expression": "ip_address", @@ -1369,10 +1392,10 @@ "nulls": "last" } ], - "name": "core_sessions_known_devices_ip_address_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": {}, @@ -1483,9 +1506,10 @@ }, "created": { "name": "created", - "type": "integer", + "type": "timestamp", "primaryKey": false, - "notNull": true + "notNull": true, + "default": "now()" }, "file_size": { "name": "file_size", @@ -1517,15 +1541,15 @@ "core_files_avatars_user_id_core_users_id_fk": { "name": "core_files_avatars_user_id_core_users_id_fk", "tableFrom": "core_files_avatars", + "tableTo": "core_users", "columnsFrom": [ "user_id" ], - "tableTo": "core_users", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -1621,10 +1645,18 @@ "type": "varchar(255)", "primaryKey": false, "notNull": true + }, + "language": { + "name": "language", + "type": "varchar(5)", + "primaryKey": false, + "notNull": true, + "default": "'en'" } }, "indexes": { "core_users_name_seo_idx": { + "name": "core_users_name_seo_idx", "columns": [ { "expression": "name_seo", @@ -1633,12 +1665,13 @@ "nulls": "last" } ], - "name": "core_users_name_seo_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_users_name_idx": { + "name": "core_users_name_idx", "columns": [ { "expression": "name", @@ -1647,12 +1680,13 @@ "nulls": "last" } ], - "name": "core_users_name_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} }, "core_users_email_idx": { + "name": "core_users_email_idx", "columns": [ { "expression": "email", @@ -1661,49 +1695,49 @@ "nulls": "last" } ], - "name": "core_users_email_idx", "isUnique": false, + "concurrently": false, "method": "btree", - "concurrently": false + "with": {} } }, "foreignKeys": { "core_users_group_id_core_groups_id_fk": { "name": "core_users_group_id_core_groups_id_fk", "tableFrom": "core_users", + "tableTo": "core_groups", "columnsFrom": [ "group_id" ], - "tableTo": "core_groups", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "no action" + "onDelete": "no action", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": { "core_users_name_seo_unique": { "name": "core_users_name_seo_unique", + "nullsNotDistinct": false, "columns": [ "name_seo" - ], - "nullsNotDistinct": false + ] }, "core_users_name_unique": { "name": "core_users_name_unique", + "nullsNotDistinct": false, "columns": [ "name" - ], - "nullsNotDistinct": false + ] }, "core_users_email_unique": { "name": "core_users_email_unique", + "nullsNotDistinct": false, "columns": [ "email" - ], - "nullsNotDistinct": false + ] } } } @@ -1711,10 +1745,8 @@ "enums": {}, "schemas": {}, "_meta": { + "columns": {}, "schemas": {}, - "tables": {}, - "columns": {} - }, - "id": "c819b2aa-0c23-45ff-850f-20784ceef738", - "prevId": "00000000-0000-0000-0000-000000000000" + "tables": {} + } } \ No newline at end of file diff --git a/backend/src/plugins/core/admin/database/migrations/meta/0001_snapshot.json b/backend/src/plugins/core/admin/database/migrations/meta/0001_snapshot.json deleted file mode 100644 index ffa0af71c..000000000 --- a/backend/src/plugins/core/admin/database/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,1751 +0,0 @@ -{ - "id": "6afa60eb-a39e-4fd4-977b-b2172513098e", - "prevId": "c819b2aa-0c23-45ff-850f-20784ceef738", - "version": "7", - "dialect": "postgresql", - "tables": { - "public.core_admin_permissions": { - "name": "core_admin_permissions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "group_id": { - "name": "group_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "unrestricted": { - "name": "unrestricted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated": { - "name": "updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "protected": { - "name": "protected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": { - "core_admin_permissions_group_id_idx": { - "name": "core_admin_permissions_group_id_idx", - "columns": [ - { - "expression": "group_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_admin_permissions_user_id_idx": { - "name": "core_admin_permissions_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_admin_permissions_group_id_core_groups_id_fk": { - "name": "core_admin_permissions_group_id_core_groups_id_fk", - "tableFrom": "core_admin_permissions", - "tableTo": "core_groups", - "columnsFrom": [ - "group_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "core_admin_permissions_user_id_core_users_id_fk": { - "name": "core_admin_permissions_user_id_core_users_id_fk", - "tableFrom": "core_admin_permissions", - "tableTo": "core_users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_admin_sessions": { - "name": "core_admin_sessions", - "schema": "", - "columns": { - "login_token": { - "name": "login_token", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "last_seen": { - "name": "last_seen", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "device_id": { - "name": "device_id", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "core_admin_sessions_login_token_idx": { - "name": "core_admin_sessions_login_token_idx", - "columns": [ - { - "expression": "login_token", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_admin_sessions_user_id_idx": { - "name": "core_admin_sessions_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_admin_sessions_user_id_core_users_id_fk": { - "name": "core_admin_sessions_user_id_core_users_id_fk", - "tableFrom": "core_admin_sessions", - "tableTo": "core_users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "core_admin_sessions_device_id_core_sessions_known_devices_id_fk": { - "name": "core_admin_sessions_device_id_core_sessions_known_devices_id_fk", - "tableFrom": "core_admin_sessions", - "tableTo": "core_sessions_known_devices", - "columnsFrom": [ - "device_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_files": { - "name": "core_files", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "extension": { - "name": "extension", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "file_alt": { - "name": "file_alt", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_name_original": { - "name": "file_name_original", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "dir_folder": { - "name": "dir_folder", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "file_size": { - "name": "file_size", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "mimetype": { - "name": "mimetype", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "width": { - "name": "width", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "security_key": { - "name": "security_key", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "core_files_user_id_idx": { - "name": "core_files_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_files_user_id_core_users_id_fk": { - "name": "core_files_user_id_core_users_id_fk", - "tableFrom": "core_files", - "tableTo": "core_users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_files_using": { - "name": "core_files_using", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "file_id": { - "name": "file_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "plugin": { - "name": "plugin", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "folder": { - "name": "folder", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "core_files_using_file_id_idx": { - "name": "core_files_using_file_id_idx", - "columns": [ - { - "expression": "file_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_files_using_file_id_core_files_id_fk": { - "name": "core_files_using_file_id_core_files_id_fk", - "tableFrom": "core_files_using", - "tableTo": "core_files", - "columnsFrom": [ - "file_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_migrations": { - "name": "core_migrations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "plugin": { - "name": "plugin", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created_migration": { - "name": "created_migration", - "type": "bigint", - "primaryKey": false, - "notNull": false - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_groups": { - "name": "core_groups", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated": { - "name": "updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "protected": { - "name": "protected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "default": { - "name": "default", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "root": { - "name": "root", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "guest": { - "name": "guest", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "files_allow_upload": { - "name": "files_allow_upload", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "files_total_max_storage": { - "name": "files_total_max_storage", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 500000 - }, - "files_max_storage_for_submit": { - "name": "files_max_storage_for_submit", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 10000 - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_groups_names": { - "name": "core_groups_names", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "language_code": { - "name": "language_code", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "core_groups_names_item_id_idx": { - "name": "core_groups_names_item_id_idx", - "columns": [ - { - "expression": "item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_groups_names_language_code_idx": { - "name": "core_groups_names_language_code_idx", - "columns": [ - { - "expression": "language_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_groups_names_item_id_core_groups_id_fk": { - "name": "core_groups_names_item_id_core_groups_id_fk", - "tableFrom": "core_groups_names", - "tableTo": "core_groups", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "core_groups_names_language_code_core_languages_code_fk": { - "name": "core_groups_names_language_code_core_languages_code_fk", - "tableFrom": "core_groups_names", - "tableTo": "core_languages", - "columnsFrom": [ - "language_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_languages": { - "name": "core_languages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "timezone": { - "name": "timezone", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true, - "default": "'UTC'" - }, - "protected": { - "name": "protected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "default": { - "name": "default", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated": { - "name": "updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "time_24": { - "name": "time_24", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "locale": { - "name": "locale", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'enUS'" - }, - "allow_in_input": { - "name": "allow_in_input", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": true - }, - "site_copyright": { - "name": "site_copyright", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false, - "default": "''" - } - }, - "indexes": { - "core_languages_code_idx": { - "name": "core_languages_code_idx", - "columns": [ - { - "expression": "code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_languages_name_idx": { - "name": "core_languages_name_idx", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "core_languages_code_unique": { - "name": "core_languages_code_unique", - "nullsNotDistinct": false, - "columns": [ - "code" - ] - } - } - }, - "public.core_moderators_permissions": { - "name": "core_moderators_permissions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "group_id": { - "name": "group_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "unrestricted": { - "name": "unrestricted", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated": { - "name": "updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "protected": { - "name": "protected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": { - "core_moderators_permissions_group_id_idx": { - "name": "core_moderators_permissions_group_id_idx", - "columns": [ - { - "expression": "group_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_moderators_permissions_user_id_idx": { - "name": "core_moderators_permissions_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_moderators_permissions_group_id_core_groups_id_fk": { - "name": "core_moderators_permissions_group_id_core_groups_id_fk", - "tableFrom": "core_moderators_permissions", - "tableTo": "core_groups", - "columnsFrom": [ - "group_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "core_moderators_permissions_user_id_core_users_id_fk": { - "name": "core_moderators_permissions_user_id_core_users_id_fk", - "tableFrom": "core_moderators_permissions", - "tableTo": "core_users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_nav": { - "name": "core_nav", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "href": { - "name": "href", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "external": { - "name": "external", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "position": { - "name": "position", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "icon": { - "name": "icon", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "core_nav_parent_id_idx": { - "name": "core_nav_parent_id_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_nav_description": { - "name": "core_nav_description", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "serial", - "primaryKey": false, - "notNull": true - }, - "language_code": { - "name": "language_code", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar(200)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "core_nav_description_item_id_idx": { - "name": "core_nav_description_item_id_idx", - "columns": [ - { - "expression": "item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_nav_description_language_code_idx": { - "name": "core_nav_description_language_code_idx", - "columns": [ - { - "expression": "language_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_nav_description_item_id_core_nav_id_fk": { - "name": "core_nav_description_item_id_core_nav_id_fk", - "tableFrom": "core_nav_description", - "tableTo": "core_nav", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "core_nav_description_language_code_core_languages_code_fk": { - "name": "core_nav_description_language_code_core_languages_code_fk", - "tableFrom": "core_nav_description", - "tableTo": "core_languages", - "columnsFrom": [ - "language_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_nav_name": { - "name": "core_nav_name", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_id": { - "name": "item_id", - "type": "serial", - "primaryKey": false, - "notNull": true - }, - "language_code": { - "name": "language_code", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "core_nav_name_item_id_idx": { - "name": "core_nav_name_item_id_idx", - "columns": [ - { - "expression": "item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_nav_name_language_code_idx": { - "name": "core_nav_name_language_code_idx", - "columns": [ - { - "expression": "language_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_nav_name_item_id_core_nav_id_fk": { - "name": "core_nav_name_item_id_core_nav_id_fk", - "tableFrom": "core_nav_name", - "tableTo": "core_nav", - "columnsFrom": [ - "item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "core_nav_name_language_code_core_languages_code_fk": { - "name": "core_nav_name_language_code_core_languages_code_fk", - "tableFrom": "core_nav_name", - "tableTo": "core_languages", - "columnsFrom": [ - "language_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_plugins": { - "name": "core_plugins", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "version": { - "name": "version", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "version_code": { - "name": "version_code", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated": { - "name": "updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "support_url": { - "name": "support_url", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "author": { - "name": "author", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "author_url": { - "name": "author_url", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "default": { - "name": "default", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "allow_default": { - "name": "allow_default", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - } - }, - "indexes": { - "core_plugins_code_idx": { - "name": "core_plugins_code_idx", - "columns": [ - { - "expression": "code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_plugins_name_idx": { - "name": "core_plugins_name_idx", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_sessions": { - "name": "core_sessions", - "schema": "", - "columns": { - "login_token": { - "name": "login_token", - "type": "varchar(255)", - "primaryKey": true, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "expires": { - "name": "expires", - "type": "timestamp", - "primaryKey": false, - "notNull": true - }, - "device_id": { - "name": "device_id", - "type": "integer", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "core_sessions_user_id_idx": { - "name": "core_sessions_user_id_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_sessions_user_id_core_users_id_fk": { - "name": "core_sessions_user_id_core_users_id_fk", - "tableFrom": "core_sessions", - "tableTo": "core_users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "core_sessions_device_id_core_sessions_known_devices_id_fk": { - "name": "core_sessions_device_id_core_sessions_known_devices_id_fk", - "tableFrom": "core_sessions", - "tableTo": "core_sessions_known_devices", - "columnsFrom": [ - "device_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_sessions_known_devices": { - "name": "core_sessions_known_devices", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "uagent_browser": { - "name": "uagent_browser", - "type": "varchar(200)", - "primaryKey": false, - "notNull": true - }, - "uagent_version": { - "name": "uagent_version", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "uagent_os": { - "name": "uagent_os", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "last_seen": { - "name": "last_seen", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "core_sessions_known_devices_ip_address_idx": { - "name": "core_sessions_known_devices_ip_address_idx", - "columns": [ - { - "expression": "ip_address", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_themes": { - "name": "core_themes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "version": { - "name": "version", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "version_code": { - "name": "version_code", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created": { - "name": "created", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated": { - "name": "updated", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "support_url": { - "name": "support_url", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "protected": { - "name": "protected", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "author": { - "name": "author", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "author_url": { - "name": "author_url", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "default": { - "name": "default", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_files_avatars": { - "name": "core_files_avatars", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "dir_folder": { - "name": "dir_folder", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created": { - "name": "created", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_size": { - "name": "file_size", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "mimetype": { - "name": "mimetype", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "extension": { - "name": "extension", - "type": "varchar(32)", - "primaryKey": false, - "notNull": true - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": { - "core_files_avatars_user_id_core_users_id_fk": { - "name": "core_files_avatars_user_id_core_users_id_fk", - "tableFrom": "core_files_avatars", - "tableTo": "core_users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {} - }, - "public.core_users": { - "name": "core_users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name_seo": { - "name": "name_seo", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "name": { - "name": "name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "password": { - "name": "password", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "joined": { - "name": "joined", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "posts": { - "name": "posts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "newsletter": { - "name": "newsletter", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "avatar_color": { - "name": "avatar_color", - "type": "varchar(6)", - "primaryKey": false, - "notNull": true - }, - "group_id": { - "name": "group_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "first_name": { - "name": "first_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "last_name": { - "name": "last_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "birthday": { - "name": "birthday", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "ip_address": { - "name": "ip_address", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "language": { - "name": "language", - "type": "varchar(5)", - "primaryKey": false, - "notNull": true, - "default": "'en'" - } - }, - "indexes": { - "core_users_name_seo_idx": { - "name": "core_users_name_seo_idx", - "columns": [ - { - "expression": "name_seo", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_users_name_idx": { - "name": "core_users_name_idx", - "columns": [ - { - "expression": "name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "core_users_email_idx": { - "name": "core_users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "core_users_group_id_core_groups_id_fk": { - "name": "core_users_group_id_core_groups_id_fk", - "tableFrom": "core_users", - "tableTo": "core_groups", - "columnsFrom": [ - "group_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "core_users_name_seo_unique": { - "name": "core_users_name_seo_unique", - "nullsNotDistinct": false, - "columns": [ - "name_seo" - ] - }, - "core_users_name_unique": { - "name": "core_users_name_unique", - "nullsNotDistinct": false, - "columns": [ - "name" - ] - }, - "core_users_email_unique": { - "name": "core_users_email_unique", - "nullsNotDistinct": false, - "columns": [ - "email" - ] - } - } - } - }, - "enums": {}, - "schemas": {}, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/backend/src/plugins/core/admin/database/migrations/meta/_journal.json b/backend/src/plugins/core/admin/database/migrations/meta/_journal.json index 3e02e1da0..c82c3cc4c 100644 --- a/backend/src/plugins/core/admin/database/migrations/meta/_journal.json +++ b/backend/src/plugins/core/admin/database/migrations/meta/_journal.json @@ -1,19 +1,12 @@ { - "version": "6", + "version": "7", "dialect": "postgresql", "entries": [ { "idx": 0, - "version": "6", - "when": 1717093167312, - "tag": "0000_fine_supernaut", - "breakpoints": true - }, - { - "idx": 1, "version": "7", - "when": 1717837200014, - "tag": "0001_married_big_bertha", + "when": 1718618173631, + "tag": "0000_yielding_bloodstrike", "breakpoints": true } ] diff --git a/frontend/app/[locale]/(admin)/admin/(configs)/install/account/page.tsx b/frontend/app/[locale]/(admin)/admin/(configs)/install/account/page.tsx deleted file mode 100644 index b2f660369..000000000 --- a/frontend/app/[locale]/(admin)/admin/(configs)/install/account/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { AccountInstallConfigsView } from "@/plugins/admin/configs/views/install/steps/account/account-install-configs-view"; - -export default function Page() { - return ; -} diff --git a/frontend/app/[locale]/(admin)/admin/(configs)/install/database/page.tsx b/frontend/app/[locale]/(admin)/admin/(configs)/install/database/page.tsx deleted file mode 100644 index 44fbfbdb6..000000000 --- a/frontend/app/[locale]/(admin)/admin/(configs)/install/database/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { DatabaseInstallConfigsView } from "@/plugins/admin/configs/views/install/steps/database/database-install-configs-view"; - -export default function Page() { - return ; -} diff --git a/frontend/app/[locale]/(admin)/admin/(configs)/install/error.tsx b/frontend/app/[locale]/(admin)/admin/(configs)/install/error.tsx deleted file mode 100644 index f657b0ad8..000000000 --- a/frontend/app/[locale]/(admin)/admin/(configs)/install/error.tsx +++ /dev/null @@ -1,7 +0,0 @@ -"use client"; - -import { InternalErrorView } from "@/plugins/admin/global/internal-error/internal-error-view"; - -export default function Error() { - return ; -} diff --git a/frontend/app/[locale]/(admin)/admin/(configs)/install/layout.tsx b/frontend/app/[locale]/(admin)/admin/(configs)/install/layout.tsx deleted file mode 100644 index b4622c4f2..000000000 --- a/frontend/app/[locale]/(admin)/admin/(configs)/install/layout.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import * as React from "react"; -import { redirect } from "@vitnode/frontend/navigation"; - -import { - Admin__Install__Layout, - Admin__Install__LayoutQuery, - Admin__Install__LayoutQueryVariables -} from "@/graphql/hooks"; -import { fetcher, ErrorType } from "@/graphql/fetcher"; -import { LayoutInstallConfigsView } from "@/plugins/admin/configs/views/install/layout-install-configs-view"; -import { InternalErrorView } from "@/plugins/admin/global/internal-error/internal-error-view"; -import { RedirectsInstallConfigsLayout } from "@/plugins/admin/configs/views/install/redirects-install-configs-layout"; - -interface Props { - children: React.ReactNode; -} - -const getData = async () => { - const { data } = await fetcher< - Admin__Install__LayoutQuery, - Admin__Install__LayoutQueryVariables - >({ - query: Admin__Install__Layout, - cache: "force-cache" - }); - - return data; -}; - -export default async function Layout({ children }: Props) { - try { - const data = await getData(); - - return ( - - {children} - - ); - } catch (error) { - const code = error as ErrorType; - - if (code.extensions?.code === "ACCESS_DENIED") { - redirect("/admin"); - } - - return ; - } -} diff --git a/frontend/app/[locale]/(admin)/admin/(configs)/install/license/page.tsx b/frontend/app/[locale]/(admin)/admin/(configs)/install/license/page.tsx deleted file mode 100644 index 611ae4f64..000000000 --- a/frontend/app/[locale]/(admin)/admin/(configs)/install/license/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { LicenseInstallConfigsView } from "@/plugins/admin/configs/views/install/steps/license/license-install-configs-view"; - -export default function Page() { - return ; -} diff --git a/frontend/app/[locale]/(admin)/admin/(configs)/install/page.tsx b/frontend/app/[locale]/(admin)/admin/(configs)/install/page.tsx index b8a632f4f..e044a9c49 100644 --- a/frontend/app/[locale]/(admin)/admin/(configs)/install/page.tsx +++ b/frontend/app/[locale]/(admin)/admin/(configs)/install/page.tsx @@ -1,5 +1,40 @@ -import { InstallConfigsView } from "@/plugins/admin/configs/views/install/steps/install-configs-view"; +import { redirect } from "@vitnode/frontend/navigation"; -export default function Page() { - return ; +import { ErrorType, fetcher } from "@/graphql/fetcher"; +import { + Admin__Install__Layout, + Admin__Install__LayoutQuery, + Admin__Install__LayoutQueryVariables +} from "@/graphql/hooks"; +import { LayoutInstallConfigsView } from "@/plugins/admin/configs/views/install/layout-install-configs-view"; +import { InternalErrorView } from "@/plugins/admin/global/internal-error/internal-error-view"; + +const getData = async () => { + const { data } = await fetcher< + Admin__Install__LayoutQuery, + Admin__Install__LayoutQueryVariables + >({ + query: Admin__Install__Layout, + cache: "force-cache" + }); + + return data; +}; + +export default async function Page() { + try { + const data = await getData(); + + return ( + + ); + } catch (error) { + const code = error as ErrorType; + + if (code.extensions?.code === "ACCESS_DENIED") { + redirect("/admin"); + } + + return ; + } } diff --git a/frontend/components/color/color-input.tsx b/frontend/components/color/color-input.tsx index aadd883cb..cee95e956 100644 --- a/frontend/components/color/color-input.tsx +++ b/frontend/components/color/color-input.tsx @@ -39,7 +39,7 @@ export const ColorInput = ({ const colorBrightness = color ? isColorBrightness(color) : false; return ( - +