Skip to content

Commit

Permalink
feat: create model category #31
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreLZGava committed Nov 24, 2021
1 parent 1b052f7 commit 8449f84
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/database/migration/1637764675833-create_category.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {MigrationInterface, QueryRunner, Table} from "typeorm";

export class createCategory1637764675833 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(new Table({
name: "category",
columns: [
{
name: "id",
type: "int",
isPrimary: true
},
{
name: "name",
type: "varchar",
}
]
}), true)
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable("category");
}

}
11 changes: 11 additions & 0 deletions src/electron/database/models/category.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity()
export class Category
{
@PrimaryGeneratedColumn()
id: number;

@Column()
name: string;
}

0 comments on commit 8449f84

Please sign in to comment.