Skip to content

Commit

Permalink
feat: create model country #27
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreLZGava committed Nov 24, 2021
1 parent 1b052f7 commit 0afc18a
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/1637764436028-create_country.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {MigrationInterface, QueryRunner, Table} from "typeorm";

export class createCountry1637764436028 implements MigrationInterface {

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

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

}
11 changes: 11 additions & 0 deletions src/electron/database/models/country.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 Country
{
@PrimaryGeneratedColumn()
id: number;

@Column()
name: string;
}

0 comments on commit 0afc18a

Please sign in to comment.