diff --git a/backend/src/shared/infra/typeorm/migrations/1628121901758-CreateUser.ts b/backend/src/shared/infra/typeorm/migrations/1628121901758-CreateUser.ts new file mode 100644 index 0000000..1571cc3 --- /dev/null +++ b/backend/src/shared/infra/typeorm/migrations/1628121901758-CreateUser.ts @@ -0,0 +1,42 @@ +import { MigrationInterface, QueryRunner, Table } from "typeorm"; + +export default class CreateUser1628121901758 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.createTable( + new Table({ + name: "users", + columns: [ + { + name: "id", + type: "uuid", + isPrimary: true + }, + { + name: "name", + type: "varchar" + }, + { + name: "password", + type: "varchar" + }, + { + name: "email", + type: "varchar", + isUnique: true + }, + { + name: "created_at", + type: "timestamp", + default: "now()" + } + ] + }) + ) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropTable("users"); + } + +} diff --git a/backend/src/shared/infra/typeorm/migrations/1628122047487-CreateProperty.ts b/backend/src/shared/infra/typeorm/migrations/1628122047487-CreateProperty.ts new file mode 100644 index 0000000..68743d3 --- /dev/null +++ b/backend/src/shared/infra/typeorm/migrations/1628122047487-CreateProperty.ts @@ -0,0 +1,77 @@ +import {MigrationInterface, QueryRunner, Table} from "typeorm"; + +export default class CreateProperty1628122047487 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.createTable( + new Table({ + name: "properties", + columns: [ + { + name: "id", + type: "uuid", + isPrimary: true + }, + { + name: "title", + type: "varchar" + }, + { + name: "description", + type: "varchar" + }, + { + name: "value", + type: "integer" + }, + { + name: "area", + type: "integer" + }, + { + name: "address", + type: "varchar" + }, + { + name: "public_place", + type: "varchar" + }, + { + name: "house_number", + type: "integer" + }, + { + name: "complement", + type: "varchar" + }, + { + name: "district", + type: "varchar" + }, + { + name: "cep", + type: "integer" + }, + { + name: "city", + type: "varchar" + }, + { + name: "uf", + type: "varchar" + }, + { + name: "created_at", + type: "timestamp", + default: "now()" + } + ] + }) + ) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropTable("properties"); + } + +}