Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // initializers/database.ts
- //
- const path = require('path');
- import { createConnection } from 'typeorm';
- import { Card } from 'entities/card';
- export const databaseInitializer = async () => {
- return await createConnection({
- driver: {
- type : 'postgres',
- host : '0.0.0.0',
- port : 5432,
- username : 'finch',
- password : 'finch',
- database : 'finch_development'
- },
- entities: [
- Card,
- ],
- autoSchemaSync: true,
- }).then((...args) => {
- debugger
- console.log('Database connection established');
- });
- };
- //
- // entities/card.ts
- //
- import {
- Entity,
- PrimaryGeneratedColumn,
- Column,
- } from 'typeorm';
- @Entity()
- export class Card {
- @PrimaryGeneratedColumn('uuid')
- id: number;
- @Column('text')
- title: string;
- @Column('boolean')
- done: boolean;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement