Add bucket, audioFileName, speechMarksFileName, state to speech table

This commit is contained in:
Hongbo Wu 2022-08-18 17:39:12 +08:00
parent 4cf5b934eb
commit 249a5cda4a
3 changed files with 46 additions and 2 deletions

View file

@ -9,6 +9,13 @@ import {
} from 'typeorm'
import { User } from './user'
export enum SpeechState {
INITIALIZED = 'INITIALIZED',
COMPLETED = 'COMPLETED',
FAILED = 'FAILED',
CANCELLED = 'CANCELLED',
}
@Entity({ name: 'speech' })
export class Speech {
@PrimaryGeneratedColumn('uuid')
@ -22,14 +29,17 @@ export class Speech {
elasticPageId!: string
@Column('text')
audioUrl!: string
audioFileName!: string
@Column('text')
speechMarksUrl!: string
speechMarksFileName!: string
@Column('text')
voice!: string
@Column('enum', { enum: SpeechState })
state!: SpeechState
@CreateDateColumn({ default: () => 'CURRENT_TIMESTAMP' })
createdAt!: Date

View file

@ -0,0 +1,17 @@
-- Type: DO
-- Name: add_state_to_speech
-- Description: Add state field to speech table
BEGIN;
CREATE TYPE speech_state_type AS ENUM ('INITIALIZED', 'COMPLETED', 'FAILED', 'CANCELLED');
ALTER TABLE omnivore.speech
DROP COLUMN audio_url,
DROP COLUMN speech_marks_url,
ADD COLUMN bucket VARCHAR(255) NOT NULL DEFAULT '',
ADD COLUMN audio_file_name VARCHAR(255) NOT NULL DEFAULT '',
ADD COLUMN speech_marks_file_name VARCHAR(255) NOT NULL DEFAULT '',
ADD COLUMN state speech_state_type NOT NULL DEFAULT 'INITIALIZED';
COMMIT;

View file

@ -0,0 +1,17 @@
-- Type: UNDO
-- Name: add_state_to_speech
-- Description: Add state field to speech table
BEGIN;
DROP TYPE IF EXISTS speech_state_type;
ALTER TABLE omnivore.speech
DROP COLUMN bucket,
DROP COLUMN audio_file_name,
DROP COLUMN speech_marks_file_name,
DROP COLUMN state speech_state_type,
ADD COLUMN audio_url text NOT NULL,
ADD COLUMN speech_marks_url text NOT NULL;
COMMIT;