Importante

jueves, 11 de mayo de 2023

nest creamndo primera entidad

 se crea la crapeta twit.entity.ts con la siguiente informacion

/* eslint-disable prettier/prettier */
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';


@Entity( )
export class Twits {
  //este decorador sirver para crear las columnas en la base de datois
  //crea un id automático en la base de datos
  @PrimaryGeneratedColumn('increment')
  id: number;
  @Column()
  menssage: string;

arreglo id en a number

importo tyorg al modulo

import { Module } from '@nestjs/common';
import { TwitsController } from './twits.controller';
import { TwitsService } from './twits.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Twits } from './twits.entity';

@Module({
  imports: [TypeOrmModule.forFeature([Twits])],
  controllers: [TwitsController],
  providers: [TwitsService],
})
export class TwitsModule {}

si guardo ya se debe haceber creado la tabla


0 comentarios:

Publicar un comentario