Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { MigrationInterface, QueryRunner, Table } from "typeorm";

export default class CreateUser1628121901758 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.dropTable("users");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import {MigrationInterface, QueryRunner, Table} from "typeorm";

export default class CreateProperty1628122047487 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.dropTable("properties");
}

}