-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/acmucsd/membership-portal …
…into feature/automate-database-migrations merging from master
- Loading branch information
Showing
42 changed files
with
1,537 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { MigrationInterface, QueryRunner, Table, TableIndex } from 'typeorm'; | ||
|
||
const TABLE_NAME = 'MerchCollectionPhotos'; | ||
const COLLECTION_TABLE_NAME = 'MerchandiseCollections'; | ||
|
||
export class AddCollectionImageTable1696990832868 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.createTable(new Table({ | ||
name: TABLE_NAME, | ||
columns: [ | ||
{ | ||
name: 'uuid', | ||
type: 'uuid', | ||
isGenerated: true, | ||
isPrimary: true, | ||
generationStrategy: 'uuid', | ||
}, | ||
{ | ||
name: 'merchCollection', | ||
type: 'uuid', | ||
}, | ||
{ | ||
name: 'uploadedPhoto', | ||
type: 'varchar(255)', | ||
}, | ||
{ | ||
name: 'uploadedAt', | ||
type: 'timestamptz', | ||
default: 'CURRENT_TIMESTAMP(6)', | ||
}, | ||
{ | ||
name: 'position', | ||
type: 'integer', | ||
}, | ||
], | ||
// cascade delete | ||
foreignKeys: [ | ||
{ | ||
columnNames: ['merchCollection'], | ||
referencedTableName: COLLECTION_TABLE_NAME, | ||
referencedColumnNames: ['uuid'], | ||
onDelete: 'CASCADE', | ||
}, | ||
], | ||
})); | ||
|
||
await queryRunner.createIndices(TABLE_NAME, [ | ||
new TableIndex({ | ||
name: 'images_by_collection_index', | ||
columnNames: ['merchCollection'], | ||
}), | ||
]); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.dropTable(TABLE_NAME); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { MigrationInterface, QueryRunner, Table } from 'typeorm'; | ||
|
||
const TABLE_NAME = 'ExpressCheckins'; | ||
|
||
export class AddExpressCheckinsTable1708807643314 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.createTable(new Table({ | ||
name: TABLE_NAME, | ||
columns: [ | ||
{ | ||
name: 'uuid', | ||
type: 'uuid', | ||
isPrimary: true, | ||
isGenerated: true, | ||
generationStrategy: 'uuid', | ||
}, | ||
{ | ||
name: 'email', | ||
type: 'varchar(255)', | ||
isUnique: true, | ||
}, | ||
{ | ||
name: 'event', | ||
type: 'uuid', | ||
}, | ||
{ | ||
name: 'timestamp', | ||
type: 'timestamptz', | ||
default: 'CURRENT_TIMESTAMP(6)', | ||
}, | ||
], | ||
})); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.dropTable(TABLE_NAME); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { BaseEntity, Column, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; | ||
import { PublicExpressCheckin, Uuid } from '../types'; | ||
import { EventModel } from './EventModel'; | ||
|
||
@Entity('ExpressCheckins') | ||
export class ExpressCheckinModel extends BaseEntity { | ||
@PrimaryGeneratedColumn('uuid') | ||
uuid: Uuid; | ||
|
||
@Column() | ||
@Index({ unique: true }) | ||
email: string; | ||
|
||
@ManyToOne((type) => EventModel, (event) => event.expressCheckins, { nullable: false }) | ||
@JoinColumn({ name: 'event' }) | ||
event: EventModel; | ||
|
||
@Column('timestamptz', { default: () => 'CURRENT_TIMESTAMP(6)' }) | ||
timestamp: Date; | ||
|
||
public getPublicExpressCheckin(): PublicExpressCheckin { | ||
return { | ||
email: this.email, | ||
event: this.event.getPublicEvent(), | ||
timestamp: this.timestamp, | ||
}; | ||
} | ||
} |
Oops, something went wrong.