add Project Branding Table

This commit is contained in:
einhornimmond 2025-02-13 19:07:35 +01:00
parent 6af4db7041
commit 5adc84bc84
4 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,25 @@
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'
@Entity('project_brandings')
export class ProjectBranding {
@PrimaryGeneratedColumn()
id: number
@Column({ name: 'name', type: 'varchar', length: 255 })
name: string
@Column({ name: 'alias', type: 'varchar', length: 32 })
alias: string
@Column({ name: 'description', type: 'text', nullable: true, default: null })
description: string | null
@Column({ name: 'space_id', type: 'int', unsigned: true, nullable: true, default: null })
spaceId: number | null
@Column({ name:'new_user_to_space', type: 'tinyint', width: 1, default: 0 })
newUserToSpace: boolean
@Column({ name: 'logo_url', type: 'varchar', length: 255, nullable: true, default: null })
logoUrl: string | null
}

View File

@ -0,0 +1 @@
export { ProjectBranding } from './0088-create_project_brandings/ProjectBranding'

View File

@ -2,6 +2,7 @@ import { ContributionLink } from './ContributionLink'
import { LoginElopageBuys } from './LoginElopageBuys'
import { LoginEmailOptIn } from './LoginEmailOptIn'
import { Migration } from './Migration'
import { ProjectBranding } from './ProjectBranding'
import { Transaction } from './Transaction'
import { TransactionLink } from './TransactionLink'
import { User } from './User'
@ -26,6 +27,7 @@ export const entities = [
LoginElopageBuys,
LoginEmailOptIn,
Migration,
ProjectBranding,
PendingTransaction,
Transaction,
TransactionLink,

View File

@ -0,0 +1,25 @@
/* MIGRATION TO CREATE THE project_brandings table
*
* This migration creates the `community` and 'communityfederation' tables in the `apollo` database (`gradido_community`).
*/
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
await queryFn(`
CREATE TABLE \`project_brandings\`(
\`id\` INT UNSIGNED NOT NULL AUTO_INCREMENT,
\`name\` VARCHAR(255) NOT NULL,
\`alias\` VARCHAR(32) NOT NULL,
\`description\` TEXT NULL DEFAULT NULL,
\`space_id\` INT UNSIGNED NULL DEFAULT NULL,
\`new_user_to_space\` TINYINT(1) NOT NULL DEFAULT FALSE,
\`logo_url\` VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY(\`id\`)
) ENGINE = InnoDB;
`)
}
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
await queryFn('DROP TABLE `project_brandings`')
}