mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
feat: add db migrations with typeORM (#28)
* adding typescript packages for typeORM * add typeORM initial files * updating package scripts * updating compose.yaml to have an exposed port for the postgres * modifying setup for typeORM * update database stuff and and package.json to help generate migrations * made models and migrations in typeORM * delete unneeded database.js * made database pattern ignored by jest * remove sequelize * separate member repo from member helper * not sure why i made everything numbers in the model but it's fixed now * edited package.json script * remove unused index.ts * adjusted files to reference repository correctly and appdatasource * made appdatasource export as named * removed start-db script * added init to appdatasource in bot.js * migrations finally! * new migration matching model names I want * updating tests * removing testpathignore patterns since it seems to be unecessary? * adjusting migrations to match current schema * removed reference to secrets file * delete old migration * Revert "delete old migration" This reverts commitdb1efa39a7. * Revert "adjusting migrations to match current schema" This reverts commitef89a83f6a. * just deleted system creation since it's got nothing in it anyway * renamed memberRepository to memberRepo for consistency * added await back to parseMemberCommand call to memberArgumentHandler * changed call to memberHelper.getMembersByAuthor to memberRepo * renamed repo updateMemberValue to updateMemberField * removed throw references in repo docstrings * remove unneeded subscriber directory ref * changed createdAt and updatedAt columns to be auto-generated made member table have timezone * changed casing of isInitialized in mock for bot.js * removed % from ILike query so that it doesn't match substrings/wildcard * renamed some stray updateMemberValue in mocks -> updateMemberField --------- Co-authored-by: Aster Fialla <asterfialla@gmail.com>
This commit is contained in:
26
database/data-source.ts
Normal file
26
database/data-source.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import "reflect-metadata"
|
||||
import { DataSource } from "typeorm"
|
||||
import * as env from 'dotenv';
|
||||
import * as path from "path";
|
||||
|
||||
env.config();
|
||||
|
||||
export const AppDataSource = new DataSource({
|
||||
type: "postgres",
|
||||
host: "localhost",
|
||||
port: 5432,
|
||||
username: "postgres",
|
||||
password: process.env.POSTGRES_PASSWORD,
|
||||
database: "postgres",
|
||||
synchronize: false,
|
||||
logging: true,
|
||||
entities: [path.join(__dirname, "./entity/*.{ts,js}")],
|
||||
migrations: [path.join(__dirname, "./migrations/*.{ts,js}")],
|
||||
migrationsRun: true,
|
||||
migrationsTableName: 'migrations',
|
||||
migrationsTransactionMode: 'all',
|
||||
invalidWhereValuesBehavior: {
|
||||
null: "sql-null",
|
||||
undefined: "throw",
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user