mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
changed autoSchemaCreate connection option to autoSchemaSync
This commit is contained in:
parent
12b3f32956
commit
5dc655ee8d
@ -132,7 +132,7 @@ const options: CreateConnectionOptions = {
|
||||
username: "root", // mysql database username
|
||||
password: "admin", // mysql database password
|
||||
database: "test", // mysql database name
|
||||
autoSchemaCreate: true // if set to true, then database schema will be automatically created on each application start
|
||||
autoSchemaSync: true // if set to true, then database schema will be automatically created on each application start
|
||||
},
|
||||
entities: [Photo] // array of classes you want to create tables for (and work with them in the current connection)
|
||||
};
|
||||
|
||||
@ -69,7 +69,7 @@ export interface ConnectionOptions {
|
||||
username?: string; // database username
|
||||
password?: string; // database password
|
||||
database?: string; // database name
|
||||
autoSchemaCreate?: boolean; // set to true if you want your database schema to be auto created on each application launch
|
||||
autoSchemaSync?: boolean; // set to true if you want your database schema to be auto created on each application launch
|
||||
logging?: {
|
||||
|
||||
logger?: (message: any, level: string) => void; // some specific logger to be used. By default it is a console
|
||||
@ -83,7 +83,7 @@ export interface ConnectionOptions {
|
||||
```
|
||||
|
||||
* To perform a connection you either must specify a connection `url`, either specify `host/port/username/password/database`.
|
||||
* `autoSchemaCreate` allows you to automatically synchronize your database schema (create new tables,
|
||||
* `autoSchemaSync` allows you to automatically synchronize your database schema (create new tables,
|
||||
remove/rename old columns, create foreign keys, etc.) on each application run. Note that there can be errors in schema
|
||||
synchronization (mostly errors can be caused by unresolved foreign keys) and this will crash your application.
|
||||
This option should not be used in production, only during development and only if you are too lazy to use
|
||||
@ -103,7 +103,7 @@ let connectionOptions: ConnectionOptions = {
|
||||
username: "root",
|
||||
password: "admin",
|
||||
database: "test",
|
||||
autoSchemaCreate: true
|
||||
autoSchemaSync: true
|
||||
};
|
||||
|
||||
// create a new connection with mysql driver
|
||||
|
||||
@ -9,7 +9,7 @@ Your database schema is managed automatically by ORM:
|
||||
|
||||
All this must be in sync to make ORM to work correctly. To make a synchronization there are two ways:
|
||||
|
||||
* set in [connection options](connection-and-connection-options.md#connection-options) `autoSchemaCreate: true`.
|
||||
* set in [connection options](connection-and-connection-options.md#connection-options) `autoSchemaSync: true`.
|
||||
In this case database schema will be automatically synchronized each time you run the application.
|
||||
|
||||
* use [schema update gulp plugin](todo) and run schema synchronization process each time you need it.
|
||||
|
||||
@ -9,6 +9,6 @@
|
||||
"password": "admin",
|
||||
"database": "test"
|
||||
},
|
||||
"autoSchemaCreate": true
|
||||
"autoSchemaSync": true
|
||||
}
|
||||
]
|
||||
@ -29,7 +29,7 @@ const options: ConnectionOptions = {
|
||||
logQueries: true,
|
||||
logSchemaCreation: true
|
||||
},
|
||||
autoSchemaCreate: false,
|
||||
autoSchemaSync: false,
|
||||
entities: [Post]
|
||||
};
|
||||
/*const options: CreateConnectionOptions = {
|
||||
@ -40,7 +40,7 @@ const options: ConnectionOptions = {
|
||||
username: "test",
|
||||
password: "admin",
|
||||
database: "test",
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
logging: {
|
||||
logQueries: true
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [__dirname + "/entity/*"]
|
||||
};
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ const options: ConnectionOptions = {
|
||||
logging: {
|
||||
logOnlyFailedQueries: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [EverythingEntity]
|
||||
};
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
usedNamingStrategy: "custom_strategy",
|
||||
entities: [Post],
|
||||
namingStrategies: [CustomNamingStrategy]
|
||||
|
||||
@ -18,7 +18,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [__dirname + "/entity/*"]
|
||||
};
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, PostAuthor]
|
||||
};
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logSchemaCreation: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post]
|
||||
};
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post]
|
||||
};
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Author, Category]
|
||||
};
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Author, Category, PostMetadata]
|
||||
};
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ const options: ConnectionOptions = {
|
||||
logging: {
|
||||
// logQueries: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, PostDetails, PostCategory, PostMetadata, PostImage, PostInformation, PostAuthor]
|
||||
};
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Author, Category]
|
||||
};
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Author, Category]
|
||||
};
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Category]
|
||||
};
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Author, Category]
|
||||
};
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
// entitySchemaDirectories: [__dirname + "/schemas"],
|
||||
entitySchemas: [
|
||||
require(__dirname + "/../../../../sample/sample24-schemas/schemas/post.json"),
|
||||
|
||||
@ -16,7 +16,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Author]
|
||||
};
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Question, Counters]
|
||||
};
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post]
|
||||
};
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [
|
||||
Person,
|
||||
Employee,
|
||||
|
||||
@ -19,7 +19,7 @@ const options: ConnectionOptions = {
|
||||
logOnlyFailedQueries: true,
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [
|
||||
Person,
|
||||
Employee,
|
||||
|
||||
@ -16,7 +16,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin12345",
|
||||
database: "test",
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
logging: {
|
||||
// logQueries: true,
|
||||
logFailedQueryError: true
|
||||
|
||||
@ -12,7 +12,7 @@ const options: ConnectionOptions = {
|
||||
logQueries: true,
|
||||
logSchemaCreation: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Category]
|
||||
};
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ const options: ConnectionOptions = {
|
||||
storage: "temp/sqlitedb.db",
|
||||
tablesPrefix: "samples_" // pay attention on this prefix
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
logging: {
|
||||
logQueries: true,
|
||||
logSchemaCreation: true,
|
||||
|
||||
@ -15,7 +15,7 @@ const options: ConnectionOptions = {
|
||||
logFailedQueryError: true,
|
||||
// logQueries: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [__dirname + "/entity/*"]
|
||||
};
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, PostAuthor, PostCategory],
|
||||
subscribers: [EverythingSubscriber]
|
||||
};
|
||||
|
||||
@ -14,7 +14,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [__dirname + "/entity/*"]
|
||||
};
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [__dirname + "/entity/*"]
|
||||
};
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [__dirname + "/entity/*"]
|
||||
};
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ const options: ConnectionOptions = {
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [__dirname + "/entity/*"],
|
||||
subscribers: [__dirname + "/subscriber/*"]
|
||||
};
|
||||
|
||||
@ -57,7 +57,7 @@ export class ConnectionManager {
|
||||
/**
|
||||
* Creates a new connection based on the given connection options and registers it in the manager.
|
||||
* You need to manually call #connect method to establish connection.
|
||||
* Note that dropSchemaOnConnection and autoSchemaCreate options of a ConnectionOptions will not work there - use
|
||||
* Note that dropSchemaOnConnection and autoSchemaSync options of a ConnectionOptions will not work there - use
|
||||
* createAndConnect method to use them.
|
||||
*/
|
||||
create(options: ConnectionOptions): Connection {
|
||||
@ -128,7 +128,7 @@ export class ConnectionManager {
|
||||
* - TYPEORM_STORAGE - database's storage url. Used only for sqlite databases. Should be a string.
|
||||
* - TYPEORM_USE_POOL - indicates if connection pooling should be enabled. By default its enabled. Should be boolean-like value.
|
||||
* - TYPEORM_DRIVER_EXTRA - extra options to be passed to the driver. Should be a serialized json string of options.
|
||||
* - TYPEORM_AUTO_SCHEMA_CREATE - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_AUTO_SCHEMA_SYNC - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_ENTITIES - list of directories containing entities to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_SUBSCRIBERS - list of directories containing subscribers to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_ENTITY_SCHEMAS - list of directories containing entity schemas to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
@ -196,7 +196,7 @@ export class ConnectionManager {
|
||||
* - TYPEORM_STORAGE - database's storage url. Used only for sqlite databases. Should be a string.
|
||||
* - TYPEORM_USE_POOL - indicates if connection pooling should be enabled. By default its enabled. Should be boolean-like value.
|
||||
* - TYPEORM_DRIVER_EXTRA - extra options to be passed to the driver. Should be a serialized json string of options.
|
||||
* - TYPEORM_AUTO_SCHEMA_CREATE - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_AUTO_SCHEMA_SYNC - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_ENTITIES - list of directories containing entities to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_SUBSCRIBERS - list of directories containing subscribers to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_ENTITY_SCHEMAS - list of directories containing entity schemas to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
@ -327,7 +327,7 @@ export class ConnectionManager {
|
||||
usePool: process.env.TYPEORM_USE_POOL !== undefined ? OrmUtils.toBoolean(process.env.TYPEORM_USE_POOL) : undefined, // special check for defined is required here
|
||||
extra: process.env.TYPEORM_DRIVER_EXTRA ? JSON.parse(process.env.TYPEORM_DRIVER_EXTRA) : undefined
|
||||
},
|
||||
autoSchemaCreate: OrmUtils.toBoolean(process.env.TYPEORM_AUTO_SCHEMA_CREATE),
|
||||
autoSchemaSync: OrmUtils.toBoolean(process.env.TYPEORM_AUTO_SCHEMA_SYNC),
|
||||
entities: process.env.TYPEORM_ENTITIES ? process.env.TYPEORM_ENTITIES.split(",") : [],
|
||||
subscribers: process.env.TYPEORM_SUBSCRIBERS ? process.env.TYPEORM_SUBSCRIBERS.split(",") : [],
|
||||
entitySchemas: process.env.TYPEORM_ENTITY_SCHEMAS ? process.env.TYPEORM_ENTITY_SCHEMAS.split(",") : [],
|
||||
@ -395,7 +395,7 @@ export class ConnectionManager {
|
||||
await connection.dropDatabase();
|
||||
|
||||
// if option is set - automatically synchronize a schema
|
||||
if (options.autoSchemaCreate && !process.env.SKIP_SCHEMA_CREATION)
|
||||
if (options.autoSchemaSync && !process.env.SKIP_SCHEMA_CREATION)
|
||||
await connection.syncSchema();
|
||||
|
||||
return connection;
|
||||
|
||||
@ -69,7 +69,7 @@ export interface ConnectionOptions {
|
||||
* This option is useful during debug and development.
|
||||
* Alternative to it, you can use CLI and run schema:sync command.
|
||||
*/
|
||||
readonly autoSchemaCreate?: boolean;
|
||||
readonly autoSchemaSync?: boolean;
|
||||
|
||||
/**
|
||||
* Environment in which connection will run.
|
||||
|
||||
@ -120,7 +120,7 @@ export function getConnectionManager(): ConnectionManager {
|
||||
* - TYPEORM_STORAGE - database's storage url. Used only for sqlite databases. Should be a string.
|
||||
* - TYPEORM_USE_POOL - indicates if connection pooling should be enabled. By default its enabled. Should be boolean-like value.
|
||||
* - TYPEORM_DRIVER_EXTRA - extra options to be passed to the driver. Should be a serialized json string of options.
|
||||
* - TYPEORM_AUTO_SCHEMA_CREATE - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_AUTO_SCHEMA_SYNC - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_ENTITIES - list of directories containing entities to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_SUBSCRIBERS - list of directories containing subscribers to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_ENTITY_SCHEMAS - list of directories containing entity schemas to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
@ -171,7 +171,7 @@ export function createConnection(optionsOrConnectionNameFromConfig?: ConnectionO
|
||||
* - TYPEORM_STORAGE - database's storage url. Used only for sqlite databases. Should be a string.
|
||||
* - TYPEORM_USE_POOL - indicates if connection pooling should be enabled. By default its enabled. Should be boolean-like value.
|
||||
* - TYPEORM_DRIVER_EXTRA - extra options to be passed to the driver. Should be a serialized json string of options.
|
||||
* - TYPEORM_AUTO_SCHEMA_CREATE - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_AUTO_SCHEMA_SYNC - indicates if automatic schema synchronization will be performed on each application run. Should be boolean-like value.
|
||||
* - TYPEORM_ENTITIES - list of directories containing entities to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_SUBSCRIBERS - list of directories containing subscribers to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
* - TYPEORM_ENTITY_SCHEMAS - list of directories containing entity schemas to load. Should be string - directory names (can be patterns) split by a comma.
|
||||
|
||||
@ -114,7 +114,7 @@ describe("ConnectionManager", () => {
|
||||
it("should not drop the database if dropSchemaOnConnection was not specified", async () => {
|
||||
const options: ConnectionOptions = {
|
||||
driver: createTestingConnectionOptions("mysql"),
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post]
|
||||
};
|
||||
const connectionManager = new ConnectionManager();
|
||||
@ -136,7 +136,7 @@ describe("ConnectionManager", () => {
|
||||
it("should drop the database if dropSchemaOnConnection was set to true (mysql)", async () => {
|
||||
const options: ConnectionOptions = {
|
||||
dropSchemaOnConnection: true,
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
driver: createTestingConnectionOptions("mysql"),
|
||||
entities: [Post]
|
||||
};
|
||||
@ -158,7 +158,7 @@ describe("ConnectionManager", () => {
|
||||
it("should drop the database if dropSchemaOnConnection was set to true (postgres)", async () => {
|
||||
const options: ConnectionOptions = {
|
||||
dropSchemaOnConnection: true,
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
driver: createTestingConnectionOptions("postgres"),
|
||||
entities: [Post]
|
||||
};
|
||||
@ -181,7 +181,7 @@ describe("ConnectionManager", () => {
|
||||
it("should drop the database if dropSchemaOnConnection was set to true (postgres)", async () => {
|
||||
const options: ConnectionOptions = {
|
||||
dropSchemaOnConnection: true,
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
driver: createTestingConnectionOptions("postgres"),
|
||||
entities: [Post]
|
||||
};
|
||||
|
||||
@ -25,7 +25,7 @@ describe("repository > removeById and removeByIds methods", function() {
|
||||
logging: {
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post]
|
||||
};
|
||||
// connect to db
|
||||
|
||||
@ -27,7 +27,7 @@ describe("repository > set/add/remove relation methods", function() {
|
||||
// logQueries: true, // uncomment for debugging
|
||||
logFailedQueryError: true
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: [Post, Category]
|
||||
};
|
||||
// connect to db
|
||||
|
||||
@ -55,7 +55,7 @@ export function createTestingConnectionOptions(type: "mysql"|"mysqlSecondary"|"m
|
||||
/*export async function setupTestingConnections(options?: TestingConnectionOptions) {
|
||||
const parameters: ConnectionOptions = {
|
||||
driver: createTestingConnectionOptions(process.env["connection_setup_name"]),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -79,7 +79,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const mysqlParameters: ConnectionOptions = {
|
||||
name: "mysqlPrimaryConnection",
|
||||
driver: createTestingConnectionOptions("mysql"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -93,7 +93,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const mysqlSecondaryParameters: ConnectionOptions = {
|
||||
name: "mysqlSecondaryConnection",
|
||||
driver: createTestingConnectionOptions("mysqlSecondary"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -107,7 +107,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const mariadbParameters: ConnectionOptions = {
|
||||
name: "mariadbPrimaryConnection",
|
||||
driver: createTestingConnectionOptions("mariadb"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -121,7 +121,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const mariadbSecondaryParameters: ConnectionOptions = {
|
||||
name: "mariadbSecondaryConnection",
|
||||
driver: createTestingConnectionOptions("mariadbSecondary"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -135,7 +135,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const postgresParameters: ConnectionOptions = {
|
||||
name: "postgresPrimaryConnection",
|
||||
driver: createTestingConnectionOptions("postgres"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -149,7 +149,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const postgresSecondaryParameters: ConnectionOptions = {
|
||||
name: "postgresSecondaryConnection",
|
||||
driver: createTestingConnectionOptions("postgresSecondary"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -163,7 +163,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const sqliteParameters: ConnectionOptions = {
|
||||
name: "sqlitePrimaryConnection",
|
||||
driver: createTestingConnectionOptions("sqlite"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -177,7 +177,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const sqliteSecondaryParameters: ConnectionOptions = {
|
||||
name: "sqliteSecondaryConnection",
|
||||
driver: createTestingConnectionOptions("sqliteSecondary"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -191,7 +191,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const mssqlParameters: ConnectionOptions = {
|
||||
name: "mssqlPrimaryConnection",
|
||||
driver: createTestingConnectionOptions("mssql"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -205,7 +205,7 @@ export async function setupTestingConnections(options?: TestingConnectionOptions
|
||||
const mssqlSecondaryParameters: ConnectionOptions = {
|
||||
name: "mssqlSecondaryConnection",
|
||||
driver: createTestingConnectionOptions("mssqlSecondary"),
|
||||
autoSchemaCreate: options && options.entities ? options.schemaCreate : false,
|
||||
autoSchemaSync: options && options.entities ? options.schemaCreate : false,
|
||||
dropSchemaOnConnection: options && options.entities ? options.dropSchemaOnConnection : false,
|
||||
entities: options && options.entities ? options.entities : [],
|
||||
entitySchemas: options && options.entitySchemas ? options.entitySchemas : [],
|
||||
@ -267,7 +267,7 @@ export function setupConnection(callback: (connection: Connection) => any, entit
|
||||
password: "admin",
|
||||
database: "test"
|
||||
},
|
||||
autoSchemaCreate: true,
|
||||
autoSchemaSync: true,
|
||||
entities: entities
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user